Reputation: 13843
I have an array, which if i do a var_dump() looks like this:
array(5) { ["id"]=> string(10) "2147483647" ["date"]=> string(10) "1304773322" ["twitteruser"]=> string(9) "Username" ["twitterurl"]=> string(103) "http://a2.twimg.com/profile_images/1070129036/30175_415127663488_509603488_44556621_2331814_n_normal.jpg" ["govequote"]=> string(80) "text" }
How can I echo each one selectivly, E.g
I want $image to equal ["twitterurl"]=> string(103) "http://a2.twimg.com/profile_images/1070129036/30175_415127663488_509603488_44556621_2331814_n_normal.jpg"
Upvotes: 1
Views: 255
Reputation: 3123
You can access the data in the array one of two ways:
$image = $arrayVariable["twitterurl"];
or
foreach($arrayVariable as $key => $value){
if($key === "twitterurl")
$image = $value;
}
Upvotes: 0
Reputation: 6127
Maybe using foreach?
foreach($someArray as $key => $element)
{
echo '["'.$key . '"] => ';
var_dump($element);
}
On array like:
$someArray = array('a' => 'b');
Returns:
["a"] => string(1) "b"
Upvotes: 1
Reputation: 17640
whatever the name of your array that you are dumping do this
$image = $arrayName['twitterurl'];
Upvotes: 1