Learn PHP
************************************************
See More About
• learning php
• php basic functions
• php loops
The essentials for learning PHP:
Learning a new language (programming or otherwise) can be a bit
overwhelming. Many people just don't know where to start and give up
before they even begin. Learning PHP is NOT as overwhelming as it might
seem, I promise you. Just take it one step at a time, and before you
know it you'll be off and running.
1.) Basic Knowledge:
The
first thing you need, before you start learning PHP, is a basic
understanding of HTML. You can switch between PHP and HTML right in the
same document. You can even run PHP from an HTML file.
2.) Tools:
When creating PHP pages, you can use the same program you use to create
your HTML pages. Any plain text editor will do. You will also need an
FTP client to transfer files from your computer to your web hosting. If
you already have an HTML website you most likely already use an FTP
program.
3.) The Basics:
Now you can finally get started
learning PHP! The first thing you should read is our PHP Basics
tutorial. This will take you through creating your first file, using
variables, basic math, and basic IF statements (a form of logic).
4.) Learning Loops :
Once you have mastered these skills, it is time to learn about loops.
Loops repeat the same actions over and over again until a condition is
met. There are several different types of loops which are explained in
our Learning Loops tutorial.
5.) PHP Functions:
Finally, you
can learn to write your own custom functions. From here the sky is the
limit... With a solid knowledge of these PHP basics, adding PHP
functions to your arsenal when you need them will be easy.
Now What?:
Where can you go from here? Our step-by-step tutorials show you how to
put these PHP skills to use, by making practical scripts for your
website.
Learn PHP - A Beginner's Guide to PHP Programing
1 of 9
Previous Next
Basic PHP Syntax
PHP is a server side scripting language used on the Internet to create
dynamic web pages. It is often coupled with MySQL, a relational database
server that can store the information and variables the PHP files may
use. Together they can create everything from the simplest web site to a
full blown business web site, an interactive web forum, or even an
online role playing game.
Learn more about PHP.
Before we can do the big fancy stuff we must first learn the basics from which we build on.
1. Start by creating a blank file using any program that can save in plain text format.
2. Save your file as a .PHP file, for example mypage.php. Saving a page
with the .php extension tells your server that it will need to execute
the PHP code.
3. Enter the statement <?php to let the server know that there is PHP code coming up.
4. After this we would enter the body of our PHP program.
5. Enter the statement ?> to let the browser know the PHP code is done.
Every section of PHP code starts and ends by turning on and off PHP
tags to let the server know that it needs to execute the PHP in between
them. Here is an example:
<?php //on
//and
//off ?>
Everything between the <?php and ?> is read as PHP code. The
<?php statement can also be phrased as simply <? if desired.
Anything outside of these PHP tags is read as HTML, so you can easily
switch between PHP and HTML as needed. This will come in handy later in
our lessons.
PHP Functions
In PHP a function is a predefined set
of commands that are carried out when the function is called. In
addition to being able to write your own functions, PHP has a number of
predefine functions for you to use. Below are many functions we discuss
in our various tutorials, with simple definitions and examples to
follow.
Eval () PHP Function
How to evaluate the inputed text string as PHP using the eval function
IF - Using IF in PHP
IF - We use if in PHP to make a decision
Ads
Learn PHP By Example
PHP Scripts & Code Examples, Tutorials, Articles, and much more.
www.codango.com/php
PHP This - Beginners Book - An Easy Beginners Guide to Learning
Advanced Object Oriented PHP
www.phpthis.com/
PHP Programming & Coding - Hire the Best PHP Coders and Save
Post Your Project Now. It's Free!
www.getacoder.com/PHP_Programmers
Atan2 () PHP Function
How to calculate the arc tangent of two coordinates in radians using PHP
GoTo
How tutorial of how to use GoTo in PHP to skip over code.
<Script> Tags
How to use PHP in a file that supports mixed scripting languages using the <script> tags
Abs () PHP Function
How to use the ABS () function in PHP to return the absolute value of a number
Acos () PHP Function
How to use the acos function to return the arccosine of a number using PHP.
Addslashes () PHP Function
Addslashes adds back slashes into your form data
Array () PHP Function
Array () PHP Function
Ads
PHP SQL
www.freestudentprojects.com/
Download Free Scripts, Codes, Articles, Reviews and Much More !
Inventory Management System
Human Resource Management System
Student Management System
Social Networking Website Script
Functions
Discuss Functions Open the discussion
www.everything.org.uk/Functions
Asin () PHP Function
How to find the arcsine (asin) of a number using PHP.
Atan () PHP Function
This PHP function allows you to find the arctangent of a value in radians.
Base_convert () PHP Function
Converting one number base to another using PHP
Bindec () PHP Function
The bindec function is used to convert a binary string to a decimal in PHP.
Cal_days_in_month () PHP Function
This PHP function tells you how many days are in a given month in a given year.
Ceil () PHP Function
Always rounding a number up to the nearest whole number
Cos () PHP Function
How to calculate the cosine of a number, in radians, using PHP.
Cosh () PHP Function
How to use the Cosh function in PHP to find the hyperbolic cosine
Crypt () PHP Function
The crypt () function encrypts data in PHP
Date () PHP Function
Use date to format the time () function's output.
Decbin () PHP Function
The Decbin PHP Function is used to convert a decimal into a binary number.
Dechex () PHP Function
The dechex function is used to convert a decimal number into a hexadecimal number.
Decoct () PHP Function
The Decoct PHP Function is used to convert a decimal into an octal number
Easter_date () PHP Function
PHP function that calculates what day Easter Sunday falls on in any given year.
Echo () PHP Function
Echo () PHP Function
Else () PHP Function
Else () is used to give an alternate set of code to execute when the if () part of a statement is false.
Elseif () PHP Function
Elseif () is used in conditional statements to make choices.
Eval () PHP Function
Eval () is used to evaluate its input string as PHP code
Exp () PHP Function
The Exp () PHP Function is used to calculate e raised to the power of x.
Feof () PHP Function
The FEOF PHP function is used to test for the end of the file.
Fgets () PHP Function
Fgets is a PHP function that gets data from an external file line by line.
File () PHP Function
File () pulls data from an outside file and puts it into an array .
File_Get_Contents () PHP Function
File_get_contents reads the data from a file and returns it to the PHP file as a string
Floor () PHP Function
Always rounding a number down to the nearest whole number
Fopen () PHP Function
Use fopen() to open a file from php
For () PHP Function
For () is a form of loop in PHP
Foreach () PHP Function
Foreach () is a form of loop in PHP
Fread () PHP Function
Fread is a php function used to read the contents of a file and report the data back to the php file.
Fwrite () PHP Function
fwrite is a binary safe file write used to write to a file in PHP
Getenv () PHP Function
Free tutorial about how to use the getenv() command in PHP to get such things as the document root, or the user's IP address.
Get_magic_quotes_gpc () PHP Function
Checks if Magic Quotes is turned on or off in your php configuration
Hexdec () PHP Function
The Hexdec () PHP Function is used to convert a hexadecimal into a decimal number
Htmlspecialchars () PHP Function
Htmlspecialchars is used to convert special characters to HTML entities
Hypot () PHP Function
How to calculate the Hypotenuse of a right triangle using PHP and the hypot function
If () PHP Function
If () is used as a conditional statement in PHP
ImageColorAllocate () PHP Function
The ImageColorAllocate () function is used in PHP to set the color for an image you are creating.
Imagecreate () PHP Function
The imagecreate () function is used in PHP to create a new palette based image
Imagecreatetruecolor () PHP Function
The imagecreatetruecolor () function is used in PHP to create a new true color image
Imageellipse () PHP Function
Used to draw an ellipse in PHP using the GD Library
Imagefilledarc () PHP Function
Used to draw arcs or pie graphs in PHP using the GD Library
ImageLine () PHP Function
Used to draw a line in PHP using the GD Library
Imagepolygon () PHP Function
How to draw a polygon in PHP using the imagepolygon function and assigning the coordinates of each corner
Imagerotate () PHP Function
How to rotate an image using PHP with the GD Library
Imagestring () PHP Function
Image String is used to add a string (text) to an image
Include () PHP Function
Include external files within a PHP file
Is_Binary () PHP Function
This Is_Binary function in PHP is used to check if the input is a binary number.
Is_Numeric () PHP Function
The PHP function is_numeric is used to check if a variable is a number.
Is_string () PHP Function
The is_string php function is used to check if the value is a string. It will return true or false.
Mail () PHP Function
Sending email from PHP with mail ()
Max () PHP Function
The Max () php function returns the largest number in an array or group of numbers
Min () PHP Function
The Min () php function returns the lowest number in an array or group of numbers
Mktime () PHP Function
Mktime is used to get the timestamp for a specific date
Mysql_close () PHP Function
How to close a MySQL Connection from a PHP file
Mysql_connect() PHP Function
How to connect to your MySQL database from a PHP document
Mysql_error () PHP Function
Report an error into PHP from MySQL when your SQL code encounters problems
Number_format () PHP Function
Format the decimal and 1000 separators, as well as the number of decimals places in a number
Octdec () PHP Function
The Octdec PHP Function is used to convert from an octal number to a decimal
PHP Log () Function
How to use the PHP Log function to find the natural logarithm.
PHPinfo () PHP Function
Learn more about the version of PHP your server is running using the
php info command to see your version, path, and specific settings.
Pi () PHP Function
How to use the PI () PHP function as well as M_PI, M_PI_2, M_PI_4, M_1_PI, M_2_PI, M_SQRTPI, M_2_SQRTPI in your PHP code
Pow () PHP Function
How to use exponents in PHP to raise a number to the power of another number.
Preg_grep () PHP Function
Using Preg_grep to search an array and return an array
Preg_match () PHP Function
Searching a string and returning a true or false with preg_match
Preg_match_all () PHP Function
Searching an entire string for specified terms, and outputting to an array
Preg_replace () PHP Function
Performing a find and replace on a string or an array.
Preg_split () PHP Function
Splitting a string into an array based on your specifications
Print () PHP Function
Print () PHP Function
Print_r () PHP Function
Print_R is used to return an array in a human readable form in PHP
Rad2Deg () PHP Function
The Rad2Deg PHP Function is used to convert an angle measured in radians to one measured in degrees.
Rand () PHP Function
Generating a random number in PHP with the rand () function
Require () PHP Function
Include external files within a PHP file
Round () PHP Function
Rounding a number to a specified amount of decimals
Session_destroy () PHP Function
Session_destroy () is used to destroy all the data in a current session
Session_set_cookie_params () PHP Function
Session_set_cookie_params () is used to set the duration of a session cookie, as well as other optional cookie information
Session_start() PHP Function
The session_start() function is used at the beginning of all PHP pages utilizing sessions.
Session_unset () PHP Function
Session_unset() is used to clear all the variables in a session
Setcookie () PHP Function
A cookie is used to store information about a user on their computer
Sin () PHP Function
How to use the sine (sin) function to do mathematics in PHP
Sinh () PHP Function
How to use the Sinh PHP Function to determine the hyperbolic sine in PHP
Sqrt () PHP Function
Sqrt () PHP Function
Stripslashes () PHP Function
Stripslashes is used to remove blackslashes from data in php
Str_replace () PHP Function
Str_replace is used to find and replace parts of a string in PHP
Substr () PHP Function
How to use the Stbstr PHP Function to return part of a string in PHP
Switch () PHP Function
The PHP switch () function is used in replace of multiple if or elseif statements.
Tan () PHP Function
How to use the tangent (tan) function to do mathematics in PHP
Tanh () PHP Function
The Tanh PHP Function is used to find the hyperbolic tangent of the imputed number.
Time () PHP Function
Accessing the server time and formatting it
Uniqid () PHP Function
PHP code to generate a random unique user ID
Unset () PHP Function
Unset is used to destroy specified variables in PHP
While () PHP Function
While () is a form of loop in PHP
All PHP Functions
Learn all available PHP functions and what use each of them does in PHP.
Variations of Pi
The different mathematical variations of PI built into PHP.
************************************************
See More About
• learning php
• php basic functions
• php loops
The essentials for learning PHP:
Learning a new language (programming or otherwise) can be a bit overwhelming. Many people just don't know where to start and give up before they even begin. Learning PHP is NOT as overwhelming as it might seem, I promise you. Just take it one step at a time, and before you know it you'll be off and running.
1.) Basic Knowledge:
The first thing you need, before you start learning PHP, is a basic understanding of HTML. You can switch between PHP and HTML right in the same document. You can even run PHP from an HTML file.
2.) Tools:
When creating PHP pages, you can use the same program you use to create your HTML pages. Any plain text editor will do. You will also need an FTP client to transfer files from your computer to your web hosting. If you already have an HTML website you most likely already use an FTP program.
3.) The Basics:
Now you can finally get started learning PHP! The first thing you should read is our PHP Basics tutorial. This will take you through creating your first file, using variables, basic math, and basic IF statements (a form of logic).
4.) Learning Loops :
Once you have mastered these skills, it is time to learn about loops. Loops repeat the same actions over and over again until a condition is met. There are several different types of loops which are explained in our Learning Loops tutorial.
5.) PHP Functions:
Finally, you can learn to write your own custom functions. From here the sky is the limit... With a solid knowledge of these PHP basics, adding PHP functions to your arsenal when you need them will be easy.
Now What?:
Where can you go from here? Our step-by-step tutorials show you how to put these PHP skills to use, by making practical scripts for your website.
Learn PHP - A Beginner's Guide to PHP Programing
1 of 9
Previous Next
Basic PHP Syntax
PHP is a server side scripting language used on the Internet to create dynamic web pages. It is often coupled with MySQL, a relational database server that can store the information and variables the PHP files may use. Together they can create everything from the simplest web site to a full blown business web site, an interactive web forum, or even an online role playing game.
Learn more about PHP.
Before we can do the big fancy stuff we must first learn the basics from which we build on.
1. Start by creating a blank file using any program that can save in plain text format.
2. Save your file as a .PHP file, for example mypage.php. Saving a page with the .php extension tells your server that it will need to execute the PHP code.
3. Enter the statement <?php to let the server know that there is PHP code coming up.
4. After this we would enter the body of our PHP program.
5. Enter the statement ?> to let the browser know the PHP code is done.
Every section of PHP code starts and ends by turning on and off PHP tags to let the server know that it needs to execute the PHP in between them. Here is an example:
<?php //on
//and
//off ?>
Everything between the <?php and ?> is read as PHP code. The <?php statement can also be phrased as simply <? if desired. Anything outside of these PHP tags is read as HTML, so you can easily switch between PHP and HTML as needed. This will come in handy later in our lessons.
PHP Functions
In PHP a function is a predefined set of commands that are carried out when the function is called. In addition to being able to write your own functions, PHP has a number of predefine functions for you to use. Below are many functions we discuss in our various tutorials, with simple definitions and examples to follow.
Eval () PHP Function
How to evaluate the inputed text string as PHP using the eval function
IF - Using IF in PHP
IF - We use if in PHP to make a decision
Ads
Learn PHP By Example
PHP Scripts & Code Examples, Tutorials, Articles, and much more.
www.codango.com/php
PHP This - Beginners Book - An Easy Beginners Guide to Learning
Advanced Object Oriented PHP
www.phpthis.com/
PHP Programming & Coding - Hire the Best PHP Coders and Save
Post Your Project Now. It's Free!
www.getacoder.com/PHP_Programmers
Atan2 () PHP Function
How to calculate the arc tangent of two coordinates in radians using PHP
GoTo
How tutorial of how to use GoTo in PHP to skip over code.
<Script> Tags
How to use PHP in a file that supports mixed scripting languages using the <script> tags
Abs () PHP Function
How to use the ABS () function in PHP to return the absolute value of a number
Acos () PHP Function
How to use the acos function to return the arccosine of a number using PHP.
Addslashes () PHP Function
Addslashes adds back slashes into your form data
Array () PHP Function
Array () PHP Function
Ads
PHP SQL
www.freestudentprojects.com/
Download Free Scripts, Codes, Articles, Reviews and Much More !
Inventory Management System
Human Resource Management System
Student Management System
Social Networking Website Script
Functions
Discuss Functions Open the discussion
www.everything.org.uk/Functions
Asin () PHP Function
How to find the arcsine (asin) of a number using PHP.
Atan () PHP Function
This PHP function allows you to find the arctangent of a value in radians.
Base_convert () PHP Function
Converting one number base to another using PHP
Bindec () PHP Function
The bindec function is used to convert a binary string to a decimal in PHP.
Cal_days_in_month () PHP Function
This PHP function tells you how many days are in a given month in a given year.
Ceil () PHP Function
Always rounding a number up to the nearest whole number
Cos () PHP Function
How to calculate the cosine of a number, in radians, using PHP.
Cosh () PHP Function
How to use the Cosh function in PHP to find the hyperbolic cosine
Crypt () PHP Function
The crypt () function encrypts data in PHP
Date () PHP Function
Use date to format the time () function's output.
Decbin () PHP Function
The Decbin PHP Function is used to convert a decimal into a binary number.
Dechex () PHP Function
The dechex function is used to convert a decimal number into a hexadecimal number.
Decoct () PHP Function
The Decoct PHP Function is used to convert a decimal into an octal number
Easter_date () PHP Function
PHP function that calculates what day Easter Sunday falls on in any given year.
Echo () PHP Function
Echo () PHP Function
Else () PHP Function
Else () is used to give an alternate set of code to execute when the if () part of a statement is false.
Elseif () PHP Function
Elseif () is used in conditional statements to make choices.
Eval () PHP Function
Eval () is used to evaluate its input string as PHP code
Exp () PHP Function
The Exp () PHP Function is used to calculate e raised to the power of x.
Feof () PHP Function
The FEOF PHP function is used to test for the end of the file.
Fgets () PHP Function
Fgets is a PHP function that gets data from an external file line by line.
File () PHP Function
File () pulls data from an outside file and puts it into an array .
File_Get_Contents () PHP Function
File_get_contents reads the data from a file and returns it to the PHP file as a string
Floor () PHP Function
Always rounding a number down to the nearest whole number
Fopen () PHP Function
Use fopen() to open a file from php
For () PHP Function
For () is a form of loop in PHP
Foreach () PHP Function
Foreach () is a form of loop in PHP
Fread () PHP Function
Fread is a php function used to read the contents of a file and report the data back to the php file.
Fwrite () PHP Function
fwrite is a binary safe file write used to write to a file in PHP
Getenv () PHP Function
Free tutorial about how to use the getenv() command in PHP to get such things as the document root, or the user's IP address.
Get_magic_quotes_gpc () PHP Function
Checks if Magic Quotes is turned on or off in your php configuration
Hexdec () PHP Function
The Hexdec () PHP Function is used to convert a hexadecimal into a decimal number
Htmlspecialchars () PHP Function
Htmlspecialchars is used to convert special characters to HTML entities
Hypot () PHP Function
How to calculate the Hypotenuse of a right triangle using PHP and the hypot function
If () PHP Function
If () is used as a conditional statement in PHP
ImageColorAllocate () PHP Function
The ImageColorAllocate () function is used in PHP to set the color for an image you are creating.
Imagecreate () PHP Function
The imagecreate () function is used in PHP to create a new palette based image
Imagecreatetruecolor () PHP Function
The imagecreatetruecolor () function is used in PHP to create a new true color image
Imageellipse () PHP Function
Used to draw an ellipse in PHP using the GD Library
Imagefilledarc () PHP Function
Used to draw arcs or pie graphs in PHP using the GD Library
ImageLine () PHP Function
Used to draw a line in PHP using the GD Library
Imagepolygon () PHP Function
How to draw a polygon in PHP using the imagepolygon function and assigning the coordinates of each corner
Imagerotate () PHP Function
How to rotate an image using PHP with the GD Library
Imagestring () PHP Function
Image String is used to add a string (text) to an image
Include () PHP Function
Include external files within a PHP file
Is_Binary () PHP Function
This Is_Binary function in PHP is used to check if the input is a binary number.
Is_Numeric () PHP Function
The PHP function is_numeric is used to check if a variable is a number.
Is_string () PHP Function
The is_string php function is used to check if the value is a string. It will return true or false.
Mail () PHP Function
Sending email from PHP with mail ()
Max () PHP Function
The Max () php function returns the largest number in an array or group of numbers
Min () PHP Function
The Min () php function returns the lowest number in an array or group of numbers
Mktime () PHP Function
Mktime is used to get the timestamp for a specific date
Mysql_close () PHP Function
How to close a MySQL Connection from a PHP file
Mysql_connect() PHP Function
How to connect to your MySQL database from a PHP document
Mysql_error () PHP Function
Report an error into PHP from MySQL when your SQL code encounters problems
Number_format () PHP Function
Format the decimal and 1000 separators, as well as the number of decimals places in a number
Octdec () PHP Function
The Octdec PHP Function is used to convert from an octal number to a decimal
PHP Log () Function
How to use the PHP Log function to find the natural logarithm.
PHPinfo () PHP Function
Learn more about the version of PHP your server is running using the php info command to see your version, path, and specific settings.
Pi () PHP Function
How to use the PI () PHP function as well as M_PI, M_PI_2, M_PI_4, M_1_PI, M_2_PI, M_SQRTPI, M_2_SQRTPI in your PHP code
Pow () PHP Function
How to use exponents in PHP to raise a number to the power of another number.
Preg_grep () PHP Function
Using Preg_grep to search an array and return an array
Preg_match () PHP Function
Searching a string and returning a true or false with preg_match
Preg_match_all () PHP Function
Searching an entire string for specified terms, and outputting to an array
Preg_replace () PHP Function
Performing a find and replace on a string or an array.
Preg_split () PHP Function
Splitting a string into an array based on your specifications
Print () PHP Function
Print () PHP Function
Print_r () PHP Function
Print_R is used to return an array in a human readable form in PHP
Rad2Deg () PHP Function
The Rad2Deg PHP Function is used to convert an angle measured in radians to one measured in degrees.
Rand () PHP Function
Generating a random number in PHP with the rand () function
Require () PHP Function
Include external files within a PHP file
Round () PHP Function
Rounding a number to a specified amount of decimals
Session_destroy () PHP Function
Session_destroy () is used to destroy all the data in a current session
Session_set_cookie_params () PHP Function
Session_set_cookie_params () is used to set the duration of a session cookie, as well as other optional cookie information
Session_start() PHP Function
The session_start() function is used at the beginning of all PHP pages utilizing sessions.
Session_unset () PHP Function
Session_unset() is used to clear all the variables in a session
Setcookie () PHP Function
A cookie is used to store information about a user on their computer
Sin () PHP Function
How to use the sine (sin) function to do mathematics in PHP
Sinh () PHP Function
How to use the Sinh PHP Function to determine the hyperbolic sine in PHP
Sqrt () PHP Function
Sqrt () PHP Function
Stripslashes () PHP Function
Stripslashes is used to remove blackslashes from data in php
Str_replace () PHP Function
Str_replace is used to find and replace parts of a string in PHP
Substr () PHP Function
How to use the Stbstr PHP Function to return part of a string in PHP
Switch () PHP Function
The PHP switch () function is used in replace of multiple if or elseif statements.
Tan () PHP Function
How to use the tangent (tan) function to do mathematics in PHP
Tanh () PHP Function
The Tanh PHP Function is used to find the hyperbolic tangent of the imputed number.
Time () PHP Function
Accessing the server time and formatting it
Uniqid () PHP Function
PHP code to generate a random unique user ID
Unset () PHP Function
Unset is used to destroy specified variables in PHP
While () PHP Function
While () is a form of loop in PHP
All PHP Functions
Learn all available PHP functions and what use each of them does in PHP.
Variations of Pi
The different mathematical variations of PI built into PHP.
This comment has been removed by the author.
ReplyDelete