3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "Rocket abc bla blub bla Rocket"; $textArr = explode(" ", $text); $wordCountArr = []; foreach ($textArr as $word) { if (!isset($wordCountArr[$word])) { $wordCountArr[$word] = 1; } else { $wordCountArr[$word]++; } } natcasesort($wordCountArr); print_r($wordCountArr); $textOrderArr = $wordCountArr; $inversedArr = []; foreach ($textOrderArr as $word => $count) { $inversedArr[$count][] = $word; } krsort($inversedArr); foreach ($inversedArr as $count => $words) { foreach ($words as $word) { echo $count . " x " . $word; echo PHP_EOL; } }
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [abc] => 1 [blub] => 1 [Rocket] => 2 [bla] => 2 ) 2 x Rocket 2 x bla 1 x abc 1 x blub

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
32.78 ms | 401 KiB | 8 Q