Wednesday, July 4, 2012

How to php convert associative array to indexed array in PHP

get index  of array in php
<?php
$arr
=array('index1' =>'value1' "index2" =>'value2' "index3"=>'value3'); 


$ar=array_values($arr); // convert to indexing  array 


$key=array_keys($arr); // get index name 


for($i=0$icount($ar) ; $i++){
echo 
$key[$i]."=".$ar[$i]."<br> ";
}
 
?>

output

index1=value1
index2=value2
index3=value3

No comments:

Post a Comment

If you Satisfied , Please Leave a comment