3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $input = '1|27|31|33'; $separator = '##|##'; $iterations = 300000; $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 28 millisecs processed with CachingIterator in -571 millisecs
Output for 7.0.14
processed with str_replace in 60 millisecs processed with CachingIterator in 940 millisecs
Output for 7.0.10
processed with str_replace in 40 millisecs processed with CachingIterator in 603 millisecs
Output for 7.0.9
processed with str_replace in 34 millisecs processed with CachingIterator in 693 millisecs
Output for 7.0.8
processed with str_replace in 34 millisecs processed with CachingIterator in 662 millisecs
Output for 7.0.7
processed with str_replace in 39 millisecs processed with CachingIterator in 604 millisecs
Output for 7.0.6
processed with str_replace in 49 millisecs processed with CachingIterator in 664 millisecs
Output for 7.0.5
processed with str_replace in 43 millisecs processed with CachingIterator in 604 millisecs
Output for 7.0.4
processed with str_replace in 40 millisecs processed with CachingIterator in 611 millisecs
Output for 7.0.3
processed with str_replace in 37 millisecs processed with CachingIterator in 676 millisecs
Output for 7.0.2
processed with str_replace in 42 millisecs processed with CachingIterator in 598 millisecs
Output for 7.0.1
processed with str_replace in 43 millisecs processed with CachingIterator in 641 millisecs
Output for 7.0.0
processed with str_replace in 32 millisecs processed with CachingIterator in 620 millisecs
Output for hhvm-3.12.0
processed with str_replace in 98 millisecs
Process exited with code 137.
Output for hhvm-3.10.0
processed with str_replace in 122 millisecs
Process exited with code 137.
Output for 5.6.28
processed with str_replace in 103 millisecs processed with CachingIterator in 1024 millisecs
Output for 5.6.25
processed with str_replace in 75 millisecs processed with CachingIterator in 954 millisecs
Output for 5.6.24
processed with str_replace in 80 millisecs processed with CachingIterator in 930 millisecs
Output for 5.6.23
processed with str_replace in 96 millisecs processed with CachingIterator in 975 millisecs
Output for 5.6.22
processed with str_replace in 99 millisecs processed with CachingIterator in 983 millisecs
Output for 5.6.21
processed with str_replace in 84 millisecs processed with CachingIterator in 955 millisecs
Output for 5.6.20
processed with str_replace in 86 millisecs processed with CachingIterator in 951 millisecs
Output for 5.6.19
processed with str_replace in 94 millisecs processed with CachingIterator in 954 millisecs
Output for 5.6.18
processed with str_replace in 89 millisecs processed with CachingIterator in 946 millisecs
Output for 5.6.17
processed with str_replace in 72 millisecs processed with CachingIterator in 939 millisecs
Output for 5.6.16
processed with str_replace in 69 millisecs processed with CachingIterator in 935 millisecs
Output for 5.6.15
processed with str_replace in 96 millisecs processed with CachingIterator in 963 millisecs
Output for 5.6.14
processed with str_replace in 97 millisecs processed with CachingIterator in 859 millisecs
Output for 5.6.13
processed with str_replace in 79 millisecs processed with CachingIterator in 957 millisecs
Output for 5.6.12
processed with str_replace in 97 millisecs processed with CachingIterator in 968 millisecs
Output for 5.6.11
processed with str_replace in 86 millisecs processed with CachingIterator in 944 millisecs
Output for 5.6.10
processed with str_replace in 94 millisecs processed with CachingIterator in 936 millisecs
Output for 5.6.9
processed with str_replace in 83 millisecs processed with CachingIterator in 939 millisecs
Output for 5.6.8
processed with str_replace in 84 millisecs processed with CachingIterator in 938 millisecs
Output for 5.6.7
processed with str_replace in 95 millisecs processed with CachingIterator in 966 millisecs
Output for 5.6.6
processed with str_replace in 84 millisecs processed with CachingIterator in 929 millisecs
Output for 5.6.5
processed with str_replace in 107 millisecs processed with CachingIterator in 943 millisecs
Output for 5.6.4
processed with str_replace in 65 millisecs processed with CachingIterator in 820 millisecs
Output for 5.6.3
processed with str_replace in 91 millisecs processed with CachingIterator in 959 millisecs
Output for 5.6.2
processed with str_replace in 122 millisecs processed with CachingIterator in 956 millisecs
Output for 5.6.1
processed with str_replace in 99 millisecs processed with CachingIterator in 1137 millisecs
Output for 5.6.0
processed with str_replace in 100 millisecs processed with CachingIterator in 838 millisecs
Output for 5.5.38
processed with str_replace in 101 millisecs processed with CachingIterator in 989 millisecs
Output for 5.4.11, 5.5.37
processed with str_replace in 88 millisecs processed with CachingIterator in 933 millisecs
Output for 5.5.8, 5.5.36
processed with str_replace in 91 millisecs processed with CachingIterator in 947 millisecs
Output for 5.5.35
processed with str_replace in 81 millisecs processed with CachingIterator in 920 millisecs
Output for 5.5.34
processed with str_replace in 91 millisecs processed with CachingIterator in 956 millisecs
Output for 5.5.33
processed with str_replace in 91 millisecs processed with CachingIterator in 941 millisecs
Output for 5.5.32
processed with str_replace in 86 millisecs processed with CachingIterator in 928 millisecs
Output for 5.5.31
processed with str_replace in 78 millisecs processed with CachingIterator in 919 millisecs
Output for 5.5.30
processed with str_replace in 64 millisecs processed with CachingIterator in 821 millisecs
Output for 5.5.29
processed with str_replace in 65 millisecs processed with CachingIterator in 831 millisecs
Output for 5.5.28
processed with str_replace in 87 millisecs processed with CachingIterator in 962 millisecs
Output for 5.5.27
processed with str_replace in 103 millisecs processed with CachingIterator in 1002 millisecs
Output for 5.5.26
processed with str_replace in 103 millisecs processed with CachingIterator in 841 millisecs
Output for 5.5.25
processed with str_replace in 101 millisecs processed with CachingIterator in 870 millisecs
Output for 5.5.24
processed with str_replace in 98 millisecs processed with CachingIterator in 815 millisecs
Output for 5.5.23
processed with str_replace in 93 millisecs processed with CachingIterator in 929 millisecs
Output for 5.5.22
processed with str_replace in 81 millisecs processed with CachingIterator in 906 millisecs
Output for 5.5.21
processed with str_replace in 93 millisecs processed with CachingIterator in 949 millisecs
Output for 5.5.20
processed with str_replace in 89 millisecs processed with CachingIterator in 935 millisecs
Output for 5.5.19
processed with str_replace in 84 millisecs processed with CachingIterator in 1080 millisecs
Output for 5.5.18
processed with str_replace in 105 millisecs processed with CachingIterator in 963 millisecs
Output for 5.5.16
processed with str_replace in 91 millisecs processed with CachingIterator in 936 millisecs
Output for 5.5.15
processed with str_replace in 85 millisecs processed with CachingIterator in 948 millisecs
Output for 5.5.14
processed with str_replace in 107 millisecs processed with CachingIterator in 970 millisecs
Output for 5.5.13
processed with str_replace in 74 millisecs processed with CachingIterator in 902 millisecs
Output for 5.5.12
processed with str_replace in 76 millisecs processed with CachingIterator in 854 millisecs
Output for 5.5.11
processed with str_replace in 75 millisecs processed with CachingIterator in 929 millisecs
Output for 5.4.25, 5.5.10
processed with str_replace in 84 millisecs processed with CachingIterator in 918 millisecs
Output for 5.5.9
processed with str_replace in 69 millisecs processed with CachingIterator in 813 millisecs
Output for 5.5.7
processed with str_replace in 83 millisecs processed with CachingIterator in 913 millisecs
Output for 5.5.6
processed with str_replace in 92 millisecs processed with CachingIterator in 919 millisecs
Output for 5.5.5
processed with str_replace in 89 millisecs processed with CachingIterator in 826 millisecs
Output for 5.5.4
processed with str_replace in 97 millisecs processed with CachingIterator in 930 millisecs
Output for 5.5.3
processed with str_replace in 80 millisecs processed with CachingIterator in 1097 millisecs
Output for 5.5.2
processed with str_replace in 92 millisecs processed with CachingIterator in 956 millisecs
Output for 5.5.1
processed with str_replace in 105 millisecs processed with CachingIterator in 957 millisecs
Output for 5.5.0
processed with str_replace in 84 millisecs processed with CachingIterator in 937 millisecs
Output for 5.4.39, 5.4.45
processed with str_replace in 94 millisecs processed with CachingIterator in 934 millisecs
Output for 5.4.44
processed with str_replace in 98 millisecs processed with CachingIterator in 942 millisecs
Output for 5.4.43
processed with str_replace in 78 millisecs processed with CachingIterator in 928 millisecs
Output for 5.4.42
processed with str_replace in 90 millisecs processed with CachingIterator in 934 millisecs
Output for 5.4.12, 5.4.41
processed with str_replace in 90 millisecs processed with CachingIterator in 918 millisecs
Output for 5.4.40
processed with str_replace in 88 millisecs processed with CachingIterator in 918 millisecs
Output for 5.4.38
processed with str_replace in 75 millisecs processed with CachingIterator in 1046 millisecs
Output for 5.4.37
processed with str_replace in 85 millisecs processed with CachingIterator in 931 millisecs
Output for 5.4.36
processed with str_replace in 90 millisecs processed with CachingIterator in 997 millisecs
Output for 5.4.35
processed with str_replace in 77 millisecs processed with CachingIterator in 1010 millisecs
Output for 5.4.34
processed with str_replace in 96 millisecs processed with CachingIterator in 935 millisecs
Output for 5.4.32
processed with str_replace in 95 millisecs processed with CachingIterator in 940 millisecs
Output for 5.4.14, 5.4.31
processed with str_replace in 87 millisecs processed with CachingIterator in 922 millisecs
Output for 5.4.30
processed with str_replace in 77 millisecs processed with CachingIterator in 901 millisecs
Output for 5.4.29
processed with str_replace in 90 millisecs processed with CachingIterator in 936 millisecs
Output for 5.4.28
processed with str_replace in 76 millisecs processed with CachingIterator in 896 millisecs
Output for 5.4.27
processed with str_replace in 73 millisecs processed with CachingIterator in 858 millisecs
Output for 5.4.26
processed with str_replace in 73 millisecs processed with CachingIterator in 1055 millisecs
Output for 5.4.24
processed with str_replace in 79 millisecs processed with CachingIterator in 798 millisecs
Output for 5.4.23
processed with str_replace in 84 millisecs processed with CachingIterator in 925 millisecs
Output for 5.4.22
processed with str_replace in 82 millisecs processed with CachingIterator in 920 millisecs
Output for 5.4.21
processed with str_replace in 96 millisecs processed with CachingIterator in 933 millisecs
Output for 5.4.20
processed with str_replace in 59 millisecs processed with CachingIterator in 795 millisecs
Output for 5.4.19
processed with str_replace in 88 millisecs processed with CachingIterator in 920 millisecs
Output for 5.4.18
processed with str_replace in 92 millisecs processed with CachingIterator in 943 millisecs
Output for 5.4.17
processed with str_replace in 102 millisecs processed with CachingIterator in 817 millisecs
Output for 5.4.16
processed with str_replace in 98 millisecs processed with CachingIterator in 949 millisecs
Output for 5.4.15
processed with str_replace in 83 millisecs processed with CachingIterator in 914 millisecs
Output for 5.4.13
processed with str_replace in 90 millisecs processed with CachingIterator in 937 millisecs
Output for 5.4.10
processed with str_replace in 82 millisecs processed with CachingIterator in 905 millisecs
Output for 5.4.9
processed with str_replace in 91 millisecs processed with CachingIterator in 902 millisecs
Output for 5.4.8
processed with str_replace in 88 millisecs processed with CachingIterator in 911 millisecs
Output for 5.4.7
processed with str_replace in 101 millisecs processed with CachingIterator in 976 millisecs
Output for 5.4.6
processed with str_replace in 98 millisecs processed with CachingIterator in 926 millisecs
Output for 5.4.5
processed with str_replace in 78 millisecs processed with CachingIterator in 918 millisecs
Output for 5.4.4
processed with str_replace in 57 millisecs processed with CachingIterator in 783 millisecs
Output for 5.4.3
processed with str_replace in 74 millisecs processed with CachingIterator in 1062 millisecs
Output for 5.4.2
processed with str_replace in 103 millisecs processed with CachingIterator in 940 millisecs
Output for 5.4.1
processed with str_replace in 99 millisecs processed with CachingIterator in 943 millisecs
Output for 5.4.0
processed with str_replace in 102 millisecs processed with CachingIterator in 964 millisecs
Output for 5.3.29
processed with str_replace in 119 millisecs processed with CachingIterator in 1091 millisecs
Output for 5.3.28
processed with str_replace in 105 millisecs processed with CachingIterator in 1073 millisecs
Output for 5.3.27
processed with str_replace in 122 millisecs processed with CachingIterator in 1094 millisecs
Output for 5.3.26
processed with str_replace in 112 millisecs processed with CachingIterator in 1088 millisecs
Output for 5.3.25
processed with str_replace in 98 millisecs processed with CachingIterator in 1086 millisecs
Output for 5.3.24
processed with str_replace in 105 millisecs processed with CachingIterator in 1072 millisecs
Output for 5.3.23
processed with str_replace in 110 millisecs processed with CachingIterator in 1071 millisecs
Output for 5.3.22
processed with str_replace in 95 millisecs processed with CachingIterator in 1280 millisecs
Output for 5.3.21
processed with str_replace in 111 millisecs processed with CachingIterator in 1080 millisecs
Output for 5.3.20
processed with str_replace in 123 millisecs processed with CachingIterator in 960 millisecs
Output for 5.3.19
processed with str_replace in 91 millisecs processed with CachingIterator in 1286 millisecs
Output for 5.3.18
processed with str_replace in 123 millisecs processed with CachingIterator in 1108 millisecs
Output for 5.3.17
processed with str_replace in 104 millisecs processed with CachingIterator in 1080 millisecs
Output for 5.3.16
processed with str_replace in 89 millisecs processed with CachingIterator in 1041 millisecs
Output for 5.3.15
processed with str_replace in 88 millisecs processed with CachingIterator in 1041 millisecs
Output for 5.3.14
processed with str_replace in 88 millisecs processed with CachingIterator in 1024 millisecs
Output for 5.3.13
processed with str_replace in 124 millisecs processed with CachingIterator in 1096 millisecs
Output for 5.3.12
processed with str_replace in 106 millisecs processed with CachingIterator in 1070 millisecs
Output for 5.3.11
processed with str_replace in 102 millisecs processed with CachingIterator in 1057 millisecs
Output for 5.3.10
processed with str_replace in 121 millisecs processed with CachingIterator in 1095 millisecs
Output for 5.3.9
processed with str_replace in 100 millisecs processed with CachingIterator in 1053 millisecs
Output for 5.3.8
processed with str_replace in 111 millisecs processed with CachingIterator in 1065 millisecs
Output for 5.3.7
processed with str_replace in 122 millisecs processed with CachingIterator in 1125 millisecs
Output for 5.3.6
processed with str_replace in 123 millisecs processed with CachingIterator in 1100 millisecs
Output for 5.3.5
processed with str_replace in 109 millisecs processed with CachingIterator in 950 millisecs
Output for 5.3.4
processed with str_replace in 125 millisecs processed with CachingIterator in 1116 millisecs
Output for 5.3.3
processed with str_replace in 97 millisecs processed with CachingIterator in 999 millisecs
Output for 5.3.2
processed with str_replace in 120 millisecs processed with CachingIterator in 1065 millisecs
Output for 5.3.1
processed with str_replace in 104 millisecs processed with CachingIterator in 1049 millisecs
Output for 5.3.0
processed with str_replace in 105 millisecs processed with CachingIterator in 1046 millisecs
Output for 5.2.17
processed with str_replace in 129 millisecs processed with CachingIterator in 1034 millisecs
Output for 5.2.16
processed with str_replace in 134 millisecs processed with CachingIterator in 905 millisecs
Output for 5.2.15
processed with str_replace in 109 millisecs processed with CachingIterator in 1022 millisecs
Output for 5.2.14
processed with str_replace in 115 millisecs processed with CachingIterator in 1014 millisecs
Output for 5.2.13
processed with str_replace in 94 millisecs processed with CachingIterator in 1187 millisecs
Output for 5.2.12
processed with str_replace in 112 millisecs processed with CachingIterator in 1017 millisecs
Output for 5.2.11
processed with str_replace in 118 millisecs processed with CachingIterator in 1006 millisecs
Output for 5.2.10
processed with str_replace in 122 millisecs processed with CachingIterator in 1063 millisecs
Output for 5.2.9
processed with str_replace in 124 millisecs processed with CachingIterator in 1020 millisecs
Output for 5.2.8
processed with str_replace in 111 millisecs processed with CachingIterator in 892 millisecs
Output for 5.2.7
processed with str_replace in 119 millisecs processed with CachingIterator in 1068 millisecs
Output for 5.2.6
processed with str_replace in 104 millisecs processed with CachingIterator in 1004 millisecs
Output for 5.2.5
processed with str_replace in 118 millisecs processed with CachingIterator in 897 millisecs
Output for 5.2.4
processed with str_replace in 128 millisecs processed with CachingIterator in 1038 millisecs
Output for 5.2.3
processed with str_replace in 102 millisecs processed with CachingIterator in 1025 millisecs
Output for 5.2.2
processed with str_replace in 106 millisecs processed with CachingIterator in 1013 millisecs
Output for 5.2.1
processed with str_replace in 111 millisecs processed with CachingIterator in 1010 millisecs
Output for 5.2.0
processed with str_replace in 97 millisecs processed with CachingIterator in 901 millisecs
Output for 5.1.6
processed with str_replace in 108 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B on line 18
Process exited with code 255.
Output for 5.1.5
processed with str_replace in 114 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B on line 18
Process exited with code 255.
Output for 5.1.4
processed with str_replace in 116 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B on line 18
Process exited with code 255.
Output for 5.1.3
processed with str_replace in 118 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B on line 18
Process exited with code 255.
Output for 5.1.2
processed with str_replace in 97 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B on line 18
Process exited with code 255.
Output for 5.1.1
processed with str_replace in 113 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B on line 18
Process exited with code 255.
Output for 5.1.0
processed with str_replace in 117 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B on line 18
Process exited with code 255.
Output for 5.0.5
processed with str_replace in 145 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B 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 160 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B 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 173 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B 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 142 millisecs Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B 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/gsE1B on line 13 processed with str_replace in 178 millisecsPHP_EOL Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B 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/gsE1B on line 13 processed with str_replace in 144 millisecsPHP_EOL Fatal error: Undefined class constant 'FULL_CACHE' in /in/gsE1B on line 18
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ')', expecting '(' in /in/gsE1B 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/gsE1B on line 18
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/gsE1B on line 18
Process exited with code 255.