3v4l.org

run code in 300+ PHP versions simultaneously
<?php class AuxiliaryVerbQuestion { private $iHaveNoClue = [ 'Why do you think I can answer that?', 'Why are you asking me?', 'Try asking @Danack', 'What are you even saying?', 'Why do you even care?', 'Who the hell are you?', 'Why are you asking?', 'You know I\'m a bot, right?', 'Wanna buy some weed?', 'WHAT YEAR IS IT??????', 'Wanna get high?', 'Who am I?', '42.', ]; private $singleOption = [ 'Possibly?', 'Probably?', 'Maybe?', 'No!!!!!!111one', 'Yes!!!!!!111one', 'No.', 'Yes.', 'Nope.', 'Yep.', 'I don\'t think so...', 'I think so...', 'Negative.', 'Affirmative.', 'Definitely no! ...right?', 'Definitely yes! ...right?', 'Granted.', 'Indeed.', ]; private $twoOptions = [ 'I\'m gonna say the former.', 'I\'m gonna say the latter.', ]; private $severalOptions = [ 'I\'d say %%%', ]; function __construct(){ $this->singleOption = array_merge($this->singleOption, $this->iHaveNoClue); } function answer($question){ echo $question . " \n"; $verbs = 'is|are|can|could|do|does|have|has|may|might|shall|should|will|would'; preg_match('@^ (' . $verbs . ') \s+ (.+?) \s+ (.+) \s* ? \s*$@x', $question, $matches); list(, $verb, $who, $options) = $matches; $options = explode("or", $options); foreach($options as $i => $option){ $options[$i] = trim($option); } if(count($options) === 1){ $answers = $this->singleOption; }else{ $answers = $this->severalOptions; if(count($options) === 2){ $answers = array_merge($answers, $this->twoOptions); } } return $answers[random_int(0, count($answers) - 1)]; } } $x = new AuxiliaryVerbQuestion(); print_r($x->answer('is @PeeHaa skynet?')); echo "\n\n";

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.0.30.0150.00617.06
8.0.20.0160.00717.08
8.0.10.0150.00917.11
8.0.00.0030.01617.09
7.4.160.0140.00516.74
7.4.150.0050.01716.60
7.4.140.0140.00716.76
7.4.130.0160.00316.65
7.4.120.0090.00616.61
7.4.110.0100.01016.68
7.4.100.0070.01016.78
7.4.90.0060.01116.76
7.4.80.0130.00316.56
7.4.70.0060.01316.75
7.4.60.0070.01716.75
7.4.50.0120.00816.84
7.4.40.0160.00316.62
7.4.30.0110.01116.83
7.4.20.0110.01116.81
7.4.10.0100.00416.13
7.4.00.0090.00915.79
7.3.270.0120.00616.48
7.3.260.0120.00616.52
7.3.250.0140.00816.40
7.3.240.0060.01316.55
7.3.230.0110.01216.53
7.3.220.0140.00416.43
7.3.210.0070.01416.40
7.3.200.0060.01016.39
7.3.190.0030.01416.44
7.3.180.0150.00416.40
7.3.170.0090.00916.39
7.3.160.0060.01016.43
7.3.150.0150.00616.42
7.3.140.0110.00416.44
7.3.130.0070.01216.05
7.3.120.0090.01015.79
7.3.110.0070.00815.86
7.3.100.0080.00815.90
7.3.90.0060.01115.87
7.3.80.0060.00815.78
7.3.70.0080.00915.78
7.3.60.0080.00615.87
7.3.50.0090.00815.85
7.3.40.0040.01115.83
7.3.30.0060.00615.80
7.3.20.0080.00817.19
7.3.10.0120.00517.01
7.3.00.0190.00617.09
7.2.340.0090.01616.70
7.2.330.0170.01416.58
7.2.320.0160.01516.72
7.2.310.0170.01216.61
7.2.300.0200.01016.71
7.2.290.0250.00716.68
7.2.280.0260.00316.67
7.2.270.0230.00916.69
7.2.260.0130.00916.26
7.2.250.0100.01216.04
7.2.240.0140.00716.08
7.2.230.0090.01216.12
7.2.220.0100.01316.03
7.2.210.0100.00916.01
7.2.200.0100.01015.99
7.2.190.0110.01116.05
7.2.180.0110.00915.96
7.2.170.0070.01316.07
7.2.160.0160.00716.22
7.2.150.0120.01017.42
7.2.140.0110.00817.48
7.2.130.0120.00717.28
7.2.120.0110.00817.37
7.2.110.0110.00917.39
7.2.100.0620.00816.79
7.2.90.0780.00816.87
7.2.80.0930.00716.92
7.2.70.0450.01016.97
7.2.60.0600.00916.91
7.2.50.0570.00616.90
7.2.40.0590.00917.01
7.2.30.0540.01117.01
7.2.20.0420.00717.00
7.2.10.0440.00816.93
7.2.00.0270.01117.46
7.1.330.0090.00916.36
7.1.320.0100.01016.34
7.1.310.0110.00716.40
7.1.300.0110.00616.32
7.1.290.0130.00716.40
7.1.280.0120.00516.23
7.1.270.0100.00716.24
7.1.260.0100.00716.13
7.1.250.0080.00916.15
7.1.240.0090.01016.36
7.1.230.0110.00816.39
7.1.220.1060.00915.75
7.1.210.0740.01115.72
7.1.200.0750.01015.78
7.1.190.0720.00815.77
7.1.180.0670.00915.78
7.1.170.0470.00715.87
7.1.160.0850.00615.77
7.1.150.0440.01115.81
7.1.140.0590.00715.68
7.1.130.0700.00515.82
7.1.120.0660.00715.88
7.1.110.0620.01315.88
7.1.100.0490.00715.78
7.1.90.0880.01115.86
7.1.80.0700.00815.82
7.1.70.0310.00816.06
7.1.60.0630.01019.76
7.1.50.0360.01123.36
7.1.40.0350.00820.34
7.1.30.0370.00920.44
7.1.20.0470.01320.24
7.1.10.0300.00615.86
7.1.00.0570.02017.08
7.0.330.0090.00816.03
7.0.320.0170.00816.06
7.0.310.0520.00915.36
7.0.300.0760.00615.50
7.0.290.0810.00515.42
7.0.280.0500.00715.51
7.0.270.0470.00715.51
7.0.260.0540.00615.46
7.0.250.0470.00715.54
7.0.240.0520.00815.66
7.0.230.0600.00815.54
7.0.220.0680.00615.46
7.0.210.0510.00915.59
7.0.200.0350.01115.81
7.0.190.0260.00815.55
7.0.180.0430.01115.42
7.0.170.0380.00615.52
7.0.160.0330.00815.53
7.0.150.0360.00615.48
7.0.140.0350.00715.57
7.0.130.0320.00715.53
7.0.120.0280.00715.46
7.0.110.0290.00815.44
7.0.100.0260.01015.55
7.0.90.0260.01015.53
7.0.80.0260.00615.40
7.0.70.0200.01616.74
7.0.60.0170.02316.64
7.0.50.0240.01816.87
7.0.40.0190.01415.57
7.0.30.0170.02115.64
7.0.20.0220.02315.63
7.0.10.0220.01815.54
7.0.00.0210.02515.63
5.6.400.0130.00515.59
5.6.390.0110.01015.65
5.6.380.0100.00915.29
5.6.370.0170.00615.26
5.6.360.0130.00815.36
5.6.350.0130.00615.54
5.6.340.0120.00815.26
5.6.330.0090.00915.29
5.6.320.0100.01015.41
5.6.310.0120.00815.31
5.6.300.0150.00515.26
5.6.290.0160.00815.27
5.6.280.0110.01916.43
5.6.270.0080.01315.22
5.6.260.0100.00815.30
5.6.250.0110.00715.24
5.6.240.0120.00815.24
5.6.230.0110.00715.29
5.6.220.0100.02416.31
5.6.210.0110.02516.47
5.6.200.0070.02516.48
5.6.190.0100.02416.43
5.6.180.0090.01616.43
5.6.170.0090.01716.41
5.6.160.0080.02516.55
5.6.150.0110.02016.38
5.6.140.0100.01916.45
5.6.130.0100.02016.43
5.6.120.0110.02316.41
5.6.110.0110.01716.44
5.6.100.0110.02116.47
5.6.90.0100.02516.50
5.6.80.0140.01416.17
5.6.70.0070.02516.28
5.6.60.0110.02016.26
5.6.50.0100.02316.21
5.6.40.0120.02016.14
5.6.30.0110.02216.32
5.6.20.0070.02216.25
5.6.10.0110.02216.31
5.6.00.0120.01916.24
5.5.380.0120.01213.74
5.5.370.0190.00513.86
5.5.360.0120.03015.84
5.5.350.0100.02715.86
5.5.340.0110.02316.12
5.5.330.0150.03016.14
5.5.320.0110.03116.18
5.5.310.0070.02616.07
5.5.300.0100.03515.98
5.5.290.0150.03116.13
5.5.280.0150.02316.07
5.5.270.0130.01716.09
5.5.260.0100.02916.05
5.5.250.0130.03416.04
5.5.240.0090.03415.84
5.5.230.0130.03215.85
5.5.220.0090.03015.88
5.5.210.0100.02715.82
5.5.200.0140.02915.83
5.5.190.0050.03815.82
5.5.180.0130.02915.90
5.5.170.0190.00715.28
5.5.160.0120.02915.79
5.5.150.0120.03015.82
5.5.140.0140.02815.79
5.5.130.0170.02315.79
5.5.120.0090.02615.82
5.5.110.0120.02115.73
5.5.100.0110.03215.85
5.5.90.0110.02515.75
5.5.80.0120.03015.85
5.5.70.0130.03215.88
5.5.60.0090.01915.76
5.5.50.0080.02715.89
5.5.40.0080.03415.72
5.5.30.0130.03115.72
5.5.20.0110.02015.84
5.5.10.0180.02815.87
5.5.00.0110.02415.72

preferences:
42.15 ms | 403 KiB | 5 Q