1

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"

4 Answers 4

1

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" 

Demo

Sign up to request clarification or add additional context in comments.

Comments

1

whatever the name of your array that you are dumping do this

$image = $arrayName['twitterurl'];

Comments

0

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;
}

Comments

0
$image = trim( $arr[ "twitterurl" ] );

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.