3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_send_email($to, $subject, $body, $from_email = '', $from_name = '') { if ($from_email && $from_name) { // Closure instead of globals $f = static function ($phpmailer) use ($from_email, $from_name) { $phpmailer->From = $from_email; $phpmailer->FromName = $from_name; }; // Overwriting default settings remove_action('phpmailer_init', 'my_phpmailer_smtp'); add_action('phpmailer_init', $f); } else { $from_name = 'Info'; $from_email = 'info@domain.com'; } } function my_send_email2($to, $subject, $body, $from_email = '', $from_name = '') { if ($from_email && $from_name) { // Overwriting default settings remove_action('phpmailer_init', 'my_phpmailer_smtp'); // Inline the function add_action( 'phpmailer_init', static function ($phpmailer) use ($from_email, $from_name) { $phpmailer->From = $from_email; $phpmailer->FromName = $from_name; } ); } else { $from_name = 'Info'; $from_email = 'info@domain.com'; } }

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.4.120.0080.00824.17
8.4.110.0060.00318.96
8.4.100.0060.00718.56
8.4.90.0120.00720.59
8.4.80.0070.00318.62
8.4.70.0160.00819.00
8.4.60.0100.00618.84
8.4.50.0120.00818.57
8.4.40.0100.01017.34
8.4.30.0100.01018.92
8.4.20.0130.00619.73
8.4.10.0070.00319.32
8.3.250.0110.00818.49
8.3.240.0060.00416.85
8.3.230.0070.00816.54
8.3.220.0100.00818.93
8.3.210.0100.00516.60
8.3.200.0130.00816.63
8.3.190.0040.00417.24
8.3.180.0080.00718.82
8.3.170.0100.00718.75
8.3.160.0060.01218.04
8.3.150.0060.00616.97
8.3.140.0050.00316.43
8.3.130.0000.01016.49
8.3.120.0160.00018.96
8.3.110.0030.00620.94
8.3.100.0050.00324.06
8.3.90.0040.01126.77
8.3.80.0250.00830.84
8.3.70.0080.00030.84
8.3.50.0040.00430.84
8.2.290.0130.00520.55
8.2.280.0110.00819.80
8.2.270.0090.00916.92
8.2.260.0110.00718.02
8.2.250.0070.01018.35
8.2.240.0040.00716.91
8.2.230.0140.00722.58
8.2.220.0090.00037.54
8.2.210.0060.01326.77
8.2.200.0140.00430.84
8.2.190.0080.00030.84
8.1.330.0080.01121.80
8.1.320.0110.00915.68
8.1.310.0150.00316.48
8.1.300.0090.00015.85
8.1.290.0150.00430.84

preferences:
26.1 ms | 403 KiB | 5 Q