note 85872 modified in tokens by vrana
| From: | vrana@php.net | Date: | Wed, 22 May 2013 22:40:07 +0000 |
| Subject: | note 85872 modified in tokens by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194884@lists.php.net to get a copy of this message | ||
T_ENCAPSED_AND_WHITESPACE is whitespace which intersects a group of tokens. For example, an
"unexpected T_ENCAPSED_AND_WHITESPACE" error is produced by the following code:
<?php
$main_output_world = 'snakes!';
echo('There are' 10 $main_output_world);
?>
Note the missing concatenation operator between the two strings leads to the whitespace error that
is so named above. The concatenation operator instructs PHP to ignore the whitespace between the two
code tokens (the so named "encapsed" data"), rather than parse it as a token itself.
The correct code would be:
<?php
$main_output_world = 'snakes!';
echo('There are' . 10 . $main_output_world);
?>
Note the addition of the concatenation operator between each token.
--was--
T_ENCAPSED_AND_WHITESPACE is whitespace which intersects a group of tokens. For example, an
"unexpected T_ENCAPSED_AND_WHITESPACE" error is produced by the following code:
<?php
$main_output_world = 'snakes!'
echo('There are' 10 $main_output_world);
?>
Note the missing concatenation operator between the two strings leads to the whitespace error that
is so named above. The concatenation operator instructs PHP to ignore the whitespace between the two
code tokens (the so named "encapsed" data"), rather than parse it as a token itself.
The correct code would be:
<?php
$main_output_world = 'snakes!'
echo('There are' . 10 . $main_output_world);
?>
Note the addition of the concatenation operator between each token.
http://php.net/manual/en/tokens.php