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.60.0070.01018.56
8.3.50.0130.00716.64
8.3.40.0040.01118.84
8.3.30.0000.01518.50
8.3.20.0090.00523.83
8.3.10.0070.00724.11
8.3.00.0100.00423.41
8.2.180.0090.00625.92
8.2.170.0120.00318.96
8.2.160.0040.01122.96
8.2.150.0060.00623.18
8.2.140.0010.01023.46
8.2.130.0070.00424.21
8.2.120.0070.00521.02
8.2.110.0070.00721.66
8.2.100.0060.00719.33
8.2.90.0100.00219.18
8.2.80.0080.00519.82
8.2.70.0030.00819.13
8.2.60.0070.00618.77
8.2.50.0060.00419.50
8.2.40.0080.00319.21
8.2.30.0090.00419.78
8.2.20.0080.00319.99
8.2.10.0020.01019.70
8.2.00.0030.00819.89
8.1.280.0060.01225.92
8.1.270.0080.00423.93
8.1.260.0090.00525.06
8.1.250.0100.00226.00
8.1.240.0080.00522.10
8.1.230.0010.01219.65
8.1.220.0040.00719.16
8.1.210.0050.00719.61
8.1.200.0070.00619.01
8.1.190.0030.01018.82
8.1.180.0070.00619.13
8.1.170.0040.00819.45
8.1.160.0030.00820.41
8.1.150.0100.00119.77
8.1.140.0040.00719.54
8.1.130.0070.00320.31
8.1.120.0060.00618.78
8.1.110.0080.00618.37
8.1.100.0060.00418.48
8.1.90.0020.00718.46
8.1.80.0090.00218.87
8.1.70.0050.00618.42
8.1.60.0080.00517.98
8.1.50.0050.00718.47
8.1.40.0080.00818.47
8.1.30.0090.00618.33
8.1.20.0100.00518.32
8.1.10.0110.00418.19
8.1.00.0110.00417.83
8.0.300.0060.00619.29
8.0.290.0140.00117.35
8.0.280.0130.00418.15
8.0.270.0110.00018.19
8.0.260.0080.00718.07
8.0.250.0110.00417.32
8.0.240.0120.00417.14
8.0.230.0120.00217.24
8.0.220.0060.00717.16
8.0.210.0080.00717.22
8.0.200.0100.00617.25
8.0.190.0130.00417.27
8.0.180.0110.00417.27
8.0.170.0090.00917.17
8.0.160.0060.00617.58
8.0.150.0130.00517.13
8.0.140.0130.00617.15
8.0.130.0130.00416.28
8.0.120.0130.00416.41
8.0.110.0090.00516.77
8.0.100.0080.00916.39
8.0.90.0110.00616.40
8.0.80.0130.00616.48
8.0.70.0110.00616.79
8.0.60.0140.00316.34
8.0.50.0140.00416.38
8.0.30.0150.00816.84
8.0.20.0120.00716.86
8.0.10.0120.00916.49
8.0.00.0060.00717.18
7.4.330.0150.00114.86
7.4.320.0130.00616.82
7.4.300.0130.01016.83
7.4.290.0130.00416.80
7.4.280.0190.00416.85
7.4.270.0150.00416.73
7.4.260.0140.00615.96
7.4.250.0130.00616.10
7.4.240.0120.00516.11
7.4.230.0150.00515.98
7.4.220.0140.00316.19
7.4.210.0110.00816.30
7.4.200.0140.00516.03
7.4.190.0150.00416.07
7.4.180.0140.00816.02
7.4.160.0160.00616.13
7.4.150.0150.00716.01
7.4.140.0130.00816.08
7.4.130.0120.00616.01
7.4.120.0160.00316.06
7.4.110.0170.00415.96
7.4.100.0160.00616.07
7.4.90.0150.00815.94
7.4.80.0150.00715.89
7.4.70.0130.00715.90
7.4.60.0170.00215.91
7.4.50.0150.00415.89
7.4.40.0130.00715.88
7.4.30.0150.00315.89
7.4.20.0140.00415.89
7.4.10.0160.00515.85
7.4.00.0150.00415.89
7.3.330.0140.00416.65
7.3.320.0150.00415.85
7.3.310.0100.00515.94
7.3.300.0130.00316.00
7.3.290.0090.00716.07
7.3.280.0110.00815.92
7.3.270.0150.00815.96
7.3.260.0120.00615.99
7.3.250.0110.00815.91
7.3.240.0120.00715.91
7.3.230.0210.00315.92
7.3.220.0160.00615.78
7.3.210.0170.00515.84
7.3.200.0170.00315.80
7.3.190.0150.00515.86
7.3.180.0150.00415.84
7.3.170.0170.00616.01
7.3.160.0110.00815.80
7.3.150.0130.00615.78
7.3.140.0130.00615.95
7.3.130.0140.00515.84
7.3.120.0120.00715.80
7.3.110.0170.00615.92
7.3.100.0170.00215.81
7.3.90.0150.00416.20
7.3.80.0120.00615.89
7.3.70.0080.00916.02
7.3.60.0160.00416.00
7.3.50.0160.00316.02
7.3.40.0120.00616.10
7.3.30.0160.00416.04
7.3.20.0170.00417.09
7.3.10.0140.00517.09
7.3.00.0130.00617.08

preferences:
45.24 ms | 400 KiB | 5 Q