3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Object { // protected $hasMany; protected $theSignificativeProperties = ['nome', 'login']; public function getHasMany() { return $this->hasMany; } public function getSignificativeProperties() { return $this->theSignificativeProperties; } } class Aluno extends Object { private $nome; private $login; protected $hasMany = ['post', 'disciplina']; protected $theSignificativeProperties = ['nome', 'login']; /*public function getHasMany() { return $this->hasMany; }*/ /*public function getSignificativeProperties() { return $this->theSignificativeProperties; }*/ } class Post extends Object { // } class Disciplina extends Object { protected $hasMany = ['aluno']; } class EntityManager { // } class RelationalEntityManager extends EntityManager { public function find() { // echo 'Usando o RelationalEntityManager.'; } } class BaseController { protected $objectService; protected $model; public function __construct($modelName) { $this->model = $modelName; $this->objectService = new BaseObjectService($modelName, new RelationalEntityManager()); } public function view() { $args = func_get_args(); $this->objectService->view($args); } } class AlunoController extends BaseController { } class BaseObjectService { protected $em; protected $model; public function __construct($modelName, EntityManager $entityManager) { $this->model = $modelName; $this->em = $entityManager; } public function view($args) { // echo 'Argumentos: '; print_r($args); echo 'Classe em questão: ' . $this->model; echo ' -> Propriedades: '; $reflect = new ReflectionClass(ucfirst($this->model)); // $props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED); $props = $reflect->getProperties(); foreach ($props as $prop) { print $prop->getName() . ", "; } $methods = $reflect->getMethods(); foreach ($methods as $method) { print $method->getName() . ", "; if ( $method->getName() == 'getHasMany') { echo 'achou o HASMANY de ' . $this->model ; //print_r($reflect->getHasMany()); $hasManyMethod = $reflection->getMethod('getHasMany'); $array = $hasManyMethod->invoke(); print_r($array); echo ' --- '; } } // var_dump($props); $this->em->find(); } } echo 'Aluno: ' . class_exists('Aluno') . '<br>'; echo 'Teste: '; var_dump(class_exists('Teste')) . '\n'; $a = new Aluno(); print_r ( $a->getSignificativeProperties() ); $alunoController = new AlunoController('aluno'); $alunoController->view('marcelo', 'boi', 1);

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.3.40.0090.00618.54
8.3.30.0110.00418.54
8.3.20.0030.00522.11
8.3.10.0040.00421.84
8.3.00.0050.00317.59
8.2.170.0060.00922.96
8.2.160.0030.01020.38
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0000.00720.56
8.2.120.0040.00426.35
8.2.110.0060.00320.34
8.2.100.0000.01117.72
8.2.90.0080.00018.95
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0040.00417.91
8.2.50.0030.00618.10
8.2.40.0080.00022.13
8.2.30.0000.00720.97
8.2.20.0000.00717.88
8.2.10.0000.00717.87
8.2.00.0000.00717.95
8.1.270.0050.00321.94
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00622.61
8.1.230.0040.00719.08
8.1.220.0080.00317.74
8.1.210.0000.00818.77
8.1.200.0040.00417.23
8.1.190.0050.00517.09
8.1.180.0000.00818.10
8.1.170.0050.00318.30
8.1.160.0000.00718.99
8.1.150.0060.00320.48
8.1.140.0040.00419.49
8.1.130.0000.00718.81
8.1.120.0000.00817.35
8.1.110.0000.00817.33
8.1.100.0040.00417.22
8.1.90.0070.00017.38
8.1.80.0000.00717.36
8.1.70.0000.00717.25
8.1.60.0000.00917.34
8.1.50.0030.00617.41
8.1.40.0000.00717.39
8.1.30.0040.00417.50
8.1.20.0080.00017.36
8.1.10.0040.00417.30
8.1.00.0000.00717.22
8.0.300.0020.00518.77
8.0.290.0000.00716.63
8.0.280.0000.00718.39
8.0.270.0030.00717.18
8.0.260.0060.00316.64
8.0.250.0000.00816.89
8.0.240.0000.00716.93
8.0.230.0070.00316.79
8.0.220.0000.00716.77
8.0.210.0000.00716.82
8.0.200.0060.00016.91
8.0.190.0040.00416.88
8.0.180.0000.00716.87
8.0.170.0050.00316.92
8.0.160.0030.00316.79
8.0.150.0030.00516.73
8.0.140.0000.00816.76
8.0.130.0000.00513.21
8.0.120.0050.00316.75
8.0.110.0070.00016.84
8.0.100.0000.00716.84
8.0.90.0000.00716.83
8.0.80.0060.01516.74
8.0.70.0000.00816.81
8.0.60.0040.00416.88
8.0.50.0040.00416.74
8.0.30.0070.01216.96
8.0.20.0130.00517.40
8.0.10.0080.00016.83
8.0.00.0140.00416.53
7.4.330.0000.00515.55
7.4.320.0000.00616.48
7.4.300.0030.00316.39
7.4.290.0000.00716.40
7.4.280.0040.00416.30
7.4.270.0050.00316.47
7.4.260.0000.00613.15
7.4.250.0000.00716.34
7.4.240.0000.00716.35
7.4.230.0030.00316.41
7.4.220.0090.01216.52
7.4.210.0080.00816.40
7.4.200.0040.00416.30
7.4.160.0130.00516.40
7.4.150.0090.00917.40
7.4.140.0120.00917.86
7.4.130.0120.00616.54
7.4.120.0100.00716.36
7.4.110.0070.01016.41
7.4.100.0140.00916.37
7.4.90.0100.00716.36
7.4.80.0150.00919.39
7.4.70.0130.00316.37
7.4.60.0100.00716.29
7.4.50.0110.00716.15
7.4.40.0150.01016.46
7.4.30.0200.00316.51
7.4.00.0100.00614.74
7.3.330.0030.00313.11
7.3.320.0030.00312.91
7.3.310.0030.00516.29
7.3.300.0040.00416.11
7.3.290.0040.00416.06
7.3.280.0130.00616.18
7.3.270.0090.00917.40
7.3.260.0070.01016.19
7.3.250.0100.01216.29
7.3.240.0050.01316.11
7.3.230.0130.01016.41
7.3.210.0090.00616.44
7.3.200.0100.00716.53
7.3.190.0160.00716.30
7.3.180.0210.00316.42
7.3.170.0100.00616.23
7.3.160.0060.01116.45
7.3.120.0130.00614.77
7.3.110.0000.01514.65
7.3.100.0040.01114.32
7.3.90.0040.01114.44
7.3.80.0070.01014.39
7.3.70.0080.00414.64
7.3.60.0070.00314.50
7.3.50.0130.00014.50
7.3.40.0040.01114.56
7.3.30.0040.00814.41
7.3.20.0060.00616.52
7.3.10.0030.01416.41
7.3.00.0110.00416.48
7.2.330.0140.00616.14
7.2.320.0030.01316.33
7.2.310.0130.00316.45
7.2.300.0150.00916.37
7.2.290.0070.01216.47
7.2.250.0110.00414.69
7.2.240.0070.01314.82
7.2.230.0000.01414.68
7.2.220.0000.00914.54
7.2.210.0060.00914.58
7.2.200.0000.01414.32
7.2.190.0160.00014.68
7.2.180.0080.00914.49
7.2.170.0030.01314.41
7.2.60.0030.01216.48
7.2.00.0030.00718.77
7.1.330.0000.01415.79
7.1.320.0000.01315.62
7.1.310.0080.00815.96
7.1.300.0030.00715.61
7.1.290.0050.00515.52
7.1.280.0080.00315.50
7.1.270.0040.00715.57
7.1.260.0140.00415.60
7.1.200.0040.01115.78
7.1.100.0070.00717.99
7.1.70.0800.00715.08
7.1.60.1100.01733.15
7.1.50.0870.01033.04
7.1.40.1030.01732.72
7.1.30.1030.01032.51
7.1.20.1100.02032.61
7.1.10.1030.01014.80
7.1.00.0900.01014.78
7.0.200.0770.01314.93
7.0.190.0670.00714.86
7.0.180.0730.01314.36
7.0.170.1030.01014.41
7.0.160.0900.00714.38
7.0.150.1200.01314.39
7.0.140.0930.01014.48
7.0.130.0630.01714.74
7.0.120.1030.01314.85
7.0.110.0970.01314.63
7.0.100.0970.01314.71
7.0.90.0930.01714.48
7.0.80.0830.00714.67
7.0.70.1100.01314.46
7.0.60.0970.01714.43
7.0.50.0900.00714.54
7.0.40.1030.00714.41
7.0.30.0930.01314.62
7.0.20.1230.01314.56
7.0.10.0830.01014.55
7.0.00.0970.01014.69

preferences:
49.35 ms | 400 KiB | 5 Q