note 48612 added to language.functions
| From: | nothingcanfulfill at gmail dot com | Date: | Sat, 01 Jan 2005 20:54:09 +0000 |
| Subject: | note 48612 added to language.functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82547@lists.php.net to get a copy of this message | ||
It seems as if, with the coming of version 5, PHP no longer supports functions split over multiple
blocks of code.
*lines are numbered*
01: <?php
02: function example($str) {
03: ?>
04: <B>The string passed was "<?php echo($str); ?>".</B>
05: <?php
06: }
07:
08: example("Hello, world!");
09: ?>
The above code would provide the following error:
<BR /><B>Parse error</B>: parse error, unexpected '}' in
<B>/your/document/root/some/folders/file.php5</B> on line <B>6</B><BR
/>
Although the above example is very basic, making it pointless to escape from the function to print
it out, imagine a case where you have a large chunk of code where there would be a lot to escape for
only a few variables if you wanted to simply echo it.
----
Manual Page -- http://www.php.net/manual/en/language.functions.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48612
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48612&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48612&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48612&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48612&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48612&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48612&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48612&report=yes
Search -- http://master.php.net/manage/user-notes.php