Skip to content

seanpm2001/Learn-PHP

Repository files navigation


/PHP-logo.svg

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

  1. PHP is a semicolon language, but not a curly bracket language

  2. PHP can be embedded into HTML

  3. Variants of PHP structures exist, such as Mustache

  4. PHP uses the .php file extension

  5. PHP is a recursive acronym that stands for PHP Hypertext Preprocessor

  6. PHP uses an elephant as its logo, which is called a elePHPant

  7. PHP can be used as an alternative to JavaScript

  8. PHP is used in many websites, notable ones include Wikipedia, MediaWiki (which is the basis of Wikipedia, and thousands of Wiki sites) and more

  9. PHP 6 became Raku

  10. No other knowledge of the PHP programming language