Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,10 @@
# Using pack/unpack
$point = pack("ii", 1, 2);
$u = unpack("ix/iy", $point);
echo $x;
echo $y;
list($x,$y) = unpack("ii", $point);
echo $x;
echo $y;

View file

@ -0,0 +1,8 @@
# Using array
$point = array('x' => 1, 'y' => 2);
list($x, $y) = $point;
echo $x, ' ', $y, "\n";
# or simply:
echo $point['x'], ' ', $point['y'], "\n";

View file

@ -0,0 +1,7 @@
# Using class
class Point {
function __construct($x, $y) { $this->x = $x; $this->y = $y; }
function __tostring() { return $this->x . ' ' . $this->y . "\n"; }
}
$point = new Point(1, 2);
echo $point; # will call __tostring() in later releases of PHP 5.2; before that, it won't work so good.