array_pad() 用值将数组填补到指定长度
【功能】
该函数将返回指定数组的一个复制,并用指定的值将其填补到指定的长度。
如果指定长度为正,则数组被填补到右侧,如果为负则从左侧开始填补。
如果指定长度的绝对值小于或等于原数组的长度,则没有任何填补
有可能一次最多填补1048576个数组元素
【使用范围】
php4、php5.
【使用】
array array_pad( array input,int pad_size,mixed pad_value )
input/必需/原数组
pad_size/必需/要填补的指定长度
pad_value/必需/为指定的值
【示例】
[php]
$input=array(12,10,9);
var_dump( array_pad($input,5,0) );
var_dump( array_pad($input,-7,-1) );
var_dump( array_pad($input,2,"noop") );
/*
array(5) {
[0]=>
int(12)
[1]=>
int(10)
[2]=>
int(9)
[3]=>
int(0)
[4]=>
int(0)
}
array(7) {
[0]=>
int(-1)
[1]=>
int(-1)
[2]=>
int(-1)
[3]=>
int(-1)
[4]=>
int(12)
[5]=>
int(10)
[6]=>
int(9)
}
array(3) {
[0]=>
int(12)
[1]=>
int(10)
[2]=>
int(9)
}
*/
摘自 zuodefeng的笔记

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
