Me and php
PHP documentation for beginners, write your first php code, build your first application with php.
What is php ? 🤔
- PHP is a server side scripting language which stands for Hypertext Pre-processor and is used to develop static or dynamic websites or Web applications.
👨💻 👩💻
What is scripting language ? 🕵️♂️
- A scripting language is a language that interprets scripts at runtime
👨🏫
Why use PHP ? 😏
- PHP is open source and free, large community document and most web hosting servers support PHP by default
🤗
Installation
PHP need web server, database and php parser,don't worry there are some excellent all-in-one windows, linux, and MacOs distributions that contain Apache, PHP, MySQL and other applications in a single installation file, e.g. XAMPP pick your own here and follow the installation instruction
XAMPP SITE
Syntax
PHP general syntax is :
<?php ... ?>
And short-open tags look like :
<? ... ?>
Variables
PHP variable are denotes fixes with a
$ sign , php code always end with
; ex :
<?php
$name= 'Susane';
?>
DataTypes
PHP has a total of eight data types:
DataTypes | Meanings | Ex |
---|---|---|
Integers | Numbers without a decimal point | $number = 123; |
Float | are floating-point numbers | $float = 12.3; |
Boolean | Have two possible values true or false |
$bool = false; |
NULL | Special type has one value NULL |
$null = null; |
String | sequences of characters | $strValues = 'Potato'; |
Array | indexed collections values | $arr = array(0,1,2); |
Objects | instances of classes | $herbie = new Person(); |
Resources | It is the storing of a reference to functions and resources external to PHP | database call |