3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Your code here! use Illuminate\Support\Collection; $word_list = ["banana", "peach", "banana", "berry", "grape", "melon", "orange", "apple", "banana","apple"]; $word_list2 = []; foreach ($word_list as $word){ $words_collection = collect(); $words_collection->put('word', $word); $words_collection->put('score', 5); array_push($word_list2, $word); } // continue; // } // array_push($words_rank, array("word"=>$word, "appear_of_num"=>$words_rank[$word]["appear_of_num"] + 1)); // } $words_rank = array_count_values($word_list2); // print_r($words_rank); arsort($words_rank); // print_r($words_rank); print_r(array_slice($words_rank, 0, 5)); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function collect() in /in/D7NKD:12 Stack trace: #0 {main} thrown in /in/D7NKD on line 12
Process exited with code 255.

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:
57.1 ms | 401 KiB | 8 Q