Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Pad array to the specified length with a value

Tue Oct 28, 2008 1:29 am

Code:

<?php
   $states
= array("A","B");
   print
"before pad:<br />";
   
print_r($states);
   
$states = array_pad($states,4,"C");
   
$states = array("A","B","C","D");
   print
"<br />after pad:<br />";
   
print_r($states);
?>




Post a reply
  Related Posts  to : Pad array to the specified length with a value
 get string length in asp     -  
 Get field length     -  
 reverse ,length of strings as number of bytes     -  
 Array difference for associate array     -  
 compare an array with another array?     -  
 Pad a string to a certain length with another string     -  
 Shuffle Array     -  
 Pop the element off the end of array     -  
 PHP Array Functions     -  
 Array Passing     -  

Topic Tags

PHP Arrays