3v4l.org

run code in 300+ PHP versions simultaneously
<?php class UserDefinedClass{} class DynamicObject{} $ud_obj = new UserDefinedClass(); $do_obj = new DynamicObject(); $sc_obj = new stdClass(); $a_obj = (object)array(); echo "===[get_class()]===\n"; printf( "UserDefinedClass Object Class: %s\n", get_class($ud_obj)); printf( "DynamicObject Object Class: %s\n", get_class($do_obj)); printf( "StdClass Object Class: %s\n", get_class($sc_obj)); printf( "Array-derived Object Class: %s\n", get_class($a_obj)); echo "\n===[gettype()]===\n"; printf( "UserDefinedClass Object Type: %s\n", gettype($ud_obj)); printf( "DynamicObject Object Type: %s\n", gettype($do_obj)); printf( "StdClass Object Type: %s\n", gettype($sc_obj)); printf( "Array-derived Object Type: %s\n", gettype($a_obj)); echo "\n===[is_a(stdClass::class)]===\n"; printf( "UserDefinedClass Object Type: %s\n", is_a($ud_obj,stdClass::class)); printf( "DynamicObject Object Type: %s\n", is_a($do_obj,stdClass::class)); printf( "StdClass Object Type: %s\n", is_a($sc_obj,stdClass::class)); printf( "Array-derived Object Type: %s\n", is_a($a_obj,stdClass::class)); echo "\n===[instanceof stdClass]===\n"; printf( "UserDefinedClass Object Type: %s\n", $ud_obj instanceof stdClass); printf( "DynamicObject Object Type: %s\n", $do_obj instanceof stdClass); printf( "StdClass Object Type: %s\n", $sc_obj instanceof stdClass); printf( "Array-derived Object Type: %s\n", $a_obj instanceof stdClass); echo "\n===[is_a(DynamicObject::class)]===\n"; printf( "UserDefinedClass Object Type: %s\n", is_a($ud_obj,DynamicObject::class)); printf( "DynamicObject Object Type: %s\n", is_a($do_obj,DynamicObject::class)); printf( "DynamicObject Object Type: %s\n", is_a($sc_obj,DynamicObject::class)); printf( "Array-derived Object Type: %s\n", is_a($a_obj,DynamicObject::class)); echo "\n===[instanceof DynamicObject]===\n"; printf( "UserDefinedClass Object Type: %s\n", $ud_obj instanceof DynamicObject); printf( "DynamicObject Object Type: %s\n", $do_obj instanceof DynamicObject); printf( "DynamicObject Object Type: %s\n", $sc_obj instanceof DynamicObject); printf( "Array-derived Object Type: %s\n", $a_obj instanceof DynamicObject); echo "\n===[is_subclass_of(stdClass::class)]===\n"; printf( "UserDefinedClass Object Type: %s\n", is_subclass_of($ud_obj,stdClass::class)); printf( "DynamicObject Object Type: %s\n", is_subclass_of($do_obj,stdClass::class)); printf( "StdClass Object Type: %s\n", is_subclass_of($sc_obj,stdClass::class)); printf( "Array-derived Object Type: %s\n", is_subclass_of($a_obj,stdClass::class));

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.20.0060.01319.53
8.4.10.0110.00019.56
8.3.150.0160.00319.08
8.3.140.0080.00020.74
8.3.130.0030.00518.60
8.3.120.0040.00419.08
8.3.110.0090.00020.94
8.3.100.0090.00924.06
8.3.90.0130.00626.77
8.3.80.0040.00416.63
8.3.70.0090.00616.75
8.3.60.0080.00818.40
8.3.50.0070.00718.40
8.3.40.0110.01121.73
8.3.30.0030.01318.76
8.3.20.0050.00224.18
8.3.10.0080.00024.66
8.3.00.0050.00326.16
8.2.260.0070.01118.88
8.2.250.0060.00316.62
8.2.240.0040.00417.21
8.2.230.0040.00422.58
8.2.220.0040.00437.54
8.2.210.0110.00326.77
8.2.200.0060.00317.00
8.2.190.0120.00618.54
8.2.180.0120.00625.92
8.2.170.0080.00819.08
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00421.05
8.2.110.0070.00320.47
8.2.100.0000.01020.63
8.1.310.0060.00316.94
8.1.300.0060.00317.95
8.1.290.0000.00818.88
8.1.280.0090.00925.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0030.00623.82
8.1.230.0110.01120.28
8.0.100.0040.00417.03

preferences:
33.92 ms | 403 KiB | 5 Q