3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x=['a','b']; echo "Original\n\n"; for ($i = 0; $i < count($x); $i++) { $target_path = $x[$i]; if($i == 0 ){ $test1 = $target_path; } if($i == 1 ){ $test2 = $target_path; } //This part should output only 2 results but it outputs something different. echo $test1." img 1 <br>"; echo $test2." img 2 <br>"; } echo "Rishi\n\n"; $target_path_arr = array(); for ($i = 0; $i < count($x); $i++) { $target_path = $x[$i]; $target_path_arr[] = $target_path; // use this in future echo $target_path." img ".($i+1)."<br>"; }
Output for git.master, git.master_jit, rfc.property-hooks
Original a img 1 <br> Warning: Undefined variable $test2 in /in/nZi0f on line 18 img 2 <br>a img 1 <br>b img 2 <br>Rishi a img 1<br>b img 2<br>

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