You can display the output of PHP code by using the following two statements.
- Echo
- It is a statement used to display output in PHP.
- It returns a value of 1.
- It doesn't allow to pass multiple arguments.
- It can be used with or without parenthesis.
- It is slower than an echo statement.
Example 1: Print statement with and without parenthesis
<?php print "Hello world "; //without parenthesis print ("Hello world"); //with parenthesis ?>
<?php $ms="Hello everyone!"; print "value is:$ms"; ?>
<?php $ms="value 1"; $msg="value 2"; print "value is:".$ms,$msg; ?>
Example 4: Return value with PHP Print. It returns1.
<?php $city="Adisababa:"; $coun=print $city."Is the capital city of Ethiopia"; print "<br>"; print "value Returned:".$coun; ?>
0 Comments