3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function censorWord($word, $censor) { if(strpos($word, $censor)) { return preg_replace("/$censor/",'*', $word, 1); } } $start = microtime(true); $word_list = ['php','javascript']; $data = "Javascript and php are awesome!"; $words = explode(" ", $data); // pass each word by reference so it can be modified inside our array foreach($words as &$word) { if(in_array(strtolower($word), $word_list)) { // this just passes the second letter of the word // as the $censor argument $word = censorWord($word, $word[1]); } } echo implode(" ", $words); // returns J*vascript and p*p are awesome! $end = (microtime(true)); echo '<br />'; echo $end - $start;
Output for 7.0.0, 7.1.0
J*vascript and p*p are awesome!<br />9.2983245849609E-5
Output for 7.0.14
J*vascript and p*p are awesome!<br />8.7976455688477E-5
Output for 7.0.7
J*vascript and p*p are awesome!<br />7.4863433837891E-5
Output for 5.6.14, 7.0.6
J*vascript and p*p are awesome!<br />8.1062316894531E-5
Output for 5.4.0, 7.0.5
J*vascript and p*p are awesome!<br />6.2942504882812E-5
Output for 7.0.4
J*vascript and p*p are awesome!<br />8.082389831543E-5
Output for 7.0.3
J*vascript and p*p are awesome!<br />9.5844268798828E-5
Output for 7.0.2
J*vascript and p*p are awesome!<br />8.4877014160156E-5
Output for 7.0.1
J*vascript and p*p are awesome!<br />9.608268737793E-5
Output for hhvm-3.12.0
J*vascript and p*p are awesome!<br />0.00013589859008789
Output for hhvm-3.10.0
J*vascript and p*p are awesome!<br />0.00012111663818359
Output for 5.5.0, 5.5.4, 5.6.28
J*vascript and p*p are awesome!<br />5.4121017456055E-5
Output for 5.6.22
J*vascript and p*p are awesome!<br />6.3896179199219E-5
Output for 5.4.8, 5.4.34, 5.6.21
J*vascript and p*p are awesome!<br />4.5061111450195E-5
Output for 5.4.16, 5.4.38, 5.6.20
J*vascript and p*p are awesome!<br />5.2213668823242E-5
Output for 5.6.19
J*vascript and p*p are awesome!<br />6.5088272094727E-5
Output for 5.4.19, 5.4.31, 5.5.3, 5.5.10, 5.5.19, 5.5.28, 5.6.18
J*vascript and p*p are awesome!<br />5.1975250244141E-5
Output for 5.5.35, 5.6.17
J*vascript and p*p are awesome!<br />4.3869018554688E-5
Output for 5.5.15, 5.6.2, 5.6.15 - 5.6.16
J*vascript and p*p are awesome!<br />4.1007995605469E-5
Output for 5.4.18, 5.4.24, 5.5.11, 5.5.27, 5.5.34, 5.6.3, 5.6.13
J*vascript and p*p are awesome!<br />4.6968460083008E-5
Output for 5.4.27, 5.6.12
J*vascript and p*p are awesome!<br />3.8862228393555E-5
Output for 5.4.35, 5.4.43, 5.5.1, 5.6.10 - 5.6.11
J*vascript and p*p are awesome!<br />4.9829483032227E-5
Output for 5.4.30, 5.4.44, 5.6.9
J*vascript and p*p are awesome!<br />4.4107437133789E-5
Output for 5.4.12, 5.4.22, 5.4.29, 5.5.2, 5.5.5, 5.5.8, 5.5.31, 5.5.36, 5.6.6, 5.6.8
J*vascript and p*p are awesome!<br />5.2928924560547E-5
Output for 5.5.24, 5.6.7
J*vascript and p*p are awesome!<br />3.7908554077148E-5
Output for 5.4.3, 5.4.36, 5.5.6, 5.5.26, 5.5.33, 5.6.5
J*vascript and p*p are awesome!<br />5.1021575927734E-5
Output for 5.4.45, 5.6.4
J*vascript and p*p are awesome!<br />5.3882598876953E-5
Output for 5.4.23, 5.6.1
J*vascript and p*p are awesome!<br />4.887580871582E-5
Output for 5.5.7, 5.5.22, 5.6.0
J*vascript and p*p are awesome!<br />4.0054321289062E-5
Output for 5.5.14, 5.5.32
J*vascript and p*p are awesome!<br />5.6028366088867E-5
Output for 5.4.21, 5.4.42, 5.5.30
J*vascript and p*p are awesome!<br />5.5074691772461E-5
Output for 5.5.29
J*vascript and p*p are awesome!<br />5.5789947509766E-5
Output for 5.5.9, 5.5.25
J*vascript and p*p are awesome!<br />3.6954879760742E-5
Output for 5.5.23
J*vascript and p*p are awesome!<br />6.0081481933594E-5
Output for 5.4.1 - 5.4.2, 5.4.7, 5.4.10, 5.5.21
J*vascript and p*p are awesome!<br />5.0067901611328E-5
Output for 5.5.20
J*vascript and p*p are awesome!<br />5.793571472168E-5
Output for 5.4.25, 5.5.18
J*vascript and p*p are awesome!<br />4.2915344238281E-5
Output for 5.4.17, 5.5.13, 5.5.16
J*vascript and p*p are awesome!<br />4.7922134399414E-5
Output for 5.5.12
J*vascript and p*p are awesome!<br />5.4836273193359E-5
Output for 5.4.41
J*vascript and p*p are awesome!<br />5.6982040405273E-5
Output for 5.4.9, 5.4.14, 5.4.40
J*vascript and p*p are awesome!<br />4.6014785766602E-5
Output for 5.4.39
J*vascript and p*p are awesome!<br />3.2901763916016E-5
Output for 5.4.37
J*vascript and p*p are awesome!<br />4.1961669921875E-5
Output for 5.4.32
J*vascript and p*p are awesome!<br />3.814697265625E-5
Output for 5.4.28
J*vascript and p*p are awesome!<br />6.1988830566406E-5
Output for 5.4.4, 5.4.26
J*vascript and p*p are awesome!<br />4.3153762817383E-5
Output for 5.4.15, 5.4.20
J*vascript and p*p are awesome!<br />4.8160552978516E-5
Output for 5.4.13
J*vascript and p*p are awesome!<br />7.5101852416992E-5
Output for 5.4.11
J*vascript and p*p are awesome!<br />3.504753112793E-5
Output for 5.4.6
J*vascript and p*p are awesome!<br />4.9114227294922E-5
Output for 5.4.5
J*vascript and p*p are awesome!<br />5.8174133300781E-5
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/NqM1e on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/NqM1e on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/NqM1e on line 8
Process exited with code 255.