3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Old = array(array("Subject"=>"Informatik 1", "Active"=>"1")); //$New = array(array("Subject"=>"Informatik 1", "Active"=>"0", "Subject"=>"Informatik 2", "Active"=>"1")); $New = array("Informatik 1~0", "Informatik 2~1"); var_dump(MergeOfReqs($Old, $New)); function MergeOfReqs($Old, $New) { echo"----<br/>"; foreach($Old as &$O) { $State = OffReqState($O, $New); $O["Active"] = ($State !== false) ? $State : 2; } foreach($New as $N) { echo print_r($N, true)."<br/>"; if(OffReqState($N, $Old) === false) { $Old[] = $N; } } echo"-----<br/><br/>"; return $Old; } //And another shitty/crappy name function OffReqState($Elem, $Array) { foreach($Array as $Element) { if(strcmp($Element["Subject"], $Elem["Subject"]) == 0) { return $Elem["Active"]; } } return false; }
Output for git.master, git.master_jit, rfc.property-hooks
----<br/> Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/UT8nO:31 Stack trace: #0 /in/UT8nO(11): OffReqState(Array, Array) #1 /in/UT8nO(5): MergeOfReqs(Array, Array) #2 {main} thrown in /in/UT8nO on line 31
Process exited with code 255.

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