WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP Examples


PHP Syntax

Write content to the yield utilizing PHP
Add remarks in PHP
Keywords, classes, capacities, and client characterized capacities ARE NOT case-sensitive
Variable names ARE case-sensitive

Examples explained


PHP Variables

Create distinctive variables
Test worldwide extension (variable outside function)
Test nearby extension (variable inside function)
Use the worldwide watchword to get to a worldwide variable from inside a function
Use the $GLOBALS[] cluster to get to a worldwide variable from inside a function
Use the static watchword to let a neighborhood variable not be erased after execution of function

Examples explained


PHP Echo and Print

Display strings with the reverberation command
Display strings and factors with the reverberation command
Display strings with the print command
Display strings and factors with the print command

Examples explained


PHP Data Types

PHP string
PHP integer
PHP float
PHP array
PHP object
PHP NULL value

Examples explained


PHP Strings

Get the length of a string - strlen()
Count the quantity of words in a string - str_word_count()
Reverse a string - strrev()
Search for a particular content inside a string - strpos()
Replace message inside a string - str_replace()

Examples explained


PHP Constants

Case-delicate consistent name
Case-uncaring consistent name

Examples explained


PHP Operators

Arithmetic administrator: Addition (+)
Arithmetic administrator: Subtraction (- )
Arithmetic administrator: Multiplication (*)
Arithmetic administrator: Division (/)
Arithmetic administrator: Modulus (%)
Assignment administrator: x = y
Assignment administrator: x += y
Assignment administrator: x - = y
Assignment administrator: x *= y
Assignment administrator: x/= y
Assignment administrator: x %= y
Comparison administrator: Equal (==)
Comparison administrator: Identical (===)
Comparison administrator: Not equivalent (!=)
Comparison administrator: Not equivalent (<>)
Comparison administrator: Not indistinguishable (!==)
Comparison administrator: Greater than (>)
Comparison administrator: Less than (<)
Comparison administrator: Greater than or square with (>=)
Comparison administrator: Less than or break even with (<=)
Increment administrator: ++$x
Increment administrator: $x++
Decrement administrator: - $x
Decrement administrator: $x- -
Logical administrator: and
Logical administrator: or
Logical administrator: xor
Logical administrator: && (and)
Logical administrator: || (or)
Logical administrator: not
String administrator: Concatenation of $txt1 and $txt2
String administrator: Appends $txt2 to $txt1
Array administrator: Union (+)
Array administrator: Equality (==)
Array administrator: Identity (===)
Array administrator: Inequality (!=)
Array administrator: Inequality (<>)
Array administrator: Non-character (!==)

Examples explained


PHP If...Else and Switch Statements

The if statement
The if...else statement
The if...elseif...else statement
The switch statement

Examples explained


PHP While and For Loops

The while loop
The do...while loop
Another do...while loop
The for loop
The foreach loop

Examples explained


PHP Functions

Create a function
Function with one argument
Function with two arguments
Function with default contention value
Function that profits a value

Examples explained


PHP Arrays

Use readfile() to read a file and write it to the output buffer

Examples explained


PHP File Open/Read/Close

Use fopen(), fread(), and fclose() to open, read, and close a file
Use fgets() to peruse a solitary line from a file
Use feof() to peruse a record, line by line, until end-of-document is reached
Use fgetc() to peruse a solitary character from a file

Examples explained


PHP Cookies

Create and recover a cookie
Modify a treat value
Delete a cookie
Check if treats are enabled

Examples explained


PHP Sessions

Start a session
Get session variable values
Get all session variable values
Modify a session variable
Destroy a session

Examples explained


PHP Filters

Use filter_list() to list what the PHP channel expansion offers
Sanitize a string
Validate an integer
Validate a number that is 0
Validate an IP address
Sanitize and approve an email address
Sanitize and approve a URL

Examples explained


PHP Select Data From MySQL

Select information with MySQLi (Object-oriented)
Select information with MySQLi (Object-situated) and place result in a HTML table
Select information with MySQLi (Procedural)
Select information with PDO (+ Prepared statements)

Examples explained


PHP SimpleXML Parser

Use simplexml_load_string() to peruse XML information from a string
Use simplexml_load_file() to peruse XML information from a file
Get hub values
Get hub estimations of explicit elements
Get hub esteems - loop
Get characteristic values
Get characteristic qualities - loop

Examples explained


PHP XML Expat Parser

Initialize a XML Expat parser, characterize a few handlers, at that point parse a XML file

Examples explained