<?php $json = '[{"id": 10, "title": "book"},{"id": 24,"title": "cars"},{"id": 52, "title": "houses"}]'; $array = json_decode($json,1); $title = 'cars'; $result = array_filter($array, function ($element) use ($title) { return ($element['title'] == $title); }); echo array_column($result,'id')[0]; ?>
You have javascript disabled. You will not be able to edit any code.