note 94736 added to function.include
| From: | daevid at daevid dot com | Date: | Sat, 21 Nov 2009 00:54:03 +0000 |
| Subject: | note 94736 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163163@lists.php.net to get a copy of this message | ||
Well now, I am confused because these pages all show them as functions:
Include(), require(), require_once(), include_once()
Yet ALL of the examples show the PEAR way:
http://pear.php.net/manual/en/standards.including.php
"Note: include_once and require_once are statements, not functions. Parentheses should not
surround the subject filename."
include_once "a.php";
To change all require_once('foo.php'); to require_once 'foo.php' execute this:
cd /var/www/
find . -name '*.php' -print | xargs egrep -l \
'require_once\s*(\(.*\));'\ | xargs sed -i.sedorig -e \
's/require_once\s*(\(.*\));/require_once \1;/'
(thanks to Robert Hajime Lanning for that)
Then to remove all the ".php.sedorig" backup files execute this:
find . -name "*.php.sedorig" -type f -exec rm -rf {} \;
----
Server IP: 64.71.164.2
Probable Submitter: 206.169.197.253
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- https://master.php.net/note/edit/94736
Del: integrated -- https://master.php.net/note/delete/94736/integrated
Del: useless -- https://master.php.net/note/delete/94736/useless
Del: bad code -- https://master.php.net/note/delete/94736/bad+code
Del: spam -- https://master.php.net/note/delete/94736/spam
Del: non-english -- https://master.php.net/note/delete/94736/non-english
Del: in docs -- https://master.php.net/note/delete/94736/in+docs
Del: other reasons-- https://master.php.net/note/delete/94736
Reject -- https://master.php.net/note/reject/94736
Search -- https://master.php.net/manage/user-notes.php