note 123602 added to function.function-exists

From: Date: Mon, 11 Feb 2019 13:37:48 +0000
Subject: note 123602 added to function.function-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-210229@lists.php.net to get a copy of this message
Be careful of using function_exists in condition implementations. Interpreter do not see function inside condition body, because condition is simple PHP code, function is inside condition. Example: <?php foo('test'); if (!function_exists('foo')) { function foo($msg) { die($msg); } } Result is: PHP Fatal error: Call to undefined function foo() ---- Server IP: 208.43.231.9 Probable Submitter: 185.85.3.142 (proxied: 188.137.49.85) ---- Manual Page -- http://php.net/manual/en/function.function-exists.php Edit -- https://master.php.net/note/edit/123602 Del: integrated -- https://master.php.net/note/delete/123602/integrated Del: useless -- https://master.php.net/note/delete/123602/useless Del: bad code -- https://master.php.net/note/delete/123602/bad+code Del: spam -- https://master.php.net/note/delete/123602/spam Del: non-english -- https://master.php.net/note/delete/123602/non-english Del: in docs -- https://master.php.net/note/delete/123602/in+docs Del: other reasons-- https://master.php.net/note/delete/123602 Reject -- https://master.php.net/note/reject/123602 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#210229) next »