3v4l.org

run code in 300+ PHP versions simultaneously
<?php $p =<<<EOT That interviews should involve simple code is now common wisdom in programming circles. The story is that a high percentage of programmers, even people with impressive resumes, “just can’t code.” Asked to do the simplest things—problems a good coders could solve as fast they could write—some spend ten or twenty minutes before they get an answer, or fail entirely. (See discussion by Jeff Attwood and Joel Spolsky.) I don’t go as far as others here. I think a lot of “slow coders” are probably excellent employees, making up for it in other areas. Some projects don’t need speed. Some people just need to spend more time programming; everyone was a slow programmer some time. But I know from experience that slow coders don’t work at LibraryThing. They don’t fit the LibraryThing development culture. EOT; $pattern = '[\w\d]+'; $words = array(); preg_match_all('/'.$pattern.'/', $p, $words); $result = array(); foreach ($words as $word) { $len = mb_strlen($word); $result[$len]++; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: mb_strlen(): Argument #1 ($string) must be of type string, array given in /in/jWIKX:11 Stack trace: #0 /in/jWIKX(11): mb_strlen(Array) #1 {main} thrown in /in/jWIKX on line 11
Process exited with code 255.
Output for 7.0.0 - 7.0.31, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Warning: mb_strlen() expects parameter 1 to be string, array given in /in/jWIKX on line 11 Notice: Undefined index: in /in/jWIKX on line 12
Output for 7.3.32 - 7.3.33
Warning: mb_strlen() expects parameter 1 to be string, array given in /in/jWIKX on line 11
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Warning: mb_strlen() expects parameter 1 to be string, array given in /in/jWIKX on line 11 Notice: Undefined offset: 0 in /in/jWIKX on line 12
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17
Warning: mb_strlen() expects parameter 1 to be string, array given in /in/jWIKX on line 11 Notice: Undefined offset: 0 in /in/jWIKX on line 12
Output for 5.1.2
Warning: mb_strlen() expects parameter 1 to be string, array given in /in/jWIKX on line 12 Notice: Undefined offset: 0 in /in/jWIKX on line 13
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.1, 4.4.3 - 4.4.9
Notice: mb_strlen(): arg1 is invalid. in /in/jWIKX on line 11 Notice: Undefined offset: 0 in /in/jWIKX on line 12
Output for 4.4.2
Notice: mb_strlen(): arg1 is invalid. in /in/jWIKX on line 12 Notice: Undefined offset: 0 in /in/jWIKX on line 13
Output for 4.3.0 - 4.3.1
Notice: mb_strlen() [http://www.php.net/function.mb-strlen]: arg1 is invalid. in /in/jWIKX on line 11 Notice: Undefined offset: 0 in /in/jWIKX on line 12

preferences:
261.73 ms | 401 KiB | 451 Q