We train the candidates who are excited in doing PHP training in Chandigarh so that we could appoint them in our own organization or constitution them with other associated companies. We provide PHP industrial training in Chandigarh to B.Tech, MCA & diploma candidates as well as providing one year course for website designing and development.
1. Php training in chandigarh
CBitss Technologies, SCO:23-24-25, Level 3rd, Sector 34A,
Chandigarh, , 160022 Contact : 9914641983
2.
3. PHP History
PHP 3
PHP 3.0 was the first version that closely resembles PHP as it exists today. Finding PHP/FI 2.0 still inefficient and lacking
features they needed to power an eCommerce application they were developing for a university project, Andi Gutmans
and Zeev Suraski of Tel Aviv, Israel, began yet another complete rewrite of the underlying parser in 1997.
PHP 4
By the winter of 1998, shortly after PHP 3.0 was officially released, Andi Gutmans and Zeev Suraski had begun working
on a rewrite of PHP's core. The design goals were to improve performance of complex applications, and improve the
modularity of PHP's code base. Such applications were made possible by PHP 3.0's new features and support for a wide
variety of third party databases and APIs, but PHP 3.0 was not designed to handle such complex applications efficiently.
PHP 5
PHP 5 was released in July 2004 after long development and several pre-releases. It is mainly driven by its core, the Zend
Engine 2.0 with a new object model and dozens of other new features.
4. Installation & configuration
1. Step 1: Install MySQL. Install the MySQL database server on your PC. ...
2. Step 2: Install Apache. Install the Apache web server on your PC. ...
3. Step 3: Install PHP. Now install the PHP scripting language on your PC. ...
4. Step 4: Configure Apache and PHP. ...
5. Step 5: Test your install. ...
6. Step 6: Install Git. ...
7. Step 7: Install Moodle.
5. PHP basic syntax
A PHP script can be placed anywhere in the
document.
A PHP script starts with <?php and ends with ?>:
<?php
// PHP code goes here
?>
6. PHP Date Php Variables
The PHP date() function convert a
timestamp to a more readable date
and time. The computer stores
dates and times in a format called
UNIX Timestamp, which measures
time as a number of seconds since
the beginning of the Unix epoch
(midnight Greenwich Mean Time
on January 1, 1970 i.e. January 1,
1970 00:00:00 GMT ).
A variable can have a short name (like x and y)
or a more descriptive name (age, carname,
total_volume).
Rules for PHP variables:
● A variable starts with the $ sign, followed
by the name of the variable
● A variable name must start with a letter
or the underscore character
● A variable name cannot start with a
number
● A variable name can only contain alpha-
numeric characters and underscores (A-
z, 0-9, and _ )
● Variable names are case-sensitive ($age
and $AGE are two different variables)
7. Strings in php
A string is a sequence of characters, like "Hello world!".
Get The Length of a String
The PHP strlen() function returns the length of a string.
The example below returns the length of the string "Hello world!":
<?php
echo strlen("Hello world!"); // outputs 12
?>
8. Understanding Operators in php
Operators are used to perform operations on variables and values.
PHP divides the operators in the following groups:
● Arithmetic operators
● Assignment operators
● Comparison operators
● Increment/Decrement operators
● Logical operators
● String operators
● Array operators
9. If…Else
Very often when you write code, you want to perform different actions for different
conditions. You can use conditional statements in your code to do this.
In PHP we have the following conditional statements:
● if statement - executes some code if one condition is true
● if...else statement - executes some code if a condition is true and another
code if that condition is false
● if...elseif....else statement - executes different codes for more than two
conditions
● switch statement - selects one of many blocks of code to be executed
10. The PHP switch Statement
Use the switch statement to select one of many blocks of code to be executed.
Syntax
switch (n) {
case label1:
code to be executed if n=label1;
break;
case label2:
code to be executed if n=label2;
break;
11. PHP Array : An array is a special variable, which can hold more than one value at a time.
If you have a list of items (a list of car names, for example), storing the cars in single variables
could look like this:
$cars1 = "Volvo";
$cars2 = "BMW";
$cars3 = "Toyota";
However, what if you want to loop through the cars and find a specific one? And what if you
had not 3 cars, but 300?
The solution is to create an array!
An array can hold many values under a single name, and you can access the values by referring
to an index number.
12. PHP Sorting Arrays
PHP - Sort Functions For Arrays
In this chapter, we will go through the following PHP array sort functions:
● sort() - sort arrays in ascending order
● rsort() - sort arrays in descending order
● asort() - sort associative arrays in ascending order, according to the value
● ksort() - sort associative arrays in ascending order, according to the key
● arsort() - sort associative arrays in descending order, according to the value
● krsort() - sort associative arrays in descending order, according to the key
13. While & Do while loops
Often when you write code, you want the same block of code to run over and over
again in a row. Instead of adding several almost equal code-lines in a script, we
can use loops to perform a task like this.
In PHP, we have the following looping statements:
● while - loops through a block of code as long as the specified condition is true
● do...while - loops through a block of code once, and then repeats the loop as
long as the specified condition is true
● for - loops through a block of code a specified number of times
● foreach - loops through a block of code for each element in an array
14. For Loops
The for loop is used when you know in advance how many times the script
should run.
Syntax
for (init counter; test counter; increment counter) {
code to be executed;
}
15. Functions
Besides the built-in PHP functions, we can create our own functions.
A function is a block of statements that can be used repeatedly in a
program.
A function will not execute immediately when a page loads.
A function will be executed by a call to the function.
16. The GET Method
The GET method sends the encoded user information appended to the page request. The page
and the encoded information are separated by the ? character.
http://www.test.com/index.htm?name1=value1&name2=value2
● The GET method produces a long string that appears in your server logs, in the browser's
Location: box.
● The GET method is restricted to send upto 1024 characters only.
● Never use GET method if you have password or other sensitive information to be sent to
the server.
● GET can't be used to send binary data, like images or word documents, to the server.
● The data sent by GET method can be accessed using QUERY_STRING environment
variable.
● The PHP provides $_GET associative array to access all the sent information using GET
method.
17. The POST Method
The POST method transfers information via HTTP headers. The
information is encoded as described in case of GET method and put into a
header called QUERY_STRING.
● The POST method does not have any restriction on data size to be
sent.
● The POST method can be used to send ASCII as well as binary data.
● The data sent by POST method goes through HTTP header so security
depends on HTTP protocol. By using Secure HTTP you can make sure
that your information is secure.
● The PHP provides $_POST associative array to access all the sent
information using POST method.