3v4l.org

run code in 300+ PHP versions simultaneously
<?php $output = "a b\tc"; $preg_match_matches = NULL; $preg_match_all_matches = NULL; $preg_replace_callback_array_count = NULL; var_dump([ 'preg_filter' => preg_filter('/[a-z]+/', 'X', $output, 0), 'preg_grep' => preg_grep('/^[a-z]+/', [$output, 'x'], 0), 'preg_match' => preg_match('/^[a-z]+/', $output, $preg_match_matches, 0, 0), 'preg_match $matches' => $preg_match_matches, 'preg_match_all' => preg_match_all('/^[a-z]+/', $output, $preg_match_all_matches, 0, 0), 'preg_match_all $matches' => $preg_match_all_matches, 'preg_replace' => preg_replace('/[a-z]+/', 'X', $output, 0), 'preg_replace_callback' => preg_replace_callback('/[a-z]+/', function($word) { return $word; }, $output, 0), 'preg_replace_callback_array' => preg_replace_callback_array([ '~[a]+~i' => function ($match) { return 'X'; }, '~[b]+~i' => function ($match) { return 'Y'; } ], $output, 0, $preg_replace_callback_array_count, 0), 'preg_split' => preg_split('/\s/', $output, 0, PREG_SPLIT_NO_EMPTY), ]); ?>

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.5.20.0100.00920.38
8.5.10.0110.00816.71
8.5.00.0040.00518.65
8.4.170.0140.00823.96
8.4.160.0140.00923.27
8.4.150.0110.01121.74
8.4.140.0470.00617.45
8.4.90.0130.00717.84
8.3.300.0130.01019.18
8.3.290.0130.00820.87
8.3.280.0130.00918.56
8.3.270.0100.00916.86
8.3.180.0120.01018.70
8.3.50.0130.00518.61
8.2.300.0100.01118.26
8.1.340.0130.00717.82
8.1.00.0230.00917.35
8.0.00.0260.01117.08

preferences:
31.16 ms | 403 KiB | 5 Q