Basic Syntax in php

PHP is quite a simple language with roots in C and Perl, yet it looks more like Java. It is also very flexible, but there are a few rules that you need to learn about its syntax and structure


$x += 10;

The $ symbol

 $mycounter = 1;
 $mystring = "Hello";
 $myarray = array("One", "Two", "Three");


String variables

$username = “Fred Smith”;

first PHP program

 $username = "Fred Smith";
 echo $username;
 echo "<br>";
 $current_user = $username;
 echo $current_user;

Leave a Comment