3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html> <html> <body> <?php class testClass { public $flagName; public $message; } $a1 = new testClass(); $a1->flagname = "LTV Under 50"; $a1->message = "green"; $a2 = new testClass(); $a2->flagname = "Blue"; $a2->message = "Yellow"; $a3 = array_merge($a1,$a2); print_r($a3); $a1=(object) array("flagname"=>"LTV Under 50","b"=>"green"); $a2=(object) array("flagname"=>"blue","b"=>"yellow"); $a1 = array_merge((array)$a1->getArrayCopy(),(array)$a2); print_r($a1); ?> </body> </html>

preferences:
42.71 ms | 402 KiB | 5 Q