Created
December 28, 2020 14:55
-
-
Save Vijay-Kumavat/880de98dfe26b9ef91be3ca995f9593a to your computer and use it in GitHub Desktop.
This program file has basic topic of php like : PHP Variables, Syntax, Variable Scope, Keywords || PHP Strings, Constants, Operators || PHP Elseif, Switch, Statements || PHP Functions || Echo vs. Print and Data Output || PHP Conditional Statements || PHP Arrays, Multidimensional Arrays, Sorting Arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>PHP Lession</title> | |
</head> | |
<body> | |
<?php | |
echo "Hello"."<hr>"; // echo is displayed statement | |
// comment | |
# commnet | |
/* multiline comment | |
multiline comment | |
multiline comment | |
*/ | |
$x=5*7-5/2; // variable | |
echo $x; // displayed the variable x | |
echo "<hr>"; // horizontal line | |
echo "The1"."<hr>"; | |
ECHO "The2"."<hr>"; | |
Echo "The3"."<hr>"; | |
$car = "BMW"; | |
echo "My car is :" .$car."<hr>"; | |
echo "My car is :" .$Car."<hr>"; | |
echo "My car is :" .$CAR."<hr>"; | |
$x=4; | |
$y=5; | |
echo $x."<hr>"; // (.) is followed by a period | |
echo $y."<hr>"; | |
$sport="Football"; | |
echo $sport."<hr>"; | |
$sport="Cricket"; | |
echo "I like ".$sport."<hr>"; //You can also reuse the name of any perious variable. | |
// echo "I like ".$sport."<hr>"; | |
$x=1; | |
$y=5; | |
echo $x+$y."<hr>"; // | |
$x=5; | |
function test1(){ //function declaration | |
echo "The variable x is :".$x."<hr>"; //error : Coz $x is global variable and you can't declare the $x variable inside this funciton | |
} | |
test1(); //function calling | |
echo "The variable x is : ".$x."<hr>"; | |
function test2(){ | |
$y=6; | |
$z=6; | |
echo "The variable y is : ".$y."<hr>"; // Error-fee | |
} | |
test2(); | |
echo "The variable y is : ".$z."<hr>"; | |
$x=10; $y=30; //global variable | |
function test3(){ | |
$GLOBALS['y'] = $$GLOBALS['x'] + $GLOBALS['y']; // global $x,$y; //using global variable for function variables | |
// $y=$x+$y; | |
} | |
test3(); | |
echo "The variable y is :".$y."<hr>"; | |
function test4(){ | |
static $x=5; | |
echo $x; | |
$x=$x+5; | |
} | |
test4(); | |
echo "<hr>"; | |
test4(); | |
echo "<hr>"; | |
test4(); | |
echo "<hr>"; | |
test4(); | |
echo "<hr>"; | |
// The echo and print are same statement.But the only diffrents is echo has allow multiple parameters,while print can't allow multiple parameters. | |
echo "This ","is ","Kumavat vijay"."<hr>"; | |
print "this is kumavat Vijay"."<hr>"; | |
$num=5.6; | |
var_dump($num); // The var_dump function is used to dump information about the variable. | |
echo "<hr>"; | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment