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")); 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 $N."<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/> Warning: Array to string conversion in /in/HYj1E on line 15 Array<br/>-----<br/><br/>array(2) { [0]=> array(2) { ["Subject"]=> string(12) "Informatik 1" ["Active"]=> int(2) } [1]=> array(2) { ["Subject"]=> string(12) "Informatik 2" ["Active"]=> string(1) "1" } }

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.81 ms | 401 KiB | 8 Q