3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_last_dot_occurence ($url ) { $fullArray = explode('.', $url); $newArray = ""; switch (count($fullArray)) { case 1: $newArray = $url; break; case 2: $newArray = array("string1" => $fullArray[0], "string2" => $fullArray[1]); break; default: $string1 = ""; for ($i=0; $i < count($fullArray); $i++) { $string1 .= $fullArray[$i].'.'; } $newArray = $string1; break; } return $newArray; } print_r(get_last_dot_occurence("test.com")); print_r(get_last_dot_occurence("1.2.test.com"));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [string1] => test [string2] => com ) 1.2.test.com.

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