php[world] 2018 - Call for Speakers

Sintaxis básica

Tabla de contenidos

add a note add a note

User Contributed Notes 5 notes

Klaas Weerstand
2 months ago
Best php basics you can learn is:
free, and you can upgrade (you don't need to upgrade).
info at learnPHPonline dot in
4 months ago
best PHP tutorials At

3 months ago
remove the comment by "info at learnPHPonline dot in"
Michael Newton (
12 years ago
The XML declaration does not need to be handled specially.

You should output it via an echo statement, in case your code is ever used on a server that is (poorly) configured to use short open tags.

But there's no need to treat the ?> at the end of the string specially.  That's because it's in a string.  The only thing PHP ever looks for in a string is \ or $ (the latter only in double-quoted strings.)

I have never had need for the following, as some have suggested below:


<?php echo '<?xml version="1.0" ?'.'>' ?>

<?php echo "<?xml version=\"1.0\"\x3F>" ?>
dave at [nospam] dot netready dot biz
16 years ago
A little "feature" of PHP I've discovered is that the <?PHP token requires a space after it whereas after the <? and <% tokens a space is optional.

The error message you get if you miss the space is not too helpful so be warned!

These examples only give a warning with error_reporting(E_ALL) )

PHP/*<Some HTML>*/?> fails...
<?/*<Some HTML>*/?> works...
To Top