3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getCount($str) { $vowelsCount = 0; $vowels = array('a', 'e', 'i', 'o', 'u'); $letters = str_split($str); print_r($letters); foreach ($letters as $letter) { if (in_array($letter, $vowels)) { $vowelsCount++; } } return $vowelsCount; } echo getCount('heyo'); function getMiddle($text) { $length = strlen($text); if ($length%2 == 0) { echo $length/2; return substr($text, $length/2 - 1, 2); } else { return substr($text, $length/2, 1); } } //echo getMiddle('test');
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => h [1] => e [2] => y [3] => o ) 2

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