can someone explain this code to me ? $current HERE; function move_left(&$left,&$right,&$current) { array_push($right,$current); $current = array_pop($left); }; function move_right(&$left,&$right,&$current) { array_push($left,$current); $current = array_pop($right); }; function toggle(&$left,&$right,&$current) { $current = 1 - $current; }; ?>
can someone explain this code to me ?
<form>
<?php
$left = array();
$right = array();
$current = 0;
session_start();
extract($_SESSION);
extract($_REQUEST);
if ($button == "Left") move_left();
if ($button == "Right") move_right();
if ($button == "Toggle") toggle();
$_SESSION["left"] = $left;
$_SESSION["right"] = $right;
$_SESSION["current"] = $current;
echo <<<HERE
<input type="submit" name="Left">
<input type="submit" name="Right">
<input type="submit" name="Toggle">
$current
HERE;
function move_left(&$left,&$right,&$current) {
array_push($right,$current);
$current = array_pop($left);
};
function move_right(&$left,&$right,&$current) {
array_push($left,$current);
$current = array_pop($right);
};
function toggle(&$left,&$right,&$current) {
$current = 1 - $current;
};
?>
</form>
Step by step
Solved in 2 steps with 1 images