VOOZH about

URL: https://www.w3schools.com/php/php_examples.asp

⇱ PHP Examples


   ❮     
     ❯   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS

PHP Tutorial

PHP HOME PHP Intro PHP Install PHP Syntax PHP Comments PHP Variables PHP Echo / Print PHP Data Types PHP Strings PHP Numbers PHP Casting PHP Math PHP Constants PHP Magic Constants PHP Operators PHP If...Else...Elseif PHP Switch PHP Match PHP Loops PHP Functions PHP Arrays PHP Superglobals PHP RegEx PHP RegEx Functions

PHP Forms

PHP Form Handling PHP Form Validation PHP Form Required PHP Form URL/E-mail PHP Form Complete

PHP Advanced

PHP Date and Time PHP Include PHP File Handling PHP File Open/Read PHP File Create/Write PHP File Upload PHP Cookies PHP Sessions PHP Filters PHP Filters Advanced PHP Callback Functions PHP JSON PHP Exceptions

PHP OOP

PHP What is OOP PHP Classes/Objects PHP Constructor PHP Destructor PHP Access Modifiers PHP Inheritance PHP Constants PHP Abstract Classes PHP Interfaces PHP Traits PHP Static Methods PHP Static Properties PHP Namespaces PHP Iterables

MySQL Database

MySQL Database MySQL Connect MySQL Create DB MySQL Create Table MySQL Insert Data MySQL Get Last ID MySQL Insert Multiple MySQL Prepared MySQL Select Data MySQL Where MySQL Order By MySQL Delete Data MySQL Update Data MySQL Limit Data

PHP XML

PHP XML Parsers PHP SimpleXML Parser PHP SimpleXML - Get PHP XML Expat Parser PHP DOM Parser

PHP - AJAX

AJAX Intro AJAX PHP AJAX Database AJAX XML AJAX Live Search AJAX Poll

PHP Examples

PHP Examples PHP Compiler PHP Quiz PHP Exercises PHP Server PHP Syllabus PHP Study Plan PHP Certificate

PHP Reference

PHP Overview PHP Array
array() array_change_key_case() array_chunk() array_column() array_combine() array_count_values() array_diff() array_diff_assoc() array_diff_key() array_diff_uassoc() array_diff_ukey() array_fill() array_fill_keys() array_filter() array_flip() array_intersect() array_intersect_assoc() array_intersect_key() array_intersect_uassoc() array_intersect_ukey() array_key_exists() array_keys() array_map() array_merge() array_merge_recursive() array_multisort() array_pad() array_pop() array_product() array_push() array_rand() array_reduce() array_replace() array_replace_recursive() array_reverse() array_search() array_shift() array_slice() array_splice() array_sum() array_udiff() array_udiff_assoc() array_udiff_uassoc() array_uintersect() array_uintersect_assoc() array_uintersect_uassoc() array_unique() array_unshift() array_values() array_walk() array_walk_recursive() arsort() asort() compact() count() current() each() end() extract() in_array() key() krsort() ksort() list() natcasesort() natsort() next() pos() prev() range() reset() rsort() shuffle() sizeof() sort() uasort() uksort() usort()
PHP Calendar PHP Date
checkdate() date_add() date_create_from_format() date_create() date_date_set() date_default_timezone_get() date_default_timezone_set() date_diff() date_format() date_get_last_errors() date_interval_create_from_date_string() date_interval_format() date_isodate_set() date_modify() date_offset_get() date_parse_from_format() date_parse() date_sub() date_sun_info() date_sunrise() date_sunset() date_time_set() date_timestamp_get() date_timestamp_set() date_timezone_get() date_timezone_set() date() getdate() gettimeofday() gmdate() gmmktime() gmstrftime() idate() localtime() microtime() mktime() strftime() strptime() strtotime() time() timezone_abbreviations_list() timezone_identifiers_list() timezone_location_get() timezone_name_from_abbr() timezone_name_get() timezone_offset_get() timezone_open() timezone_transitions_get() timezone_version_get()
PHP Directory PHP Error PHP Exception PHP Filesystem
basename() chgrp() chmod() chown() clearstatcache() copy() delete() dirname() disk_free_space() disk_total_space() diskfreespace() fclose() feof() fflush() fgetc() fgetcsv() fgets() fgetss() file() file_exists() file_get_contents() file_put_contents() fileatime() filectime() filegroup() fileinode() filemtime() fileowner() fileperms() filesize() filetype() flock() fnmatch() fopen() fpassthru() fputcsv() fputs() fread() fscanf() fseek() fstat() ftell() ftruncate() fwrite() glob() is_dir() is_executable() is_file() is_link() is_readable() is_uploaded_file() is_writable() is_writeable() lchgrp() lchown() link() linkinfo() lstat() mkdir() move_uploaded_file() parse_ini_file() parse_ini_string() pathinfo() pclose() popen() readfile() readlink() realpath() realpath_cache_get() realpath_cache_size() rename() rewind() rmdir() set_file_buffer() stat() symlink() tempnam() tmpfile() touch() umask() unlink()
PHP Filter PHP FTP PHP JSON PHP Keywords PHP Libxml PHP Mail PHP Math PHP Misc PHP MySQLi PHP Network PHP Output Control PHP RegEx PHP SimpleXML PHP Stream PHP String
addcslashes() addslashes() bin2hex() chop() chr() chunk_split() convert_cyr_string() convert_uudecode() convert_uuencode() count_chars() crc32() crypt() echo() explode() fprint() get_html_translation_table() hebrev() hebrevc() hex2bin() html_entity_decode() htmlentities() htmlspecialchars_decode() htmlspecialchars() implode() join() lcfirst() levenshtein() localeconv() ltrim() md5() md5_file() metaphone() money_format() nl_langinfo() nl2br() number_format() ord() parse_str() print() printf() quoted_printable_decode() quoted_printable_encode() quotemeta() rtrim() setlocale() sha1() sha1_file() similar_text() soundex() sprintf() sscanf() str_contains() str_ends_with() str_getcsv() str_ireplace() str_pad() str_repeat() str_replace() str_rot13() str_shuffle() str_split() str_starts_with() str_word_count() strcasecmp() strchr() strcmp() strcoll() strcspn() strip_tags() stripcslashes() stripslashes() stripos() stristr() strlen() strnatcasecmp() strnatcmp() strncasecmp() strncmp() strpbrk() strpos() strrchr() strrev() strripos() strrpos() strspn() strstr() strtok() strtolower() strtoupper() strtr() substr() substr_compare() substr_count() substr_replace() trim() ucfirst() ucwords() vfprintf() vprintf() vsprintf() wordwrap()
PHP Variable Handling PHP XML Parser PHP Zip PHP Timezones

