iterate through multidimentional array in php -
i have multid array how loop through each element, simple array can way
$numbers = array( 1, 2, 3, 4, 5); foreach( $numbers $value ) { echo "value $value <br />"; }
so how loop through next array
array(852,array(456,1234,784),array(102,896,121),array(1222,963,123),array(102,896,121),1234,array(102,896,121),676,54654,array(123,4785,123),array(41256,789),741,123,array(4561))
try way
$array=array(852,array(456,1234,784),array(102,896,121),array(1222,963,123),array(102,896,121),1234,array(102,896,121),676,54654,array(123,4785,123),array(41256,789),741,123,array(4561)); foreach( $array $value ) { if(is_array($value)) { foreach($value $v) { echo "value $v <br />"; } } else { echo "value $value <br />"; } }
php arrays sorting
No comments:
Post a Comment