note 94736 deleted from function.include by peehaa
| From: | peehaa@php.net | Date: | Fri, 09 Dec 2016 22:49:24 +0000 |
| Subject: | note 94736 deleted from function.include by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208392@lists.php.net to get a copy of this message | ||
Note Submitter: daevid at daevid dot com
----
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 {} \;