|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-08-28 13:46 UTC] + at ni-po dot com
[2010-09-20 18:25 UTC] philip@php.net
-Summary: The Documentation of $GLOBALS has an error in example
# 1
+Summary: [ES] The Documentation of $GLOBALS has an error in
example # 1
-Package: Documentation problem
+Package: Translation problem
[2010-09-22 17:46 UTC] yago@php.net
[2010-09-22 17:49 UTC] yago@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: yago
[2010-09-22 17:49 UTC] yago@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 19 13:00:01 2025 UTC |
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.