| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2011-07-26 05:05 UTC] laruence@php.net
 
-Status: Open
+Status: Duplicate
  [2011-07-26 05:05 UTC] laruence@php.net
  [2011-07-28 02:32 UTC] lucas at threeamdesign dot com
  [2011-07-28 02:34 UTC] lucas at threeamdesign dot com
 
-Summary: @ Error control operator prevents creation of
          variable
+Summary: @ (Error control/suppression) operator prevents
          creation of variable
  [2011-07-28 02:34 UTC] lucas at threeamdesign dot com
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 15:00:01 2025 UTC | 
Description: ------------ When a function is defined with a parameter that is passed by reference, calling the function with a variable that has not been previously set will create that variable (and trigger a warning). After the function is called that variable exists (won't trigger warnings) and holds null or whatever value the function assigned to it. If you try to suppress the warning for the variable that doesn't exist at call time, it will not be created, and trying to access it after the function triggers warnings. It works as expected if you suppress errors on the function call but this is not desirable because it will also hide other errors. Test script: --------------- <?php function foo(&$bar) { $bar = 'woo'; } @foo($x); foo(@$y); var_dump($x, $y); Expected result: ---------------- string(3) "woo" string(3) "woo" Actual result: -------------- Notice: Undefined variable: y in FILE on line LINE string(3) "woo" NULL