3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $input = '1|27|31|33'; $separator = '##|##'; $iterations = 100000; $time = microtime(true); for ($i = 0; $i < $iterations; $i++) { $result = str_replace('|', $separator, $input); } $time1 = microtime(true); echo 'processed with str_replace in ' . round(($time1 - $time) * 1000) . ' millisecs' . PHP_EOL; for ($i = 0; $i < $iterations; $i++) { $result = ''; $it = new CachingIterator(new ArrayIterator(explode('|', $input)), CachingIterator::FULL_CACHE); foreach ($it as $categoryId) { $result .= $categoryId; if ($it->hasNext()) { $result .= $separator; } } } $time2 = microtime(true); echo 'processed with CachingIterator in ' . round(($time2 - $time1) * 1000) . ' millisecs' . PHP_EOL;
Output for 7.1.0
processed with str_replace in 17 millisecs processed with CachingIterator in 292 millisecs
Output for 7.0.14
processed with str_replace in 20 millisecs processed with CachingIterator in 257 millisecs
Output for 7.0.10
processed with str_replace in 17 millisecs processed with CachingIterator in 225 millisecs
Output for 7.0.9
processed with str_replace in 14 millisecs processed with CachingIterator in 209 millisecs
Output for 7.0.8
processed with str_replace in 14 millisecs processed with CachingIterator in 267 millisecs
Output for 7.0.7
processed with str_replace in 12 millisecs processed with CachingIterator in 202 millisecs
Output for 7.0.6
processed with str_replace in 12 millisecs processed with CachingIterator in 211 millisecs
Output for 7.0.5
processed with str_replace in 13 millisecs processed with CachingIterator in 241 millisecs
Output for 7.0.4
processed with str_replace in 15 millisecs processed with CachingIterator in 228 millisecs
Output for 7.0.3
processed with str_replace in 14 millisecs processed with CachingIterator in 217 millisecs
Output for 7.0.2
processed with str_replace in 14 millisecs processed with CachingIterator in 257 millisecs
Output for 7.0.1
processed with str_replace in 13 millisecs processed with CachingIterator in 211 millisecs
Output for 7.0.0
processed with str_replace in 16 millisecs processed with CachingIterator in 230 millisecs
Output for 5.6.28
processed with str_replace in 38 millisecs processed with CachingIterator in 377 millisecs
Output for 5.4.30, 5.6.25
processed with str_replace in 36 millisecs processed with CachingIterator in 350 millisecs
Output for 5.6.24
processed with str_replace in 26 millisecs processed with CachingIterator in 336 millisecs
Output for 5.6.23
processed with str_replace in 28 millisecs processed with CachingIterator in 343 millisecs
Output for 5.6.22
processed with str_replace in 25 millisecs processed with CachingIterator in 342 millisecs
Output for 5.6.21
processed with str_replace in 29 millisecs processed with CachingIterator in 385 millisecs
Output for 5.6.20
processed with str_replace in 37 millisecs processed with CachingIterator in 345 millisecs
Output for 5.6.19
processed with str_replace in 36 millisecs processed with CachingIterator in 499 millisecs
Output for 5.6.18
processed with str_replace in 29 millisecs processed with CachingIterator in 348 millisecs
Output for 5.6.17
processed with str_replace in 44 millisecs processed with CachingIterator in 369 millisecs
Output for 5.6.16
processed with str_replace in 30 millisecs processed with CachingIterator in 350 millisecs
Output for 5.6.15
processed with str_replace in 32 millisecs processed with CachingIterator in 348 millisecs
Output for 5.6.14
processed with str_replace in 28 millisecs processed with CachingIterator in 338 millisecs
Output for 5.6.13
processed with str_replace in 36 millisecs processed with CachingIterator in 346 millisecs
Output for 5.6.12
processed with str_replace in 31 millisecs processed with CachingIterator in 336 millisecs
Output for 5.6.11
processed with str_replace in 31 millisecs processed with CachingIterator in 348 millisecs
Output for 5.6.10
processed with str_replace in 34 millisecs processed with CachingIterator in 337 millisecs
Output for 5.6.9
processed with str_replace in 27 millisecs processed with CachingIterator in 334 millisecs
Output for 5.5.20, 5.6.8
processed with str_replace in 37 millisecs processed with CachingIterator in 344 millisecs
Output for 5.6.7
processed with str_replace in 37 millisecs processed with CachingIterator in 341 millisecs
Output for 5.6.6
processed with str_replace in 27 millisecs processed with CachingIterator in 333 millisecs
Output for 5.6.5
processed with str_replace in 36 millisecs processed with CachingIterator in 338 millisecs
Output for 5.6.4
processed with str_replace in 34 millisecs processed with CachingIterator in 347 millisecs
Output for 5.6.3
processed with str_replace in 27 millisecs processed with CachingIterator in 337 millisecs
Output for 5.6.2
processed with str_replace in 38 millisecs processed with CachingIterator in 355 millisecs
Output for 5.6.1
processed with str_replace in 26 millisecs processed with CachingIterator in 370 millisecs
Output for 5.6.0
processed with str_replace in 31 millisecs processed with CachingIterator in 371 millisecs
Output for 5.4.43, 5.5.38
processed with str_replace in 30 millisecs processed with CachingIterator in 335 millisecs
Output for 5.5.37
processed with str_replace in 36 millisecs processed with CachingIterator in 333 millisecs
Output for 5.5.36
processed with str_replace in 31 millisecs processed with CachingIterator in 339 millisecs
Output for 5.5.5, 5.5.35
processed with str_replace in 33 millisecs processed with CachingIterator in 336 millisecs
Output for 5.5.34
processed with str_replace in 32 millisecs processed with CachingIterator in 359 millisecs
Output for 5.5.33
processed with str_replace in 28 millisecs processed with CachingIterator in 336 millisecs
Output for 5.5.32
processed with str_replace in 30 millisecs processed with CachingIterator in 337 millisecs
Output for 5.5.31
processed with str_replace in 34 millisecs processed with CachingIterator in 344 millisecs
Output for 5.5.30
processed with str_replace in 26 millisecs processed with CachingIterator in 368 millisecs
Output for 5.5.29
processed with str_replace in 32 millisecs processed with CachingIterator in 344 millisecs
Output for 5.5.28
processed with str_replace in 34 millisecs processed with CachingIterator in 345 millisecs
Output for 5.5.27
processed with str_replace in 35 millisecs processed with CachingIterator in 337 millisecs
Output for 5.5.26
processed with str_replace in 25 millisecs processed with CachingIterator in 344 millisecs
Output for 5.5.25
processed with str_replace in 39 millisecs processed with CachingIterator in 357 millisecs
Output for 5.5.24
processed with str_replace in 29 millisecs processed with CachingIterator in 327 millisecs
Output for 5.5.23
processed with str_replace in 33 millisecs processed with CachingIterator in 338 millisecs
Output for 5.5.22
processed with str_replace in 38 millisecs processed with CachingIterator in 369 millisecs
Output for 5.5.21
processed with str_replace in 33 millisecs processed with CachingIterator in 347 millisecs
Output for 5.4.11, 5.5.19
processed with str_replace in 39 millisecs processed with CachingIterator in 352 millisecs
Output for 5.5.18
processed with str_replace in 33 millisecs processed with CachingIterator in 346 millisecs
Output for 5.5.16
processed with str_replace in 37 millisecs processed with CachingIterator in 353 millisecs
Output for 5.5.15
processed with str_replace in 32 millisecs processed with CachingIterator in 362 millisecs
Output for 5.5.14
processed with str_replace in 38 millisecs processed with CachingIterator in 365 millisecs
Output for 5.5.13
processed with str_replace in 38 millisecs processed with CachingIterator in 360 millisecs
Output for 5.5.12
processed with str_replace in 38 millisecs processed with CachingIterator in 336 millisecs
Output for 5.5.11
processed with str_replace in 36 millisecs processed with CachingIterator in 347 millisecs
Output for 5.5.10
processed with str_replace in 31 millisecs processed with CachingIterator in 332 millisecs
Output for 5.5.9
processed with str_replace in 38 millisecs processed with CachingIterator in 347 millisecs
Output for 5.5.8
processed with str_replace in 24 millisecs processed with CachingIterator in 332 millisecs
Output for 5.5.7
processed with str_replace in 25 millisecs processed with CachingIterator in 301 millisecs
Output for 5.5.6
processed with str_replace in 34 millisecs processed with CachingIterator in 338 millisecs
Output for 5.5.4
processed with str_replace in 23 millisecs processed with CachingIterator in 277 millisecs
Output for 5.5.3
processed with str_replace in 28 millisecs processed with CachingIterator in 379 millisecs
Output for 5.5.2
processed with str_replace in 20 millisecs processed with CachingIterator in 277 millisecs
Output for 5.5.1
processed with str_replace in 24 millisecs processed with CachingIterator in 278 millisecs
Output for 5.5.0
processed with str_replace in 37 millisecs processed with CachingIterator in 346 millisecs
Output for 5.4.45
processed with str_replace in 36 millisecs processed with CachingIterator in 334 millisecs
Output for 5.4.44
processed with str_replace in 28 millisecs processed with CachingIterator in 331 millisecs
Output for 5.4.42
processed with str_replace in 33 millisecs processed with CachingIterator in 324 millisecs
Output for 5.4.41
processed with str_replace in 37 millisecs processed with CachingIterator in 349 millisecs
Output for 5.4.40
processed with str_replace in 39 millisecs processed with CachingIterator in 332 millisecs
Output for 5.4.39
processed with str_replace in 32 millisecs processed with CachingIterator in 332 millisecs
Output for 5.4.38
processed with str_replace in 37 millisecs processed with CachingIterator in 338 millisecs
Output for 5.4.37
processed with str_replace in 32 millisecs processed with CachingIterator in 336 millisecs
Output for 5.4.36
processed with str_replace in 29 millisecs processed with CachingIterator in 378 millisecs
Output for 5.4.35
processed with str_replace in 27 millisecs processed with CachingIterator in 325 millisecs
Output for 5.4.34
processed with str_replace in 25 millisecs processed with CachingIterator in 370 millisecs
Output for 5.4.32
processed with str_replace in 36 millisecs processed with CachingIterator in 339 millisecs
Output for 5.4.31
processed with str_replace in 28 millisecs processed with CachingIterator in 324 millisecs
Output for 5.4.29
processed with str_replace in 34 millisecs processed with CachingIterator in 334 millisecs
Output for 5.4.28
processed with str_replace in 37 millisecs processed with CachingIterator in 328 millisecs
Output for 5.4.27
processed with str_replace in 31 millisecs processed with CachingIterator in 329 millisecs
Output for 5.4.26
processed with str_replace in 26 millisecs processed with CachingIterator in 322 millisecs
Output for 5.4.25
processed with str_replace in 25 millisecs processed with CachingIterator in 311 millisecs
Output for 5.4.24
processed with str_replace in 24 millisecs processed with CachingIterator in 304 millisecs
Output for 5.4.23
processed with str_replace in 26 millisecs processed with CachingIterator in 381 millisecs
Output for 5.4.22
processed with str_replace in 30 millisecs processed with CachingIterator in 358 millisecs
Output for 5.4.21
processed with str_replace in 42 millisecs processed with CachingIterator in 341 millisecs
Output for 5.4.20
processed with str_replace in 30 millisecs processed with CachingIterator in 338 millisecs
Output for 5.4.19
processed with str_replace in 23 millisecs processed with CachingIterator in 308 millisecs
Output for 5.4.18
processed with str_replace in 21 millisecs processed with CachingIterator in 273 millisecs
Output for 5.4.17
processed with str_replace in 34 millisecs processed with CachingIterator in 333 millisecs
Output for 5.4.16
processed with str_replace in 31 millisecs processed with CachingIterator in 368 millisecs
Output for 5.4.15
processed with str_replace in 33 millisecs processed with CachingIterator in 327 millisecs
Output for 5.4.14
processed with str_replace in 32 millisecs processed with CachingIterator in 322 millisecs
Output for 5.4.13
processed with str_replace in 34 millisecs processed with CachingIterator in 343 millisecs
Output for 5.4.12
processed with str_replace in 50 millisecs processed with CachingIterator in 358 millisecs
Output for 5.4.10
processed with str_replace in 34 millisecs processed with CachingIterator in 341 millisecs
Output for 5.4.6, 5.4.9
processed with str_replace in 35 millisecs processed with CachingIterator in 336 millisecs
Output for 5.4.8
processed with str_replace in 25 millisecs processed with CachingIterator in 348 millisecs
Output for 5.4.7
processed with str_replace in 38 millisecs processed with CachingIterator in 334 millisecs
Output for 5.4.5
processed with str_replace in 35 millisecs processed with CachingIterator in 335 millisecs
Output for 5.4.4
processed with str_replace in 45 millisecs processed with CachingIterator in 351 millisecs
Output for 5.4.3
processed with str_replace in 27 millisecs processed with CachingIterator in 378 millisecs
Output for 5.4.2
processed with str_replace in 31 millisecs processed with CachingIterator in 322 millisecs
Output for 5.4.1
processed with str_replace in 35 millisecs processed with CachingIterator in 325 millisecs
Output for 5.4.0
processed with str_replace in 28 millisecs processed with CachingIterator in 330 millisecs
Output for 5.3.29
processed with str_replace in 44 millisecs processed with CachingIterator in 392 millisecs
Output for 5.3.28
processed with str_replace in 33 millisecs processed with CachingIterator in 465 millisecs
Output for 5.3.27
processed with str_replace in 44 millisecs processed with CachingIterator in 420 millisecs
Output for 5.3.26
processed with str_replace in 36 millisecs processed with CachingIterator in 389 millisecs
Output for 5.3.25
processed with str_replace in 39 millisecs processed with CachingIterator in 392 millisecs
Output for 5.3.24
processed with str_replace in 37 millisecs processed with CachingIterator in 392 millisecs
Output for 5.3.23
processed with str_replace in 35 millisecs processed with CachingIterator in 450 millisecs
Output for 5.3.22
processed with str_replace in 41 millisecs processed with CachingIterator in 404 millisecs
Output for 5.3.21
processed with str_replace in 33 millisecs processed with CachingIterator in 399 millisecs
Output for 5.3.20
processed with str_replace in 36 millisecs processed with CachingIterator in 401 millisecs
Output for 5.3.19
processed with str_replace in 35 millisecs processed with CachingIterator in 393 millisecs
Output for 5.3.18
processed with str_replace in 38 millisecs processed with CachingIterator in 392 millisecs
Output for 5.3.17
processed with str_replace in 35 millisecs processed with CachingIterator in 437 millisecs
Output for 5.3.16
processed with str_replace in 34 millisecs processed with CachingIterator in 452 millisecs
Output for 5.3.15
processed with str_replace in 46 millisecs processed with CachingIterator in 406 millisecs
Output for 5.3.14
processed with str_replace in 43 millisecs processed with CachingIterator in 408 millisecs
Output for 5.3.13
processed with str_replace in 45 millisecs processed with CachingIterator in 391 millisecs
Output for 5.3.3, 5.3.12
processed with str_replace in 41 millisecs processed with CachingIterator in 393 millisecs
Output for 5.3.11
processed with str_replace in 38 millisecs processed with CachingIterator in 391 millisecs
Output for 5.3.10
processed with str_replace in 43 millisecs processed with CachingIterator in 399 millisecs
Output for 5.3.9
processed with str_replace in 34 millisecs processed with CachingIterator in 465 millisecs
Output for 5.3.8
processed with str_replace in 38 millisecs processed with CachingIterator in 405 millisecs
Output for 5.3.7
processed with str_replace in 46 millisecs processed with CachingIterator in 400 millisecs
Output for 5.3.6
processed with str_replace in 38 millisecs processed with CachingIterator in 410 millisecs
Output for 5.3.5
processed with str_replace in 31 millisecs processed with CachingIterator in 353 millisecs
Output for 5.3.4
processed with str_replace in 40 millisecs processed with CachingIterator in 400 millisecs
Output for 5.3.2
processed with str_replace in 39 millisecs processed with CachingIterator in 379 millisecs
Output for 5.3.1
processed with str_replace in 46 millisecs processed with CachingIterator in 389 millisecs
Output for 5.3.0
processed with str_replace in 29 millisecs processed with CachingIterator in 367 millisecs
Output for 5.2.17
processed with str_replace in 49 millisecs processed with CachingIterator in 387 millisecs
Output for 5.2.16
processed with str_replace in 37 millisecs processed with CachingIterator in 363 millisecs
Output for 5.2.15
processed with str_replace in 40 millisecs processed with CachingIterator in 367 millisecs
Output for 5.2.14
processed with str_replace in 33 millisecs processed with CachingIterator in 401 millisecs
Output for 5.2.13
processed with str_replace in 45 millisecs processed with CachingIterator in 369 millisecs
Output for 5.2.12
processed with str_replace in 50 millisecs processed with CachingIterator in 374 millisecs
Output for 5.2.11
processed with str_replace in 46 millisecs processed with CachingIterator in 364 millisecs
Output for 5.2.10
processed with str_replace in 52 millisecs processed with CachingIterator in 388 millisecs
Output for 5.2.9
processed with str_replace in 40 millisecs processed with CachingIterator in 366 millisecs
Output for 5.2.8
processed with str_replace in 44 millisecs processed with CachingIterator in 376 millisecs
Output for 5.2.7
processed with str_replace in 50 millisecs processed with CachingIterator in 388 millisecs
Output for 5.2.6
processed with str_replace in 49 millisecs processed with CachingIterator in 378 millisecs
Output for 5.2.5
processed with str_replace in 41 millisecs processed with CachingIterator in 370 millisecs
Output for 5.2.4
processed with str_replace in 44 millisecs processed with CachingIterator in 398 millisecs
Output for 5.2.3
processed with str_replace in 48 millisecs processed with CachingIterator in 378 millisecs
Output for 5.2.2
processed with str_replace in 45 millisecs processed with CachingIterator in 378 millisecs
Output for 5.2.0 - 5.2.1
processed with str_replace in 48 millisecs processed with CachingIterator in 369 millisecs
Output for 5.1.6
processed with str_replace in 31 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18
Process exited with code 255.
Output for 5.1.5
processed with str_replace in 46 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18
Process exited with code 255.
Output for 5.1.4
processed with str_replace in 37 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18
Process exited with code 255.
Output for 5.1.3
processed with str_replace in 45 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18
Process exited with code 255.
Output for 5.1.2
processed with str_replace in 50 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18
Process exited with code 255.
Output for 5.1.0 - 5.1.1
processed with str_replace in 47 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18
Process exited with code 255.
Output for 5.0.5
processed with str_replace in 72 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18 Fatal error: Unknown: The inner constructor wasn't initialized with an iterator instance in Unknown on line 0
Process exited with code 255.
Output for 5.0.4
processed with str_replace in 76 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18 Fatal error: Unknown: The inner constructor wasn't initialized with an iterator instance in Unknown on line 0
Process exited with code 255.
Output for 5.0.3
processed with str_replace in 60 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18 Fatal error: Unknown: The inner constructor wasn't initialized with an iterator instance in Unknown on line 0
Process exited with code 255.
Output for 5.0.2
processed with str_replace in 63 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18 Fatal error: Unknown: The inner constructor wasn't initialized with an iterator instance in Unknown on line 0
Process exited with code 255.
Output for 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/vvnit on line 13 processed with str_replace in 72 millisecsPHP_EOL Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18 Fatal error: Unknown: The inner constructor wasn't initialized with an iterator instance in Unknown on line 0
Process exited with code 255.
Output for 5.0.0
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/vvnit on line 13 processed with str_replace in 49 millisecsPHP_EOL Fatal error: Undefined class constant 'FULL_CACHE' in /in/vvnit on line 18
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ')', expecting '(' in /in/vvnit on line 18
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected ')', expecting '(' in /in/vvnit on line 18
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/vvnit on line 18
Process exited with code 255.