I am having difficulty pulling a key from an exploded string. I can get the exploded string to print all of the values and keys, but how to I store the key as a variable? Here is my example:
<?php
$str = 'one,two,three,four';
print_r(explode(',', $str));
?>
The above code will print out:
Array
(
[0] => one
[1] => two
[2] => three
)
Anyone know how to access these keys? What would I do if I only wanted to echo out the [1] key? Any help would be great! Thank you!
store the exploded value in an array…