PHP 8.1.0 RC 3 available for testing

Voting

Please answer this simple SPAM challenge: min(six, nine)?
(Example: nine)

The Note You're Voting On

mramirez (at) star (minus) dev (dot) com
15 years ago
For php programmers that come from pascal,
in object pascal (delphi),
variable references are used with the "absolute" keyword.

PHP example:

<?php

global $myglobal;

$myglobal = 5;

function
test()
{
global
$myglobal;

/*local*/ $mylocal =& $myglobal;

echo
"local: " . $mylocal . "\n";
echo
"gloal: " . $myglobal . "\n";
}

test();

?>

Pascal example:

program dontcare;

var myglobal: integer;

procedure test;
var mylocal ABSOLUTE myglobal;
begin
  write("local: ", mylocal);
  write("global: ", myglobal);
end;

begin
  myglobal := 5;
  test;
end.

By the way, a "local" keyword in php for local variables,
could be welcome :-)

<< Back to user notes page

To Top