If you somehow need to get either only the keys or values of an associative array, you can do so with help of “array_keys” or “array_values” functions. See the example below:
1
2
3
4
5
| $my_array = array ( "key1" => "value 1" , "key2" => "value 2" , "key3" => "value 3" ); print_r( array_keys ( $my_array )); echo "<br>" ; print_r( array_values ( $my_array )); |
No comments:
Post a Comment