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, NULL), 'preg_grep' => preg_grep('/^[a-z]+/', [$output, 'x'], NULL), 'preg_match' => preg_match('/^[a-z]+/', $output, $preg_match_matches, NULL, NULL), 'preg_match $matches' => $preg_match_matches, 'preg_match_all' => preg_match_all('/^[a-z]+/', $output, $preg_match_all_matches, NULL, NULL), 'preg_match_all $matches' => $preg_match_all_matches, 'preg_replace' => preg_replace('/[a-z]+/', 'X', $output, NULL), 'preg_replace_callback' => preg_replace_callback('/[a-z]+/', function($word) { return $word; }, $output, NULL), 'preg_replace_callback_array' => preg_replace_callback_array([ '~[a]+~i' => function ($match) { return 'X'; }, '~[b]+~i' => function ($match) { return 'Y'; }, ], $output, NULL, $preg_replace_callback_array_count, NULL), 'preg_split' => preg_split('/\s/', $output, NULL, 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.00.0130.00822.89
8.4.150.0080.00516.99
8.4.140.0090.01117.50
8.4.130.0090.01217.85
8.4.90.0120.00818.13
8.3.280.0080.00416.31
8.3.270.0100.00916.80
8.3.260.0090.01016.91
8.3.180.0110.00717.01
8.3.50.0160.00416.84
7.4.330.0250.01116.52
7.3.00.0150.00816.38

preferences:
28.95 ms | 403 KiB | 5 Q