3v4l.org

run code in 300+ PHP versions simultaneously
<?php $places = ['Places'=>[]]; $book1 = new stdClass; $book1->PlaceId = 837; $book1->Name = "United Arab Emirates"; $book1->Type = "Country"; $book2 = new stdClass; $book2->PlaceId = 838; $book2->Name = "Afganistant"; $book2->Type = "Country"; $book3 = new stdClass; $book3->PlaceId = 839; $book3->Name = "Canada"; $book3->Type = "Country"; $places['Places'][] = $book1; $places['Places'][] = $book2; $places['Places'][] = $book3; //print_r($places); $key = array_search(839, array_column($places['Places'], 'PlaceId')); print_r($places['Places'][$key]); ?>

preferences:
28.08 ms | 406 KiB | 5 Q