note 126484 added to function.define

From: Date: Wed, 06 Oct 2021 20:05:21 +0000
Subject: note 126484 added to function.define
Groups: php.notes 
Request: Send a blank email to php-notes+get-217041@lists.php.net to get a copy of this message
If you happen to name your constant the same as a function name (either a built-in function or a user-defined one), PHP can handle this correctly based on context. For example: <?php function myfunc() { return 'function output'; } define('MYFUNC', 'constant value'); // note that function names are NOT case-sensitive // so calling MYFUNC() is the same as calling myfunc() echo 'MYFUNC(): ' . MYFUNC() . ', MYFUNC: ' . MYFUNC; ?> Output: MYFUNC(): function output, MYFUNC: constant value ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 197.48.18.1) ---- Manual Page -- https://php.net/manual/en/function.define.php Edit -- https://main.php.net/note/edit/126484 Del: integrated -- https://main.php.net/note/delete/126484/integrated Del: useless -- https://main.php.net/note/delete/126484/useless Del: bad code -- https://main.php.net/note/delete/126484/bad+code Del: spam -- https://main.php.net/note/delete/126484/spam Del: non-english -- https://main.php.net/note/delete/126484/non-english Del: in docs -- https://main.php.net/note/delete/126484/in+docs Del: other reasons-- https://main.php.net/note/delete/126484 Reject -- https://main.php.net/note/reject/126484 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#217041) next »