Echo and print Statements
PHP echo and print Statements
echo and print are more or less the same. They are both used to output data to the screen.
The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters (although such usage is rare) while print can take one argument. echo is marginally faster than print.
Example
PHP is Fun!"; echo "Hello world!"; echo "I'm about to learn PHP!
"; echo "This ", "string ", "was ", "made ", "with multiple parameters.";?>
print Statement
The print statement can be used with or without parentheses: print or print().
Display Text
The following example shows how to output text with the print command (notice that the text can contain HTML markup):
Example
PHP is Fun!"; print "Hello world!"; print "I'm about to learn PHP!";?>
PHP Data Types
Variables can store data of different types, and different data types can do different things.
PHP supports the following data types:
String
Integer
Float (floating point numbers - also called double)
Boolean
Array
Object
NULL
Resource
PHP String
A string is a sequence of characters, like "Hello world!".
A string can be any text inside quotes. You can use single or double quotes:
Example
<?php $x = "Hello world!"; $y = 'Hello world!';echo $x;
echo "
";
echo $y;
?>
Thank you for sharing knowledge programming PHP @beejayjung
this is a good basic PHP Tutorial ..
I will be posting all the basic tutorial on PHP
Congratulations @beejayjung! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of posts published
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP