php echo html code example

Example 1: How to show php text

<?php
  echo "Hello World!";
// You can also do this with a variable:
$YourVariable = "Hello World!";
echo $YourVariable;
?>

Example 2: php echo alot of html

echo <<<CODE
  <table>
  <tr> 
    <td><b>Hello World</b></td>
  </tr>
  </table>
CODE;

Example 3: print in php

print_r("");

Example 4: echo php

<?php 
$string = "Hello, World!";
echo $string;
?>

Example 5: how to style echo in php

You can style it by the following way:

echo "<p style='color:red;'>" . $ip['cityName'] . "</p>";
echo "<p style='color:red;'>" . $ip['countryName'] . "</p>";

Tags:

Html Example