3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait setData { static function setData( $data ) { DataCollector::collectedData( 'set', $data ); } } trait dataHandler { use setData; static function getCollectedData() { DataCollector::collectedData( 'get' ); } private static function collectedData( $type, $value = NULL ) { if( strtolower( $type ) === 'set' ) { $CollectionData[] = $value; var_dump($CollectionData); } elseif( strtolower( $type ) === 'get' ) return self::$CollectionData; } } class DataCollector { use dataHandler { collectedData as public }; private static $CollectionData = array(); } class Form { use setData {} } class Field extends Form { public function __construct( $type, $text = NULL ) { DataCollector::setData( $type ); } } class A { use setData{} public function __construct( $type, $text = NULL ) { self::setData( $type ); } } $Field1 = new Field( '1' ); $Field2 = new Field( '2' ); $A = new A( '3' ); DataCollector::setData('4'); dataHandler::setData('5'); var_dump( dataHandler::getCollectedData() );

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)
5.4.170.0000.04019.11
5.4.160.0100.03019.22
5.4.150.0030.04019.08
5.4.140.0000.03716.47
5.4.130.0030.03316.47
5.4.120.0070.03016.31
5.4.110.0000.03716.45
5.4.100.0100.03016.46
5.4.90.0070.03016.43
5.4.80.0030.03316.43
5.4.70.0000.04016.41
5.4.60.0000.04016.37
5.4.50.0000.03716.25
5.4.40.0000.03716.38
5.4.30.0000.03716.36
5.4.20.0030.03316.40
5.4.10.0000.03716.42
5.4.00.0000.03715.90
5.3.270.0030.03714.54
5.3.260.0000.04014.62
5.3.250.0030.03714.53
5.3.240.0100.03014.53
5.3.230.0070.04014.52
5.3.220.0000.03714.51
5.3.210.0070.03314.49
5.3.200.0000.04014.51
5.3.190.0100.03014.58
5.3.180.0000.04014.49
5.3.170.0070.03314.37
5.3.160.0030.03314.49
5.3.150.0070.03314.49
5.3.140.0030.03314.64
5.3.130.0030.03714.53
5.3.120.0030.04014.43
5.3.110.0030.03714.53
5.3.100.0070.03313.95
5.3.90.0070.03013.92
5.3.80.0130.03313.98
5.3.70.0030.03713.96
5.3.60.0070.03314.01
5.3.50.0070.03013.92
5.3.40.0000.04313.91
5.3.30.0070.04313.84
5.3.20.0130.03313.66
5.3.10.0030.07313.47
5.3.00.0030.05013.58

preferences:
135.4 ms | 1394 KiB | 7 Q