3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Hello World";$spaceCount = substr_count($str, " "); $letterIndx = 0; // count number of spaces and then loop for($i=0; $i<=$spaceCount; $i++) { // get space positions $spaceIndx = strpos($str, " ", $letterIndx); // assign word by specifying start position and length if ($spaceIndx == 0) { $word = substr($str, $letterIndx); } else { $word = substr($str, $letterIndx, $spaceIndx - $letterIndx); } // push word into array $myArray[] = $word; // get first letter after space $letterIndx = $spaceIndx + 1; } // reverse the array $reverse = array_reverse($myArray); // echo it out foreach($reverse as $rev) { echo $rev." "; } ?>
Output for git.master, git.master_jit, rfc.property-hooks
World Hello

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