3v4l.org

run code in 300+ PHP versions simultaneously
<?php function splort($org, $stop_words) { $words = explode(' ', $org); $abbrevs = array(''); foreach ($words as $word) { if (in_array($word, $stop_words)) { // create a new set of abbreviations with this word's initial included $new_abbrevs = array(); foreach ($abbrevs as $abbrev) { $new_abbrevs[] = $abbrev . $word[0]; } // merge the arrays $abbrevs = array_merge($abbrevs, $new_abbrevs); } else { // add the initial to each abbreviation foreach ($abbrevs as &$abb) { $abb .= $word[0]; } } } return $abbrevs; } $stop_words = array('of', 'and'); print_r(splort('State Bank of and India', $stop_words));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => SBI [1] => SBoI [2] => SBaI [3] => SBoaI )

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:
115.31 ms | 405 KiB | 5 Q