Skip to main content
pelatihan
.org
Learn. Practice. Grow.
Category
EN
Sign in
Sign up
Menu
Home
/
Catalog
/
PHP
/
Curriculum
Curriculum
PHP Curriculum
Learn PHP online with 85 structured lessons, code examples, and 425 quiz questions.
85 lessons
9 chapters
425 questions
Summaries and key points are free to preview. Full lessons, code examples, and quizzes require a subscription.
01
PHP Tutorial
24 lessons
01
PHP HOME
This page is the gateway to all PHP materials, from basic syntax to advanced topics like OOP. PHP is a server-side scripting language used to create dynamic web pages. From here…
PHP Curriculum: 9 Chapters, 85 Lessons — pelatihan.org
02
PHP Intro
This lesson explains the meaning of PHP, the short history of its name, and its features as a free, open source server-side scripting language. You'll also understand how PHP…
03
PHP Install
This lesson is about how to install PHP on your own computer so you can learn offline. The easiest option is an all-in-one web server package like XAMPP, WAMP, or MAMP that…
04
PHP Syntax
This lesson sets the basic rules for writing PHP code, from block markers to semicolon marks as the end of commands. You also learn that PHP is case-sensitive for built-in…
05
PHP Comments
Comment is a note in code that is read by humans but ignored by PHP interpreters. This lesson explains how to write one-line comments with // or #, as well as multi-line comments…
06
PHP Variables
A variable is a named container for storing data in PHP, always written with a dollar sign on the front. This lesson discusses naming rules, the nature of dynamic data types, and…
07
PHP Echo / Print
This lesson discusses the two main ways of presenting data in PHP, namely echo and print. Echo is more often used because it can accept multiple arguments at once, whereas print…
08
PHP Data Types
PHP provides a variety of built-in data types such as strings, integers, floats, booleans, arrays, and null. This lesson explains the characteristics of each type and how to…
09
PHP Strings
Strings are a type of data for storing text, such as names and sentences. This lesson discusses how to create strings, combine them, and the built-in PHP function to check…
10
PHP Numbers
PHP recognizes two groups of prime numbers, namely integers for integers and floats for decimal numbers. This lesson discusses how PHP differentiates between the two, from basic…
11
PHP Casting
Casting is a method of manually changing the data type of a value by writing the target type in front of the value, for example (int) or (string). This lesson describes the…
12
PHP Math
PHP has many built-in mathematical functions that facilitate calculations, ranging from absolute values, square roots, rank, to random numbers. This lesson introduces these…
13
PHP Constants
A constant is a fixed value that does not change during the program's run, created by the function define() or the keyword const within the class. Unlike a variable, a constant…
14
PHP Magic Constants
Magic constants are special constants whose values are automatically determined by PHP according to where they are written. The characteristic is that it is always preceded and…
15
PHP Operators
An operator is a symbol that commands PHP to perform certain operations, such as arithmetic, string merging, comparison, and logic. This lesson groups these operators together…
16
PHP If...Else...Elseif
The if... structure allows the program to select actions based on certain conditions. This lesson explains how to write if, else, and elseif, including alternative writing with…
17
PHP Switch
The switch structure is used to select one of many options based on the same value, making it more concise than many if-elseifs. Each option is written with a case, and a break…
18
PHP Match
Match is a new feature in PHP 8 that is similar to the switch, but more stringent and expressive. Match makes a strict comparison (===), requires no break, and the result can be…
19
PHP Loops
A loop causes a program to run the same block of code over and over again without rewriting it. PHP provides for, while, do-while, and foreach with their respective…
20
PHP Functions
A function is a block of code named that can be called over and over again, thus avoiding repeating the same code. This lesson discusses how to declare a function, send…
21
PHP Arrays
An array is a data type that can store many values in one variable, so data can be easily grouped and processed. This lesson discusses how to create an array, access elements…
22
PHP Superglobals
Superglobals are PHP-inbuilt variables that are always available across scripts without the need for global declaration. For example $_GET, $_POST, $_REQUEST, $_COOKIE,…
23
PHP RegEx
Regular expression (regex) is a specific pattern for matching text, such as checking email formats, phone numbers, or postal codes. This lesson introduces meta characters like ^,…
24
PHP RegEx Functions
PHP provides a set of preg_* functions to use regex, such as preg_match, preg_match_all, preg_replace, and preg_split. This lesson explains the differences between these…
02
PHP Forms
5 lessons
01
PHP Form Handling
Forms are the primary way the web receives data from users, such as logins, comments, or registrations. This lesson explains how PHP reads form data through the superglobal $_GET…
02
PHP Form Validation
Form validation ensures that the data submitted by the user is complete and compliant with the rules before it is processed. Validation should be done on the server side with PHP…
03
PHP Form Required
Some fields do need to be filled in, such as name and e-mail. This lesson discusses the required attributes in HTML5 and their application in PHP servers. Although the browser…
04
PHP Form URL/E-mail
The e-mail format and URL must be verified for the incoming data to be reliable. PHP provides built-in filters such as FILTER_VALIDATE_EMAIL and FILTER_VALIDATE_URL that are used…
05
PHP Form Complete
This lesson outlines the entire form process in its entirety, from displaying the form, validating, processing, to displaying the successful message. You learn to maintain user…
03
PHP Advanced
13 lessons
01
PHP Date and Time
PHP has an inbuilt function for handling dates and times, with the main function being date(). This lesson describes the letter formats such as Y, m, d, H, i, and s that…
02
PHP Include
The include feature allows you to insert the contents of other files into the script, so the same part does not need to be rewritten. It's useful for header, footer, or shared…
03
PHP File Handling
PHP can work with files on servers, from checking for existence, reading, writing, to deleting them. This lesson introduces the basic file handling functions and opening modes…
04
PHP File Open/Read
Once the file is opened, PHP provides several ways to read it, from reading the entire content at once to per line. This lesson discusses fopen(), fread(), fgets(), file(), and…
05
PHP File Create/Write
PHP can create new files and write data into them, for example to store log or export results. This lesson discusses fwrite(), file_put_contents(), and the differences between w…
06
PHP File Upload
PHP supports uploading files from a form to a server, such as photos or document attachments. You need to set the multipart enctype/form-data attribute to the form, and then read…
07
PHP Cookies
A cookie is a small piece of data stored in a visitor's browser and sent back to the server at each request. This lesson discusses how to make cookies with setcookie(), read them…
08
PHP Sessions
The session stores user data on the server, making it more secure than cookies for sensitive information. This lesson discusses session_start(), superglobal $_SESSION, and how to…
09
PHP Filters
PHP Filters provide standard ways to validate and clear input data, such as checking integers, e-mails, or URLs. Its main function is filter_var() combined with the constants…
10
PHP Filters Advanced
An advanced version of PHP Filter allows direct data checking of requests such as $_GET, $_POST, or $_COOKIE via filter_input(). In addition, a variety of custom sanitary filters…
11
PHP Callback Functions
A callback is a function that is continued as an argument to another function to be called in. This pattern is widely used in array functions such as array_walk(), usort(), and…
12
PHP JSON
JSON is a lightweight, easy-to-understand text-based data exchange format for humans and machines. PHP provides json_encode() to convert array/object to JSON string and…
13
PHP Exceptions
Exception is a PHP mechanism for handling errors when a program is running in a structured manner. You can block the risky code with try, catch the problem with catch, and…
04
PHP OOP
14 lessons
01
PHP What is OOP
This lesson introduces Object-Oriented Programming (OOP), a paradigm that groups data and behavior into objects. The basic concepts include class as an object print, property as…
02
PHP Classes/Objects
A class is a blueprint that defines a property as data and a method as behavior, whereas an object is a real instance made of that class. In PHP you create an object with the new…
03
PHP Constructor
Constructor is a special method called __construct that is run automatically by PHP once an object is created with new. Its primary function is to fill the initial value of the…
04
PHP Destructor
Destructor is a __destruct method that PHP runs when an object is no longer in use or when the script is finished. Destructor is useful for clearing resources such as closing…
05
PHP Access Modifiers
Access modifier determines the extent to which the property and method can be accessed, namely public, protected, and private. Public can be accessed from anywhere, protected…
06
PHP Inheritance
Inheritance makes one class (child) inherit property and method from another class (parent) with keywords extends. Child can use the parent code as it is or replace it with the…
07
PHP Constants
A constant is a fixed value that is defined once and cannot be changed during the run of a script. PHP provides the define() function to create global constants and the const…
08
PHP Abstract Classes
A class abstract is a class that cannot be directly instantiated and usually contains an abstract method without a body. The class abstract serves as a framework that must be…
09
PHP Interfaces
The interface defines a contract as a list of unorganised methods that are mandatory for the class to implement. A class can implement several at once, so it's useful to build…
10
PHP Traits
Trait is a set of methods that can be inserted into several different classes with the use keyword, thus overcoming the limitations of single inheritance in PHP. Traits like a…
11
PHP Static Methods
A static method is a method that is called directly by the class name using the symbol:: without the need to create an object. This method doesn't have $this because it's not…
12
PHP Static Properties
Static property is a property that is only stored once for the entire class, not for each object. All instances use and change the same property, so it's suitable for counting…
13
PHP Namespaces
Namespace groups class names, functions, and constants into named containers so that no clashes between libraries occur. The namespace declaration is placed at the top of the…
14
PHP Iterables
An iterable type is a type of hint that receives an array or object that follows a Traversable interface, such as the output of an iterator or generator. With iterable, a single…
05
MySQL Database
14 lessons
01
MySQL Database
MySQL is a relational database management system (RDBMS) often paired with PHP to store data permanently. The data is compiled into a table of rows and columns, and then…
02
MySQL Connect
Before manipulating data, PHP must open a connection to a MySQL server using the mysqli_connect() function or PDO object. This function accepts host, username, password, and…
03
MySQL Create DB
The new database was created using the SQL CREATE DATABASE command that runs through mysqli_query(). The addition of IF NOT EXISTS makes the command safe to run repeatedly…
04
MySQL Create Table
A table is created using the CREATE DATABASE command with a list of columns and their data types. Each table generally has an id column as the PRIMARY KEY with AUTO_INCREMENT as…
05
MySQL Insert Data
The new data is entered using the INSERT INTO command that lists the columns and their values. The value of the text is written in a single quotation mark, while the numbers may…
06
MySQL Get Last ID
After you add a row, you often need to know the automatic id that you just created to use as a relation to another table. PHP provides the mysqli_insert_id() function that…
07
MySQL Insert Multiple
Many lines can be inserted into a single command by writing multiple tuple values separated by kam after VALUES. This is a much safer way because only one query travels to a…
08
MySQL Prepared
Prepared statement separates query template from data so that the input value is never considered an SQL command. The trick is to set up the query with a placeholder, bind the…
09
MySQL Select Data
The SELECT command is used to read data from one or more columns in a table, resulting in a set of rows stored in the result set. You read the result of the set line by line…
10
MySQL Where
The WHERE clause filters the line so that only data that qualifies for a certain qualification will be included. Comparative operators such as =, >, <, LIKE, and BETWEEN are used…
11
MySQL Order By
The ORDER BY clause sorts the query results based on one or more columns, either up (ASC) or down (DESC). By default MySQL sorts upwards when the direction is not written. The…
12
MySQL Delete Data
The DELETE FROM command deletes the data line from the table, and the WHERE clause specifies which line is deleted. Without WHERE, the entire contents of the table will be lost,…
13
MySQL Update Data
The UPDATE command modifies the value of the column on an existing row, with the SET clause determining the change and the WHERE clause determining the target. Without WHERE, the…
14
MySQL Limit Data
The LIMIT clause limits the number of rows returned by a query, for example to display top data or build a page (pagination). MySQL also supports OFFSET to pass through a number…
06
PHP XML
5 lessons
01
PHP XML Parsers
PHP provides three main ways to process XML: SimpleXML for simple reading, event-based XML Parser (Expat), and DOM for structural manipulation. Parser selection depends on the…
02
PHP SimpleXML Parser
SimpleXML loads the XML document into SimpleXMLElement objects so that each element can be read as a property. The simplexml_load_file() function is used for files, while…
03
PHP SimpleXML - Get
Once the document is read, you need to extract information like child lists, attributes, number of elements, or specific sections using XPath. SimpleXML provides children(),…
04
PHP XML Expat Parser
Expat-based XML Parser works event-driven: you register the handler function, and the parser calls it whenever it encounters an open tag, a closed tag, or text data. Parser is…
05
PHP DOM Parser
DOM treats XML as a node tree through the DOMDocument class, so we can read and edit the structure at the same time. You load the document with load() or loadXML(), then search…
07
PHP - AJAX
6 lessons
01
AJAX Intro
AJAX (Asynchronous JavaScript and XML) allows web pages to send and receive data to a server in the background without reloading the entire page. Thus, certain sections such as…
02
AJAX PHP
In AJAX, JavaScript sends a request to a PHP file that acts as an endpoint. PHP processes requests, runs logic, and then responds with concise data like JSON or HTML snippets.…
03
AJAX Database
AJAX takes data from a database when JavaScript requests a PHP file that runs a MySQL query. This pattern is used for instant searches, loading more data, or updating statistics…
04
AJAX XML
AJAX responses don't have to be JSON, XML documents can also be sent by PHP and parsed on the client side. PHP sets the header of XML content and then displays the XML string,…
05
AJAX Live Search
Live search displays search results suggestions as soon as the user types, without the need to press a button or reload the page. Each entry triggers an AJAX request to the PHP…
06
AJAX Poll
Polling means asking for data to the server periodically using the setInterval so that the display always displays the latest information, such as voting results or…
08
PHP Examples
4 lessons
01
PHP Examples
The example page collects pieces of real-world projects that combine forms, database connections, and AJAX as practice materials. The best way to learn is to run it on a local…
02
PHP Server
PHP runs on the server side: the script is executed on the computer where PHP is installed, and the result is sent to the browser as HTML. During that process PHP provides…
03
PHP Syllabus
PHP syllabus is a list of subjects that are arranged in order from basic to advanced as your learning map. Start with syntax, variables, and conditions, go on to forms and…
04
PHP Study Plan
A study plan is a learning plan that breaks down large material into realistic, measurable daily or weekly targets. A good plan provides time for practice writing code, working…