3v4l.org

run code in 300+ PHP versions simultaneously
<?php $o = new stdClass; $o->text = "ans1"; $o2 = new stdClass; $o2->text = "ans2"; $o3 = new stdClass; $o3->text = "ans3"; // answer really starts here: $arr = [$o, $o2, $o3]; print_r(array_column($arr, 'text'));

preferences:
44.38 ms | 402 KiB | 5 Q