how to i access specific values with keys inside an array

hello
the following is the array dump of one of my arrays..
---------------------------------------------------------------------------------------------------------------
data = array(9) { [0]=> array(2) { ["name"]=> string(10) "first_name" ["value"]=> string(5) "Laddy" } [1]=> array(2) { ["name"]=> string(9) "last_name" ["value"]=> string(1) "B" } [2]=> array(2) { ["name"]=> string(6) "email1" ["value"]=> string(3) "ead" } [3]=> array(2) { ["name"]=> string(12) "phone_mobile" ["value"]=> string(0) "" } [4]=> array(2) { ["name"]=> string(7) "website" ["value"]=> string(0) "" } [5]=> array(2) { ["name"]=> string(23) "lead_source_description" ["value"]=> string(3) "www" } [6]=> array(2) { ["name"]=> string(6) "status" ["value"]=> string(10) "In Process" } [7]=> array(2) { ["name"]=> string(11) "lead_source" ["value"]=> string(4) "Open" } [8]=> array(2) { ["name"]=> string(16) "assigned_user_id" ["value"]=> string(3) "7ca} }
----------------------------------------------------------------------------------------------------------------
i would like to know how i can get the specific values without having to dump the array?

thx for your help in advance.
LVL 11
Eaddy BarnesITAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Start your learning adventure here:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html

I will try to look at your array and show you how to decipher it.  ~Ray
0
Ray PaseurCommented:
http://www.laprbass.com/RAY_temp_greeneel.php

<?php // RAY_temp_greeneel.php
error_reporting(E_ALL);


// SEE http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_28243606.html


// TEST DATA
$data = array
( 0 => array( "name"=> "first_name"              , "value"=>  "Laddy" )
, 1 => array( "name"=> "last_name"               , "value"=>  "B" )
, 2 => array( "name"=> "email1"                  , "value"=>  "ead" )
, 3 => array( "name"=> "phone_mobile"            , "value"=>  "" )
, 4 => array( "name"=> "website"                 , "value"=>  "" )
, 5 => array( "name"=> "lead_source_description" , "value"=>  "www" )
, 6 => array( "name"=> "status"                  , "value"=>  "In Process" )
, 7 => array( "name"=> "lead_source"             , "value"=>  "Open" )
, 8 => array( "name"=> "assigned_user_id"        , "value"=>  "7ca" )
)
;

// A SPECIFIC KEY NEEDED FROM THE ARRAY
$key = 'status';

// FIND THE VALUE
foreach ($data as $sub_array)
{
    // WHEN THE KEY IS FOUND
    if ($sub_array['name'] == $key)
    {
        echo PHP_EOL;
        echo $sub_array['name'];
        echo ' => ';
        echo $sub_array['value'];
    }
}

Open in new window

HTH, ~Ray
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Eaddy BarnesITAuthor Commented:
Many thx for your assistance Expert
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.