PHP Examples


PHP Install

Install explained


PHP Syntax

Syntax explained


PHP Comments

Comments explained


PHP Variables

Variables explained



PHP Echo and Print

Echo and Print explained


PHP Data Types

Data Types explained


PHP Strings

Strings explained


PHP Numbers

Numbers explained


PHP Casting

Casting explained


PHP Math

Math explained


PHP Constants

Constants explained


PHP Magic Constants

Magic Constants explained


PHP Operators

Arithmetic operator: Addition (+) Arithmetic operator: Subtraction (-) Arithmetic operator: Multiplication (*) Arithmetic operator: Division (/) Arithmetic operator: Modulus (%) Arithmetic operator: Exponentiation (**) Assignment operator: x = y Assignment operator: x += y Assignment operator: x -= y Assignment operator: x *= y Assignment operator: x /= y Assignment operator: x %= y Comparison operator: Equal (==) Comparison operator: Identical (===) Comparison operator: Not equal (!=) Comparison operator: Not equal (<>) Comparison operator: Not identical (!==) Comparison operator: Greater than (>) Comparison operator: Less than (<) Comparison operator: Greater than or equal (>=) Comparison operator: Less than or equal (<=) Comparison operator: Spaceship (<=>) Increment operator: ++$x Increment operator: $x++ Decrement operator: --$x Decrement operator: $x-- Logical operator: and Logical operator: or Logical operator: xor Logical operator: && (and) Logical operator: || (or) Logical operator: not String operator: Concatenation of $txt1 and $txt2 String operator: Appends $txt2 to $txt1 Array operator: Union (+) Array operator: Equality (==) Array operator: Identity (===) Array operator: Inequality (!=) Array operator: Inequality (<>) Array operator: Non-identity (!==) Conditional assignment operator: Ternary (?:) Conditional assignment: Null coalescing (??)

Operators explained


PHP If Statements

If Statements explained


PHP Switch Statement

Switch Statement explained


PHP Match Expression

Match Expression explained


PHP Loops

Loops explained


PHP Functions

Functions explained


PHP Arrays

Create and display an indexed array Access a specific array item with index number Change value of array item Loop through an indexed array Create and display an associative array Access a specific array item with key name Change value of array item Loop through an associative array Add more array items to the end of an indexed array Add more array items to the end of an associative array array_push() - Add one or more array items to the end of an array array_unshift() - Add one or more array items to the beginning of an array array_splice() - Remove a portion of an array and replace it with new items array_merge() - Merge two or more arrays array_pop() - Remove the last item of an array array_shift() - Remove the first item of an array sort() - Sorts an indexed array in ascending order rsort() - Sorts an indexed array in descending order asort() - Sorts an associative array in ascending order (value) arsort() - Sorts an associative array in descending order (value) ksort() - Sorts an associative array in ascending order (key) krsort() - Sorts an associative array in descending order (key) Create a multidimensional array Loop through a multidimensional array (for loop) Loop through a multidimensional array (foreach loop)

Arrays explained


PHP Superglobals

Superglobals explained


PHP Regular Expressions

Regular Expressions explained


PHP Regular Expression Functions

Regular Exp Functions explained


PHP Form Validation

Form Validation explained


PHP Date and Time

Date and Time explained


PHP Include Files

Include Files explained


PHP File Handling

File Handling explained


PHP File Open/Read/Close

File Open/Read/Close explained


PHP Sessions

Sessions explained


PHP Filters

Filters explained


PHP Callback Functions

Callback Functions explained


PHP and JSON

PHP and JSON explained


PHP Exceptions

PHP Exceptions explained


PHP Object-Oriented Programming (OOP)

PHP OOP explained


PHP MySQL Database

MySQL Database explained


PHP SimpleXML Parser

SimpleXML Parser explained


PHP XML Expat Parser

XML Expat Parser explained

PHP and AJAX

AJAX explained



×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

FORUM ABOUT ACADEMY
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted our terms of use, and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.

-->