Date post: | 12-Apr-2017 |
Category: |
Education |
Upload: | jatin-batra |
View: | 7 times |
Download: | 0 times |
PHP TRAINING IN AMBALA
Introduction PHP is a server-side scripting language
designed primarily for web development but also used as a general-purpose programming language.
PHP code may be embedded into HTML or HTML5 code, or it can be used in combination with various web template systems, web content management systems and web frameworks.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
PHP & Its Uses• PHP stands for Hypertext Preprocessor. • PHP is free and offered under an open
source license.• A majority of the websites you visit probably use
PHP.• PHP performs calculations.• PHP collects user information.• PHP interacts with MYSQL databases.• PHP and GD library create graphics.• PHP works with cookies.Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
PHP Syntax• The PHP syntax and semantics are
the format (syntax) and the related meanings (semantics) of the text and symbols in the PHP programming language. They form a set of rules that define how a PHP program can be written and interpreted.
• A PHP script is executed on the server, and the plain HTML result is sent back to the browser.Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Basic PHP Syntax• A PHP script can be placed anywhere
in the document.• A PHP script starts with <?php and
ends with ?>:
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
The default file extension for PHP files is ".php".Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Comments in PHP A comment in PHP code is a line that is not
read/executed as part of the program. Its only purpose is to be read by someone who is looking at the code.
Comments can be used to:• Let others understand what you are doing• Remind yourself of what you did - Most
programmers have experienced coming back to their own work a year or two later and having to re-figure out what they did. Comments can remind you of what you were thinking when you wrote the code
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Example:-
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
PHP Variables 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)Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Example:-
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Conditional Statements
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
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
The IF statement
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
The if-else Statement
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
The if..elseif..else statement
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Switch statement
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Loops in php
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
While loop Tests the condition prior to executing the
series of statements at each iteration of the loop.
A long as the conditional expression evaluates to TRUE, the statement or command block that follows executes repeatedly.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Do…while loop
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
For loop PHP for loops execute a block of code a
specified number of times. The for loop is used when you know in
advance how many times the script should run.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Foreach loop• The foreach loop works only in arrays, and is
used to loop through each key/value pair in an array.
For every loop iteration, the value of the current array element is assigned to $value and the array pointer is moved by one, until it reached the last array element.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Php Function PHP functions are similar to other
programming languages. A function is a piece of code which takes
one more input in the form of parameter and does some processing and returns a value.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
CONTACT US
ADDRESS:
SCO -15, Dayal Bagh,
Near Hanuman Mandir
Ambala Cantt-13300, Haryana
Ph. No.: 9729666670, 8222066670 &0171-4000670
Email ID: [email protected]
Website: www.batracomputercentre.com
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com