How do I add to the beginning of an array and find the
number of elements in it?
Answer / jude jeevanraj.p
To do this, you will want to use the array_unshift function
which works like this.
<?php
$values = array(2,3,4,5,6,7,8,9,10);
$elements = array_unshift($values,1);
echo "Number of elements: $elements \n\n";
print_r($values);
?>
Here's the output:
Number of elements: 10
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
[6] => 7
[7] => 8
[8] => 9
[9] => 10
)
Is This Answer Correct ? | 8 Yes | 0 No |
What is print_r?
how retrive the video file in php using video tag
What is the difference between ereg_replace() and eregi_replace()?
Explain what is the use of "echo" in php?
if i give Limit for mysql query through php command line script like this for ex. $limit=500; $total_items = 1500; for($start=0;$start<$total_items;){ $command = "/usr/bin/php -q /home/sitename/public_html/admin/feedmanager/test.php feedid ".$_GET['feedid']." start ".$start." end ".$limit ; $start = $start+$limit; $command_result = system($command); } so it's execute command for 3 times so it give limit to sql query but if i have 27000 data so it takes long time? so my question is that is that any way from php command line script that i can use for collect all the data at once?
why did u want to leave your past organisation?
How can you propagate a session id?
Where do we use get and post?
Xplain is it possible to use com component in php?
What is the difference between fopen() and fclose()?
So if md5() generates the most secure hash, why would you ever use the less secure crc32() and sha1()?
What is difference between static and constant in php?