The PHP Zone: Live PHP Examples, Exercises & Projects
- All you need to start with PHP is a simple HTML document
- A wrong way to add some PHP code to the HTML file
- Correctly calling print in hello.php
- The HTML markup produced by the PHP code in
- Assigning a value to Variable
- Reassigning a Value
- The default handling of variable scope
- Using global variable
- A static variable remembering its last value
- Using $_SERVER
- Working With Strings
- Using a variable in a string definition
- Single quotes used in a string assignment
- Various special characters in string assignments
- Breaking echo with special characters
- Correct escaping of special characters
- Using strcasecmp to compare two strings
- Concatenating strings together
- Combining a string and a number
- Using a constant in your program
- Echoing the line and file
- PHP mathematical function usage
- Using autoincrement to add to a variable
- Using the autodecrement operator
- Using pre- and postincrement
- All you need to start with PHP is a simple HTML document
- Sum of values
- Casting a variable
- Lefthand expressions
- Order of precedence
- Changing the default precedence using parentheses
- else and if statements
- Checking Multiple Conditions
- Using the ? operator to create a message
- Using if to test for multiple values
- Using switch to test for multiple values
- What happens when there are no break keywords
- Using the DEFAULT: statement to generate an error
- Using endswitch to end the switch definition
- A sample while loop that counts to 10
- Do While Program
- A sample For loop that counts to 10
- Using break to avoid division by zero
- Using continue instead of break
- Sum of values
- Using function to create an array
- Displaying one value from an array
- Displaying the contents of an array using a loop
- Counting the elements in an array
- Using sort to alphabetize
- Creating a multidimensional array
- Displaying a multidimensional array
- Using extract on an associative array
- Using extract with the EXTR_PREFIX_ALL directive
- Using EXTR_PREFIX_ALL on a numeric array
- Using COMPACT() function to create an array
- Using function to create an array
- Displaying information about the PHP environment
- Creating an md5 signature
- A Sample Function
- Using functions within a new function
- Creating a capitalize function with a default parameter $each
- Modifying capitalize() to take a reference parameter
- Using the include function
- Error if we include twice the same file
- Using include_once to include a file
- Error if the file does not exist
- Creating an object of the Cat class
- Creating the Cat constructor
- Using the PHP 5 style constructor
- Defining three member functions for Cat
- Creating a new object
- Using this keyword
- Using the extends keyword to define a subclass
- Calling the constructor of the parent class
- Using the -> and :: operators to call hypnotize
- Referencing the $some_variable
- Displaying information about the PHP environment
- A simple form example
- Modifying our simple search to process the results
- Form default values
- A form with checkboxes using the same name to store multiple values
- Checking input from a radio button or a single select
- PHP feet-to-meters converter
- Converting between time zones based on user input
- Combining form processing and database querying
- A simple form example
- Display number in binary format
- How printf stores the numbers
- Display same number in different format
- Using left zero padding
- Using left space padding
- Using < pre > tags to show spaces
- Left padding with spaces
- Right padding with spaces
- Display number in money format
- Using sprintf with variable
- Calculate length of string
- Using word case functions
- Check whether one string is present in other string
- Using different functions to get portion of a string
- Printing timestamp
- Print formatted date and time
- Adding 2 days to date
- Validate dates
- Create timestamp from date components
- Check whether a file exists or not
- Checking permissions on a file
- Using file_exists, touch, and unlink together
- Upload a file
- Check whether uploaded file exists or not
- Checking the uploaded file size
- Checking the type of uploaded file
- Processing an uploaded file
- Display number in binary format
-
Adding decimal to integer336votesBy adminguy -
Variable handling using single quotes290votesBy adminguy -
scopes of variables289votesBy masalucifer -
Variable handling using double quotes273votesBy adminguy -
Passing Reference229votesBy adminguy -
Limit number of decimals224votesBy adminguy -
Print value of variable191votesBy adminguy -
defining variables and changing their types144votesBy masalucifer -
Defining Constants135votesBy adminguy -
Concatenating Variables45votesBy manojsethi90 -
Static Variable42votesBy adminguy -
scope of parameters41votesBy masalucifer -
Print a statement2votesBy adminguy -
Global variables1votesBy adminguy -
Getting Started1votesBy manojsethi90 -
Reference Variables1votesBy manojsethi90 -
Variable of Variable1votesBy manojsethi90
-
-
Arithmetic Operations on integers373votesBy adminguy -
boolean operators on boolean values212votesBy masalucifer -
Join string using compound operator149votesBy adminguy -
Equal or Identical86votesBy adminguy -
logical operators on variables84votesBy masalucifer -
arithmetic operator49votesBy masalucifer -
isTrue31votesBy adminguy -
Arithmetic Operators1votesBy manojsethi90 -
Assignment Operators1votesBy manojsethi90 -
Comparison Operators1votesBy manojsethi90 -
Logical Operators1votesBy manojsethi90 -
Array Operators1votesBy manojsethi90
-
-
"Continue" demo385votesBy adminguy -
"Break" demo272votesBy adminguy -
Switch Case1votesBy manojsethi90 -
Nested IF Statements1votesBy manojsethi90 -
Complex IF Statements1votesBy manojsethi90
-
-
foreach365votesBy adminguy -
Search an array using do while loop341votesBy adminguy -
while loops310votesBy masalucifer -
Print "Hello World!" three times.285votesBy adminguy -
for loops241votesBy masalucifer -
Print all array elements using for loop118votesBy adminguy -
Search an array using while loop107votesBy adminguy -
foreach loops73votesBy masalucifer -
While Loop Creating Select Date45votesBy manojsethi90 -
For Loop With TextBoxes1votesBy manojsethi90 -
ForEach Loop0votesBy manojsethi90
-
-
Removing values from arrays395votesBy adminguy -
Declare array using words for keys391votesBy adminguy -
Sort an array by keys334votesBy adminguy -
Add elements to end of array314votesBy adminguy -
Adding elements to the beginning of an array298votesBy adminguy -
Accessing array elements into variables243votesBy adminguy -
Declare and print array elements213votesBy adminguy -
Sort an array with words for keys191votesBy adminguy -
sorting and shuffling arrays149votesBy masalucifer -
looping through arrays141votesBy masalucifer -
defining arrays92votesBy masalucifer -
Display Array Elements71votesBy adminguy -
Sort an array63votesBy adminguy -
Creating Array in 3 ways1votesBy manojsethi90 -
Checking Key If Exists1votesBy manojsethi90 -
Merging Arrays1votesBy manojsethi90 -
Counting Number of Values in an Array1votesBy manojsethi90 -
Getting Specific Part of an Array1votesBy manojsethi90 -
Difference Between 2 or More Arrays1votesBy manojsethi90
-
-
string initialization and concatination399votesBy masalucifer -
String Variables346votesBy adminguy -
Joining Strings273votesBy adminguy -
string functions222votesBy masalucifer -
string length and manipulation 1132votesBy masalucifer -
Creating Strings and Basic Functions1votesBy manojsethi90 -
Implode-Explode Functions1votesBy manojsethi90 -
Encrypting a String1votesBy manojsethi90 -
Important String Function1votesBy manojsethi90
-
-
Default Argument Values in a function287votesBy adminguy -
Passing Arguments by Reference to a function144votesBy adminguy -
Passing Arguments by Value in function66votesBy adminguy -
Returning Multiple Values1votesBy adminguy -
Beginning Functions1votesBy manojsethi90 -
Dynamic Functions1votesBy manojsethi90 -
Passing Array as Argument to Function1votesBy manojsethi90
-
-
Classes Basic1votesBy manojsethi90 -
Use Member Function and Predefined Function in Classes1votesBy manojsethi90 -
Constructors Basic1votesBy manojsethi90 -
Parameterized Constructors1votesBy manojsethi90 -
Destructors1votesBy manojsethi90
-
-
Basic Use of Exception1votesBy manojsethi90 -
Try Catch Throw1votesBy manojsethi90 -
Custom Exception Class1votesBy manojsethi90
-
-
Forms using POST1votesBy manojsethi90 -
FORMS Security1votesBy manojsethi90 -
FORMS RadioButton CheckBox1votesBy manojsethi90 -
Forms Security Using Function1votesBy manojsethi90 -
Required and Optional Fields FORMS1votesBy manojsethi90 -
Putting Specific Data Only1votesBy manojsethi90 -
Retaining Values in Fields1votesBy manojsethi90
-
-
Validating Integers1votesBy manojsethi90 -
Filtering Strings1votesBy manojsethi90 -
Validating Internet Protocol IP1votesBy manojsethi90 -
Validating and Filtering URL and EMAIL1votesBy manojsethi90 -
Filtering Value Exist Between Limit1votesBy manojsethi90 -
FILTER_CALLBACK1votesBy manojsethi90
-
-
displayPhone222votesBy adminguy
-
-
find the modulus of 2 numbers148votesBy masalucifer -
string length72votesBy masalucifer
-
-
even and odd numbers228votesBy masalucifer
-
-
Find out the greatest1votesBy manojsethi90
-
-
factorial369votesBy masalucifer
-
-
implode string145votesBy masalucifer
-
-
Call function from function1votesBy manojsethi90 -
Square a Number using Function1votesBy manojsethi90
-
PHP Projects
- 195votes
Age Calculator v.1 (...
By x3d
Programming Contest Name: May - July Contest 2012tags: age calculator
2402 reads
User login
Add an example to this zone.
Takes < 5 mins!
Top Scorers This week


Run It Now!






