<?php
$json='[{"text":"Call Now","actionType":"calltoaction","countryCode":"91","phone":"971656XXXX"},{"urltext":"Visit us","actionType":"calltoaction","urlType":"Dynamic","url":"XXX.io?id="}]';
$btnArr = json_decode($json, true);
//echo "<pre>";print_r($btnArr);
$key = searcharray('Dynamic', 'urlType',$btnArr);
echo $key;
function searcharray($value, $key, $array) {
foreach ($array as $k => $val) {
if ($val[$key] == $value) {
return $k;
}
}
return 'null';
}
?>
Output
1