3v4l.org

run code in 300+ PHP versions simultaneously
<?php class EmailSendingErrorException extends RuntimeException { public $message = 'Impossible d\'envoyer l\'email.'; } class NotificationSendingErrorException extends RuntimeException { public $message = 'Impossible d\'envoyer la notification.'; } class ShortText extends RuntimeException { public $message = 'Le texte fourni est trop court.'; } /** * @var string $text le contenu du message * @return bool true en cas de succès * @throw Exception on error */ function sendEmail(string $text): bool { if (/*envoie du message échoue*/ true) { throw new EmailSendingErrorException(); } return true; } /** * @var string $text le contenu du message * @return bool true en cas de succès * @throw Exception on error */ function sendNotification(string $text): bool { if (/*envoie de notification échoue*/ true) { throw new NotificationSendingErrorException(); } return true; } /** * @var string $text le contenu du message * @return bool true en cas de succès * @throw Exception on error */ function sendMessage(string $text): bool { if (10 > strlen($text)) { throw new ShortTextException(); } try { sendNotification($text); } catch (NotificationSendingErrorException $e) { // Envoyez vous une alerte // pour vous prévenir que les notifications ne marche pas ;) } finally { // finally permet d'exécuter du code quoi qu'il arrive :) sendEmail($text); // si une exception est jetée par sendEmail, // Le return n'est jamais exécuté return true; } } try { sendMessage('Hello, ici Greg "pappy" Boyington'); } catch (ShortTextException $e) { echo $e->message; } catch (EmailSendingErrorException $e) { echo 'Une erreur est survenue lors de l\'envoie du message, nos équipes ont été prévenues, veuillez réessayer plus tard'; } catch (Exception $e) { echo 'Une erreur inattendue est survenue, nos équipes ont été prévenues, veuillez réessayer plus tard'; }

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.130.0090.00016.76
8.3.120.0200.00617.79
8.3.110.0230.00418.13
8.3.100.0280.00726.46
8.3.90.0190.00619.88
8.3.80.0170.00916.49
8.3.70.0230.00616.54
8.3.60.0170.00817.13
8.3.50.0170.00616.63
8.3.40.0190.00517.82
8.3.30.0060.01217.78
8.3.20.0110.00520.57
8.3.10.0170.00820.76
8.3.00.0140.00420.82
8.2.250.0050.00316.83
8.2.240.0130.00816.62
8.2.230.0170.00718.48
8.2.220.0140.00323.54
8.2.210.0150.00919.81
8.2.200.0230.00116.59
8.2.190.0230.00517.32
8.2.180.0210.00319.64
8.2.170.0210.00717.98
8.2.160.0210.00619.44
8.2.150.0170.00820.33
8.2.140.0200.00620.42
8.2.130.0230.00520.71
8.2.120.0240.00319.29
8.2.110.0220.00519.53
8.2.100.0130.01018.43
8.2.90.0120.00718.43
8.2.80.0130.00618.74
8.2.70.0050.00918.26
8.2.60.0100.00518.37
8.2.50.0130.00418.83
8.2.40.0130.00318.64
8.2.30.0130.00618.66
8.2.20.0120.00319.15
8.2.10.0120.00718.55
8.2.00.0110.00518.63
8.1.300.0140.00216.56
8.1.290.0110.00317.01
8.1.280.0110.00519.56
8.1.270.0110.00420.61
8.1.260.0090.00621.10
8.1.250.0120.00221.63
8.1.240.0120.00519.66
8.1.230.0070.00718.50
8.1.220.0090.00418.26
8.1.210.0100.00318.38
8.1.200.0090.00618.01
8.1.190.0090.00818.04
8.1.180.0070.00718.11
8.1.170.0080.00818.31
8.1.160.0070.00818.76
8.1.150.0120.00518.54
8.1.140.0080.00718.27
8.1.130.0110.00518.73
8.1.120.0110.00618.00
8.1.110.0100.00617.89
8.1.100.0100.00417.95
8.1.90.0050.00917.95
8.1.80.0110.00318.21
8.1.70.0090.00517.98
8.1.60.0090.00617.80
8.1.50.0090.00717.96
8.1.40.0130.00618.04
8.1.30.0120.00518.05
8.1.20.0110.00518.06
8.1.10.0110.00517.89
8.1.00.0120.00417.67
8.0.300.0110.00517.89
8.0.290.0190.00216.97
8.0.280.0140.00817.30
8.0.270.0170.00317.40
8.0.260.0170.00617.27
8.0.250.0170.00716.92
8.0.240.0160.00616.88
8.0.230.0160.00517.03
8.0.220.0130.00816.90
8.0.210.0150.00716.93
8.0.200.0210.00616.94
8.0.190.0150.00516.93
8.0.180.0140.00517.02
8.0.170.0170.00716.90
8.0.160.0130.00517.20
8.0.150.0170.00416.89
8.0.140.0170.00616.95
8.0.130.0170.00516.34
8.0.120.0170.00316.42
8.0.110.0120.00716.64
8.0.100.0130.00816.45
8.0.90.0150.00516.42
8.0.80.0160.00616.47
8.0.70.0150.00516.68
8.0.60.0170.00416.44
8.0.50.0160.00516.38
8.0.30.0170.00716.77
8.0.20.0160.00716.73
8.0.10.0150.00816.55
8.0.00.0130.00617.07
7.4.330.0160.00315.54
7.4.320.0170.00516.57
7.4.300.0170.00716.59
7.4.290.0160.00516.54
7.4.280.0200.00516.60
7.4.270.0180.00416.55
7.4.260.0180.00416.05
7.4.250.0150.00616.14
7.4.240.0140.00616.09
7.4.230.0170.00615.98
7.4.220.0170.00316.19
7.4.210.0120.00916.29
7.4.200.0150.00516.06
7.4.190.0140.00516.12
7.4.180.0150.00616.02
7.4.160.0160.00516.15
7.4.150.0150.00616.06
7.4.140.0130.00716.09
7.4.130.0120.00616.03
7.4.120.0150.00416.03
7.4.110.0150.00416.00
7.4.100.0160.00516.09
7.4.90.0150.00715.96
7.4.80.0140.00715.90
7.4.70.0140.00615.93
7.4.60.0160.00315.95
7.4.50.0160.00415.89
7.4.40.0130.00615.89
7.4.30.0160.00315.89
7.4.20.0140.00515.93
7.4.10.0160.00415.88
7.4.00.0130.00715.96
7.3.330.0150.00416.40
7.3.320.0140.00415.86
7.3.310.0120.00516.01
7.3.300.0140.00216.02
7.3.290.0110.00616.13
7.3.280.0120.00715.96
7.3.270.0160.00716.03
7.3.260.0130.00516.02
7.3.250.0130.00715.91
7.3.240.0130.00615.92
7.3.230.0200.00215.95
7.3.220.0150.00615.87
7.3.210.0170.00415.87
7.3.200.0160.00315.87
7.3.190.0160.00415.84
7.3.180.0160.00415.88
7.3.170.0160.00615.99
7.3.160.0120.00715.81
7.3.150.0140.00515.78
7.3.140.0140.00515.96
7.3.130.0140.00515.84
7.3.120.0130.00615.76
7.3.110.0160.00515.88
7.3.100.0150.00415.76
7.3.90.0150.00416.20
7.3.80.0120.00615.92
7.3.70.0090.00816.04
7.3.60.0160.00316.03
7.3.50.0150.00416.11
7.3.40.0120.00616.14
7.3.30.0160.00416.08
7.3.20.0180.00317.08
7.3.10.0140.00517.12
7.3.00.0140.00517.02

preferences:
26.96 ms | 403 KiB | 5 Q