note 57732 added to language.references
| From: | dot) | Date: | Wed, 12 Oct 2005 16:10:48 +0000 |
| Subject: | note 57732 added to language.references | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96906@lists.php.net to get a copy of this message | ||
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 :-)
----
Manual Page -- http://www.php.net/manual/en/language.references.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57732
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57732&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57732&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57732&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57732&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57732&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57732&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57732&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57732&report=yes
Search -- http://master.php.net/manage/user-notes.php