Doc #52702 [Com]: The Documentation of $GLOBALS has an error in example # 1

From: Date: Sat, 28 Aug 2010 11:46:41 +0000
Subject: Doc #52702 [Com]: The Documentation of $GLOBALS has an error in example # 1
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-4944@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52702&edit=1 ID: 52702 Comment by: + at ni-po dot com Reported by: kadosh dot ivan at gmail dot com Summary: The Documentation of $GLOBALS has an error in example # 1 Status: Open Type: Documentation Problem Package: Documentation problem Operating System: Windows PHP Version: Irrelevant Block user comment: N New Comment: This ought to be a 'Documentation translation problem', the English version is correct. (The Spanish one though is not.) Previous Comments: ------------------------------------------------------------------------ [2010-08-25 21:33:25] kadosh dot ivan at gmail dot com Description: ------------ <?php function test() { $foo = "variable local"; echo '$foo en el ámbito simple: ' . $GLOBALS["foo"] . "\n"; echo '$foo en el ámbito global: ' . $foo . "\n"; } $foo = "Contenido de ejemplo"; test(); ?> El resultado del ejemplo sería algo similar a: $foo en el ámbito global: Contenido de ejemplo $foo en el ámbito simple: variable local Test script: --------------- The result is not correct. This confused me for some minutes until I read very clearly and I realized about the error. Expected result: ---------------- $foo en el ámbito simple: Contenido de ejemplo $foo en el ámbito global: variable local That would be the result according to the function. But according to the use of $GLOBALS it should be: $foo en el ámbito global: Contenido de ejemplo $foo en el ámbito simple: variable local Actual result: -------------- $foo en el ámbito global: Contenido de ejemplo $foo en el ámbito simple: variable local I realized that the same documentation but in english is correct. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52702&edit=1

« previous php.doc.bugs (#4944) next »