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

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -