PHP Basics - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript PHP Basics - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Tuesday, December 27, 2016

PHP Basics


PHP Basics 

PHP basics


What is PHP?

PHP is a server Side language which help to make web application on web.
PHP files can contain text, HTML, CSS, JavaScript, and PHP code
PHP code are executed on the server, and the result is returned to the browser as plain HTML
PHP files have extension ".php"
What PHP Do?
Read,Write File
Executes Sql Queries
Generate Web Pages
Create Web Application
Send and Receive Cookies
Generate Sessions
Encrypt Data
Tools And Environment For PHP
For Environment

To Run PHP file We Need A Web Server You Can Create A free Web Hosting Using http://000webhost.com
Or
By Using Your Local Machine
Xampp is The Best Local Server For Your Machine Run On Window,Linux,Mac
For Android You Can Use Server Like KSweb Server.
For Editor

You Can Use Text Editor Sublime Text,Eclispse For PHP Or Notepad++.
Example 1. Hello World
<?php
echo "Hello World";
?>
Output

Hello World
PHP Syntax
Php Must Start With

<?php and ends with ?>
PHP StateMents End With (;) Semicolon
Comments in PHP
// This is a single-line comment
# This is a single-line comment
/*
This is a multiple-lines comment block
*/
Declare Variable in PHP
Example 2 . Declare Variables
<?php
$txt = "Hello world!"; //Declare txt
$x = 5; //Declare x
$y = 10.5; //Decalare y
?>
Note:- (In PHP Variables Name Are Case Sensitive So $x must Be Different Value Form $X )
PHP echo and print function
Example 3 print and echo example
<?php
echo "This is Printing Function Anything We Will Write Inside echo is Print On Browser Screen";
print "This is Printing Function Anything We Will Write Inside print is Print On Browser Screen";
?>

No comments:

Post a Comment

Post Top Ad