3v4l.org

run code in 300+ PHP versions simultaneously
<?php //-------------------------------------------------- // Just while the function is re-named if (!function_exists('is_trusted')) { function is_trusted($value) { return is_literal($value); } } //-------------------------------------------------- $limit = trim(' 100 '); // Not trusted $_GET['ids'] = [trim(' 1 '), 2, 3]; var_dump($_GET['ids'][0], is_trusted($_GET['ids'][0])); $ids_untrusted = ( $_GET['ids'] ?? [] ); $ids_trusted = array_map( 'intval', $ids_untrusted ); //-------------------------------------------------- $sql = 'SELECT * FROM foo WHERE id IN (' . implode( ',', $ids_untrusted ) . ')'; // Whoops var_dump($sql, is_trusted($sql)); //-------------------------------------------------- $sql = 'SELECT * FROM foo WHERE id IN (' . implode( ',', $ids_trusted ) . ')'; var_dump($sql, is_trusted($sql)); //-------------------------------------------------- $sql = sprintf( 'SELECT * FROM foo WHERE id IN (%s)', implode( ',', $ids_trusted ) ); var_dump($sql, is_trusted($sql)); //-------------------------------------------------- $sql = sprintf( 'SELECT * FROM foo LIMIT %d', (int)$limit ); var_dump($sql, is_trusted($sql)); ?>

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.0160.00424.24
8.4.110.0040.00618.84
8.4.100.0090.01019.15
8.4.90.0120.00822.42
8.4.80.0090.01118.78
8.4.70.0110.00818.97
8.4.60.0140.00618.87
8.4.50.0050.00419.61
8.4.40.0080.00019.51
8.4.30.0130.00620.49
8.4.20.0060.00318.87
8.4.10.0060.00319.89
8.3.250.0030.00619.15
8.3.240.0030.00517.41
8.3.230.0100.00716.72
8.3.220.0100.00919.00
8.3.210.0080.00618.79
8.3.200.0060.00316.76
8.3.190.0100.00817.25
8.3.180.0110.00818.32
8.3.170.0070.00416.78
8.3.160.0110.00717.39
8.3.150.0030.00517.19
8.3.140.0180.00016.72
8.3.130.0040.00418.61
8.3.120.0030.00618.95
8.3.110.0030.00516.66
8.3.100.0040.00416.87
8.3.90.0060.00926.77
8.3.80.0040.00416.88
8.3.70.0110.00416.63
8.3.60.0110.01118.55
8.3.50.0110.00417.98
8.3.40.0150.00718.75
8.3.30.0080.00819.00
8.3.20.0000.00824.18
8.3.10.0070.00024.66
8.3.00.0040.00426.16
8.2.290.0040.00420.21
8.2.280.0060.00820.30
8.2.270.0140.00317.03
8.2.260.0030.01416.73
8.2.250.0080.00017.11
8.2.240.0130.00716.92
8.2.230.0030.00520.94
8.2.220.0040.00437.54
8.2.210.0070.00026.77
8.2.200.0030.00618.41
8.2.190.0100.01018.66
8.2.180.0140.00725.92
8.2.170.0120.00322.96
8.2.160.0080.00622.96
8.2.150.0090.00025.66
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0000.00819.48
8.2.110.0000.00920.39
8.2.100.0000.01020.52
8.1.330.0090.00722.22
8.1.320.0100.01116.32
8.1.310.0040.00417.00
8.1.300.0060.00316.26
8.1.290.0070.00330.84
8.1.280.0130.00725.92
8.1.270.0040.00423.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0000.00920.90
8.1.230.0100.00019.00

preferences:
46.44 ms | 403 KiB | 5 Q