
hi,
How can i prepand array in PHP. Please suggest any example of prepand array in PHP program.
Thanks,

Hi,
The PHP prepand array function in used before adding any elements at the beginning of an array. To add elements at the beginning we will use array_unshift() function PHP.
I herewith give the code and example of PHP Prepand array.
<?php
$array=array("diwali","dushera","chirstmas");
echo("<b>The original array is:</b><br/>");
print_r($array);array_unshift($array,"ganesh puja");
echo("<br/><b>After prepending an element at the beginning:</b><br/>");
print_r($array);
?>
Thanks