3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait DataCollector { static function setData( $data ) { use DataCollector; DataCollector::collectedData( 'set', $data ); } private static function collectedData( $type, $value = NULL ) { static $CollectionData = array(); if( strtolower( $type ) === 'set' ) { $CollectionData[] = $value; var_dump($CollectionData); } elseif( strtolower( $type ) === 'get' ) return $CollectionData; } private static function getCollectedData() { DataCollector::collectedData( 'get' ); } } trait dataHandler { use DataCollector { getCollectedData as public; collectedData as public; } } class Form { use DataCollector {} } class Field extends Form { public function __construct( $type, $text = NULL ) { DataCollector::setData( $type ); } } class A { use DataCollector{} public function __construct( $type, $text = NULL ) { DataCollector::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.5.10.0100.07317.21
5.5.00.0070.08017.32
5.4.170.0070.06319.09
5.4.160.0030.04319.07
5.4.150.0000.04719.01
5.4.140.0100.06716.55
5.4.130.0130.03716.50
5.4.120.0170.07016.42
5.4.110.0130.07016.45
5.4.100.0070.06016.37
5.4.90.0030.08016.38
5.4.80.0000.07716.39
5.4.70.0070.07016.22
5.4.60.0100.06016.29
5.4.50.0130.07016.36
5.4.40.0070.07716.50
5.4.30.0070.07316.44
5.4.20.0030.07316.39
5.4.10.0100.06316.27
5.4.00.0100.06715.87
5.3.270.0070.08014.43
5.3.260.0030.04314.43
5.3.250.0130.03314.54
5.3.240.0030.06314.55
5.3.230.0230.05714.38
5.3.220.0070.05714.56
5.3.210.0100.07314.64
5.3.200.0100.06014.34
5.3.190.0130.07314.65
5.3.180.0130.06314.51
5.3.170.0070.06014.48
5.3.160.0100.06314.53
5.3.150.0070.07714.49
5.3.140.0070.07314.41
5.3.130.0070.05314.37
5.3.120.0070.07314.37
5.3.110.0070.08014.52
5.3.100.0030.07313.97
5.3.90.0130.06313.95
5.3.80.0030.07713.96
5.3.70.0070.05313.93
5.3.60.0100.07014.07
5.3.50.0030.06013.92
5.3.40.0130.07013.71
5.3.30.0030.07313.88
5.3.20.0030.05313.68
5.3.10.0070.06313.62
5.3.00.0130.06713.59

preferences:
140.44 ms | 1386 KiB | 7 Q