how to get value from array in php -


this php array in object have fetch contact value standard array of php. contact value not name value how can value of contact object. want contact value contact key.

stdclass object (     [contactlist] => array         (             [0] => {     contact = 4155553695;     name = "kate bell"; }             [1] => {     contact = 4085553514;     name = "daniel higgins"; }             [2] => {     contact = 8885551212;     name = "john appleseed"; }             [3] => {     contact = 5555228243;     name = "anna haro"; }             [4] => {     contact = 7075551854;     name = "hank zakroff"; }             [5] => {     contact = 5556106679;     name = "david taylor"; }             [6] => {     contact = 542222222222;     name = deepak; }         )  ) 

you can try use updated solution

$result = array(); foreach ($object->contactlist $k=>$v){    preg_match('/(\d+)/s', $v, $contact);    $result[] = $contact[0]; } var_dump($result); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -