3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(isset($_GET['action'])){ if ($_GET['action']=='empty'){ $url="index.php"; if(isset($_SESSION['cart'])){ echo "<h1>Emptying Cart</h1>"; unset($_SESSION['cart']); goto endoption; } goto endoption; } if($_GET['action']=='imgremove'){ $url="index.php?page=cart"; foreach($_SESSION['cart'] as $key=>$value){ foreach($value as $subkey=>$subvalue){ if($subvalue==$_GET['pic']){ unset($_SESSION['cart'][$key]); if(count($_SESSION['cart'])=='0'){ unset($_SESSION['cart']); } goto endoption; } } } } if($_GET['action']=='itemremove'){ $url="index.php?page=cart"; foreach($_SESSION['cart'] as $key=>$value){ foreach($value as $subkey=>$subvalue){ if($subvalue==$_GET['pic']){ foreach($_SESSION['cart'][$key]['details'] as $dkey => $dvalue){ foreach($dvalue as $detail){ if($detail==$_GET['option']){ unset($_SESSION['cart'][$key]['details'][$dkey]); if(count($_SESSION['cart'][$key]['details'])=='0'){ unset($_SESSION['cart'][$key]); } if(count($_SESSION['cart'])=='0'){ unset($_SESSION['cart']); } goto endoption; } } } } } } } } else{ if($_GET['currentpage']=='cart'){ $url="index.php?page=cart"; } else{ $url="index.php?page=".$_GET['currentpage']."&location=".$_GET['location']."&venue=".$_GET['venue']."&session=".$_GET['session']."&pic=".$_GET['pic']; } if (!isset($_SESSION['cart'])) { $_SESSION['cart'][] = array( "pic" => $_POST['pic'], "details" => [] ); $_SESSION['cart'][0]['details'][]= array( "option" => $_POST['option'], "quantity" => $_POST['quantity'] ); goto endoption; } else{ foreach($_SESSION['cart'] as $key=>$value){ foreach($value as $subkey=>$subvalue){ if($subvalue==$_POST['pic']){ foreach($_SESSION['cart'][$key]['details'] as $dkey => $dvalue){ foreach($dvalue as $detail){ if($detail==$_POST['option']){ if($_POST['quantity']=='0'){ unset($_SESSION['cart'][$key]['details'][$dkey]); if(count($_SESSION['cart'][$key]['details'])=='0'){ unset($_SESSION['cart'][$key]); if(count($_SESSION['cart'])=='0'){ unset($_SESSION['cart']); } } goto endoption; } else{ $_SESSION['cart'][$key]['details'][$dkey]['quantity']=$_POST['quantity']; goto endoption; } } } } $_SESSION['cart'][$key]['details'][]=array( "option"=> $_POST['option'], "quantity" => $_POST['quantity'] ); goto endoption; } } } $_SESSION['cart'][] = array( "pic" => $_POST['pic'], "details" => [] ); foreach($_SESSION['cart'] as $key=>$value){ foreach($value as $subkey=>$subvalue){ if($subvalue==$_POST['pic']){ $_SESSION['cart'][$key]['details'][]= array( "option" => $_POST['option'], "quantity" => $_POST['quantity'] ); } } } goto endoption; } } endoption: header("Location: $url"); die();
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key "currentpage" in /in/EIVeE on line 53 Warning: Undefined array key "currentpage" in /in/EIVeE on line 57 Warning: Undefined array key "location" in /in/EIVeE on line 57 Warning: Undefined array key "venue" in /in/EIVeE on line 57 Warning: Undefined array key "session" in /in/EIVeE on line 57 Warning: Undefined array key "pic" in /in/EIVeE on line 57 Warning: Undefined array key "pic" in /in/EIVeE on line 61 Warning: Undefined array key "option" in /in/EIVeE on line 65 Warning: Undefined array key "quantity" in /in/EIVeE on line 66 Warning: Cannot modify header information - headers already sent by (output started at /in/EIVeE:53) in /in/EIVeE on line 121

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:
56.72 ms | 402 KiB | 8 Q