🎁GET 20% OFF Using Code 👉SCHOOL👈 Until End 2024🎁

History

PHP is a popular general-purpose scripting language that is maintained by The PHP Group and is harnessed for web development. It is released under the open source PHP License and its official website is https://www.php.net.

PHP can run on the command line or processed on a web server by an interpreter. As of 2024, PHP releases a minor release that is supported for 2 years and an additional year on only security fixes for a three year life cycle.

Table : Recommended PHP Versions

VersionReleasedSupport EndSecurity End
8.22022-12-082024-12-082025-12-08
8.32023-11-232025-11-232026-11-23

Chapter 2: Data Types

A data type is a grouping of data values. Variables are created to store a data type. In PHP, the assigning of a value will indicate the data type. PHP does not require a format specific in order to display the value.

A data type can be changed by assigning a different value. It is also possible to change the data type by casting. To cast a NULL data type, unset must be used.

Table : Data Types

TypeDescriptionExample
StringStores a sequence of characters$name = “Jake”;
IntegerStores a non-decimal number$age = 24;
FloatStores a decimal point number$amount = 10.25;
BooleanStores either TRUE or FALSE$is_available = TRUE;
ArrayStores multiple values$names = [“Roy”, “Joe”, “Ben”];
ObjectStores instance of a class$person = new Person($name, $age);
NULLStores only NULL value$name = NULL;
UnsetConverts data type to NULL$age = (unset)$name;

Chapter 1: Getting started with PHP

In this chapter, you will learn about the brief history of PHP, its syntax, comments and string formatting. You can use your favourite text editor, IDE or use the built-in IDE. The built-in IDE can also be used to compile your code.

If you use your own text editor or IDE, you will need to also install PHP in order for your code to be interpreted. The built-in IDE has syntax highlighting using different colours for the keywords, comments, control-flow statements, variables and other elements.

To use the built-in IDE simple type the code in the IDE and click the compile button to display the results in the output area. Otherwise follow the requirements for the text editor and PHP.

Requirements:

  1. Optional text editor for programming recommended
  2. Optional PHP installed and configured

Learning PHP

PROGRAMMING eBook LEARNING PHP OjamboShop.com eBook created by
Edward Ojambo