Thursday, 25 September 2014

array_values in PHP

 array_values() function is used to fetch all the values from an input array.

Syntax:

array_values(array)
array : Required. Specifying an array
Tip : The returned array will have numeric keys, starting at 0 and increase by

Example:

<?php  
$daysarr1 = array( "a"=>"Sunday","b"=>"Monday","c"=>"Tuesday" );
print_r(array_values($daysarr1));
?>

Output will be:

Array (
        [0] = > Sunday
        [1] => Monday 
        [2] => Tuesday
      )

0 comments:

Post a Comment