I'm trying to take it old school with VT-100 terminal stuff and just wanted to post this little test
CODE
<?php
// 80x24 Terminal - actuall 24x24
// Function
// Compair 2 assoc arrays - give back the changes.
function array_diff_assoc_recursive($array1, $array2)
{
foreach($array1 as $key => $value)
{
if(is_array($value))
{
if(!isset($array2[$key]))
{
$difference[$key] = $value;
}
elseif(!is_array($array2[$key]))
{
$difference[$key] = $value;
}
else
{
$new_diff = array_diff_assoc_recursive($value, $array2[$key]);
if($new_diff != FALSE)
{
$difference[$key] = $new_diff;
}
}
}
elseif(!isset($array2[$key]) || $array2[$key] != $value)
{
$difference[$key] = $value;
}
}
return !isset($difference) ? 0 : $difference;
}
// array mover
function array_mover($arr)
{
$x = array_shift($arr);
array_push($arr, $x);
return($arr);
}
// Set up the first array ($a[x][y] X = Across, Y = Down)
// Since 0,0 is not valid we start the arrays as 1,1
$a = array();
// Clear the screen
echo chr(27),'[2J';
// Set up the first screen.
$xarr = array('A','B','C','D','E','F','G','H','I','J','K','L','M','O','P','Q','R','S','T','U','V','W','X');
for($j=1; $j<=24; ++$j)
{
for($i=1; $i<=80; ++$i)
{
$a[$j][$i] = $xarr[$j-1];
}
}
// Loop thru it since it's the first time displaying
foreach($a as $b1=>$c1)
{
foreach($c1 as $d1=>$e1)
{
echo chr(27),'[',$b1,';',$d1,'f',$e1;
}
}
// Move the array around and draw it..
for($i=1; $i>0;)
{
$a = array_mover($a);
foreach($a as $b1=>$c1)
{
foreach($c1 as $d1=>$e1)
{
echo chr(27),'[',$b1,';',$d1,'f',$e1;
}
}
}
?>
If you know how to do a lot more with VT-100 / ANSI stuff - go ahead and comment.