Learning PHP (programming language)
I know very little about PHP. This document will list all my knowledge of the PHP programming language.
Basic syntax in PHP
PHP requires the use of a <?
operator for the entire program
<?
// Source code goes here
?>
However, it is preferred to use the shebang:
<?php
// Source code goes here
?>
Comments in PHP
Comments in PHP are identical to comments in C, JavaScript, CSS, C#, C++, etc..
<?php
// This is a comment
/* This is
a multi-line
comment */
/* This is
* also a
* multi-line
* comment */
?>
Note that comments can't go before or after the <?
& ?>
operators.
Hello World in PHP
I am not sure whether echo
or print
should be used.
<?php
echo "Hello world"
print "Hello World"
?>
/!\ This example has not been tested yet, and may not work
Break keyword in PHP
<?
break;
?>
To this day, I am still not entirely sure what the break
keyword does, but most languages support it.
/!\ This example has not been tested yet, and may not work
Other knowledge of the PHP programming language
-
PHP is a semicolon language, but not a curly bracket language
-
PHP can be embedded into HTML
-
Variants of PHP structures exist, such as Mustache
-
PHP uses the
.php
file extension -
PHP is a recursive acronym that stands for
PHP Hypertext Preprocessor
-
PHP uses an elephant as its logo, which is called a elePHPant
-
PHP can be used as an alternative to JavaScript
-
PHP is used in many websites, notable ones include Wikipedia, MediaWiki (which is the basis of Wikipedia, and thousands of Wiki sites) and more
-
PHP 6 became Raku
-
No other knowledge of the PHP programming language