PHP, Tutorials, Website

Learning PHP in basic baby steps

The fundamental process is important when you start learning any programming. Spend time 2 hours daily then you will improve as you get the drill started. Many source of information you can learn and practice.

PHP 5 vs. PHP 7
PHP 7 is the newest version of PHP.

PHP 7 is much faster than the previous popular stable release!

Website link:
https://www.w3schools.com/php/ ,
https://www.php.net/ ,
https://www.php.net/downloads.php

Skills before you continue learning the php.

This is use in wordpress cms framework one of the coding system using the php programming.

C , C++ , HTML
CSS
JavaScript

What is a PHP File?
PHP files can contain text, HTML, CSS, JavaScript, and PHP code

Below are the 7 usage of the php programming :

PHP can generate dynamic page content
PHP can create, open, read, write, delete, and close files on the server
PHP can collect form data
PHP can send and receive cookies
PHP can add, delete, modify data in your database
PHP can be used to control user-access
PHP can encrypt data

Why php ? It runs in various server system in any webhosting in your websites. So how can you start the programming you need to download first the xampp in your desktop.
https://www.apachefriends.org/download_success.html

Begin to write uside codelobster PHP editor or sublime(
https://www.sublimetext.com/ )

Below is the sample coding basic:

<!DOCTYPE html>
<html>
<body>

<?php
// This is a single-line comment

# This is also a single-line comment

/*
This is a multiple-lines comment block
that spans over multiple
lines
*/

// You can also use comments to leave out parts of a code line
$x = 5 /* + 15 */ + 5;
echo $x;
?>

</body>
</html>


Exercise2: 
<!DOCTYPE html>
<html>
<body>

<?php
ECHO "Hello World!<br>";
echo "Hello World!<br>";
EcHo "Hello World!<br>";
?>

</body>
</html>


Exerise3: 
<html>
<body>
<?php
$color = "blue"
echo " My car is ". $color. "<br>" ; 
echo " My house is" $color. "<br>";

</body>
</html>

Exercise4; 
<html>
<body>

<?php
$txt= "Basic Demo for php";
$x = 10;
$y = 20;

echo $txt;
echo "<br>";
echo $x;

echo "<br>";
echo $y;
 
?>

</body>
</html>

Exercise4:

<html>
	<body>
		<?php
		&txt = "headstartcms.com";
		echo "I love $txt";
		?>
		
		
	</body>
</html>


Exercise4;
<html>
<body>

<?php
function mydemo() {
	static $x=0;
	echo $x;
	$x++;
	
}

mydemo();
echo"<br>";
mydemo();
echo"<br>";
mydemo();

?>
</body>
</html>


Exercise5;
<html>
<body>
	
<?php
echo"<h2>" PHP is rock and roll and easy </h2>;
echo "Heloo php programming";
echo " I am learning easy php";
echo "thi" , "string" , "was" , "made" , "parameter";

?>
	
	
	
</body>
</html>

Exercise 6: 
<html>
	<body>
		<?php
		$mytxt1 =" Easy php";
		$mytxt2 ="CMS frameworks for wordpress";
		$x = 10;
		$y = 20;
		
		echo "<h2>" . $mytxt1 "<h2>";
		echo "CMS Framework " . $mytxt2 "<br>";
		echo $x + $y;
		
		
		
		?>
		
		
		
	</body>
</html>

Exercise 7;
//Global
PHP also stores all global variables in an array called $GLOBALS[index]

<?php
$a = 10;
$b = 20;

function mydemo1(){
	$GLOBALS['b']= $GLOBALS['a'] + GLOBALS['b'];
	
}
mydemo1();
echo $b;
?>


Exercise 8;
<?PHP
print "<h1> PHP is easy </h1>";
print "Testing demo1<br>";
print "learning php the easy way";


?>

Sample of Operator: 
Exercise 1
<?php
$myname = TonyStarks
$age = 38;
echo "Helo $myname . You are $age. \n";


$a = 123123;
$b = 234234;
$sume = $a + $b ;

echo "The sum of $a and $b" is $sum. "


?>

Things to remember in the PHP has three different variable scopes:

local , global , static

The global keyword is used to access a global variable from within a function.

Next topic
https://www.w3schools.com/php/php_echo_print.asp

Tagged , , , ,

Add your comments

Loading Facebook Comments ...
Loading Disqus Comments ...