3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Our recursive function. function recursive($str, $count, $start, &$duplicate){ //Print out the number. if($count > $start) { if(!isset($duplicate[$str[$start]])) { $duplicate[$str[$start]] = 1; return recursive($str, $count, $start+1, $duplicate); } else { //array_push($duplicate, array($start=>$str[$start])); $duplicate[$str[$start]] +=1; return recursive($str, $count, $start+1, $duplicate); } } } //Set our start number to 1. $str = 'buffet'; $count = strlen($str); $start = 0; $duplicate = array(); //Call our recursive function. recursive($str, $count, $start, $duplicate); print_r($duplicate);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [b] => 1 [u] => 1 [f] => 2 [e] => 1 [t] => 1 )

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