PHP 5.6.0beta1 released

Balises PHP

Lorsque PHP traite un fichier, il cherche les balises d'ouverture et de fermeture (<?php et ?>) qui délimitent le code qu'il doit interpréter. De cette manière, cela permet à PHP d'être intégré dans toutes sortes de documents, car tout ce qui se trouve en dehors des balises ouvrantes / fermantes de PHP est ignoré.

PHP autorise aussi des balises ouvrantes dites "courtes" (<? et ?>) que nous vous conseillons vivement de ne pas utiliser car elles ne sont seulement disponibles que lors de l'activation de la directive de configuration short_open_tag du php.ini, ou si PHP a été configuré avec l'option --enable-short-tags .

Si un fichier est purement du code PHP, il est préférable de ne pas placer la balise de fermeture à la fin du fichier. Ceci permet d'éviter d'oublier un espace ou une nouvelle ligne après la balise de fermeture de PHP, ce qui causerait des effets non voulus car PHP commencera à afficher la sortie, ce qui n'est souvent pas ce qui est désiré.

<?php
echo "Bonjour le monde !";

// ... encore du code

echo "Dernière instruction";

// le script se termine ici, sans la balise de fermeture PHP

add a note add a note

User Contributed Notes 4 notes

up
24
preda dot vlad at yahoo dot com
1 year ago
So here are the valid ways to open PHP tags:

<?php ?> // standard tags
<? ?> // short tags, need short_open_tag enabled in php.ini
<% %> // asp tags, need asp_tags enabled in php.ini
<script language="php"> </script> // case insensitive

PSR-1 coding standards suggest to only use <?php ?> or <?= ?> (echo short tags) - and no other variations, and PSR-2 suggests to not close the tags in PHP only files.
up
-2
alisadikin008 at gmail dot com
28 days ago
<?php ?>
 //the most save basic  php tag
as basic programmer,I always use that tag,never use 3 others such as
<? ?>
or
<% %>
or
<script language="php"></script>

but i got onething strange,as contributed,
<?php ?> is colored
<script language="php"></script> is colored
check these two tag
<? ?> is not colored or black only
<% %> is not colored or black only
up
-11
abdallah at meckki dot com
30 days ago
<?php ?> // standard tags is highly recommended.
up
-173
(JB) JB_BlackBerry at live dot com
6 months ago
Hello to all of the proficient programmers.  Only the highest degree of respect intended.  I am not a programmer.  Many years ago I started to take a programming course that included C, Assembler, and COBOL. I had to move and did not continue my education.  Several years later I learned how to write bacic HTML pages.

I would like to learn a programming language or two.  Which languages would you recommend to begin with.  I have seen PHP used in some VBA programs.  I would like to write stand alone programs for my own use to build databases to keep track of various things, such as appointments, reminders to call or meet someone, pay bills on time--even pay the bill electronically if possible.

I would like to write the programs in the Windows, Linx, and Unix envrioments (need to learn Linx and Unix also) enviroments and make them compatable with 2000, XP, Win 7 and Win 8, and the new versions as they come out.

Can any of you suggest a good online place to begin, where I can download compilers, and detailed documentation is as simple to understand format as possible, and hopefully for free.
To Top