There is a code that receives from the VC long pool the corresponding data in JSON. After json_decode we get an array: (Here is its print_r)
stdClass Object ([ts] => 1843599983 [updates] => Array ([0] => Array ([0] => 9 [1] => -142578342 [2] => 0) [1] => Array ( [0] => 7 [1] => 277292865 [2] => 537091) [2] => Array ([0] => 4 [1] => 537092 [2] => 1 [3] => 277292865 [4] => 1491849931 [5] => ... [6] => Olooop [7] => stdClass Object ()) [3] => Array ([0] => 80 [1] => 1 [ 2] => 0)))
How to find a specific value in a nested array without knowing its exact address?
Here is the code:
$ts = mysql_fetch_assoc(mysql_query("SELECT `var` FROM `settings` WHERE `settings`.`id` = 3 LIMIT 1" )); $ts = $ts['var']; $kek = json_decode(file_get_contents('https://newimv4.vk.com/nim0304?act=a_check&key=35175cb798dae0fa77671dcf0bce35e7efb30&ts='.$ts.'&wait=90&mode=2&version=1')); $ts = $kek -> ts; mysql_query("UPDATE `settings` SET `var` = '".$ts."' WHERE `settings`.`id` = 3;") or die("Ошибка " . mysqli_error()); print_r($kek); $num = array_search('4',($kek->updates)); print_r($num); array_search does not find anything, despite the fact that this value is there. Help)
trueand output - Naumovmysql_*Warning This extension is outdated since PHP 5.5.0 and removed in PHP 7.0.0. Use MySQLi or PDO_MySQL instead. See also the MySQL instruction: API selection and the corresponding FAQ for more details. php.net/manual/ru/function.mysql-query.php - E_p