3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php header('Content-Type: text/plain; charset=utf-8'); $statuses = json_decode(file_get_contents('tweet.text')); if (isset($statuses->errors)) { die($statuses->errors[0]->message); } foreach ($statuses as $status) { echo count(preg_split('//u', htmlspecialchars_decode($status->text), -1, PREG_SPLIT_NO_EMPTY)); print_r(array_count_values(preg_split('//u', htmlspecialchars_decode($status->text), -1, PREG_SPLIT_NO_EMPTY))); print_r(count_chars_utf8($status->text)); } function count_chars_utf8($s) { $p = array( 'number' => '([0-90-9])', 'alphabet' => '([A-Za-zA-Za-z])', 'hiragana' => '([ぁ-ん])', 'katakana' => '([ァ-ヶヲ-ン])', 'kanji' => '(\xe4[\xb8-\xbf][\x80-\xbf]|[\xe5-\xe9][\x80-\xbf][\x80-\xbf]|\xef\xa4\xa9|\xef\xa7\x9c|\xef\xa8[\x8e-\xad])'; return preg_match_all('/' . implode('|', $p) . '/u', $s, $m) === false ? false : array_combine(array_keys($p), array_map( function ($n) { return count(array_filter($n, 'strlen')); }, array_slice($m, 1) + array_fill(0, count($p), 0) )); } ?>
Output for 5.3.0 - 5.4.23
Parse error: syntax error, unexpected ';', expecting ')' in /in/nZrEk on line 23
Process exited with code 255.