3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; $strLength = strlen($string); for ($i = 0; $i < round($strLength / 2); $i++) { var_dump($strLength-$i); var_dump($strLength / 2-$i); $substr1 .= $string[$strLength-$i]; $substr2 .= $string[$strLength / 2 - $i]; } //var_dump($substr1); //var_dump($substr2); return $string = $substr1.$substr2; } var_dump(reverse('12345'));
based on Ur266

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
int(5) float(2.5) Notice: Uninitialized string offset: 5 in /in/VLXM3 on line 9 Notice: String offset cast occurred in /in/VLXM3 on line 10 int(4) float(1.5) Notice: String offset cast occurred in /in/VLXM3 on line 10 int(3) float(0.5) Notice: String offset cast occurred in /in/VLXM3 on line 10 string(5) "54321"
Output for Array change keys
int(5) float(2.5) Notice: Uninitialized string offset: 5 in /in/VLXM3 on line 9 Notice: String offset cast occurred in /in/VLXM3 on line 10 int(4) float(1.5) Notice: String offset cast occurred in /in/VLXM3 on line 10 int(3) float(0.5) Notice: String offset cast occurred in /in/VLXM3 on line 10 string(5) "54321"
Output for Lexical anon
int(5) float(2.5) Notice: Uninitialized string offset: 5 in /in/VLXM3 on line 9 Notice: String offset cast occurred in /in/VLXM3 on line 10 int(4) float(1.5) Notice: String offset cast occurred in /in/VLXM3 on line 10 int(3) float(0.5) Notice: String offset cast occurred in /in/VLXM3 on line 10 string(5) "54321"

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