1<?php
2 //can also use print instead of echo and would return but it is
3 //slower so use echo mainly
4 #variable rules
5 /*
6 - Prefix with a dollar sign $
7 - Start with a letter or an underscore only
8 - Only letters, numbers and underscores
9 - Case sensative
10 */
11
12 #DATA TYPES
13 /*
14 Strings
15 Integers 4
16 floats 4.4
17 Booleans True or Flase
18 Arrays
19 Objects
20 Null
21 Resources
22 */
23 $output = ' Hello there Bob!!';
24 $num1 = 4;
25 $num2 =10;
26 $sum = $num1 + $num2;
27 $string1 = ' Hello';
28 $string2 = 'Bobby!!';
29 $greeting = $string1 .' '. $string2;
30 $greeting2 = "$string1 $string2";
31
32 $string3 = ' They\'re Here';
33
34 #making a constant
35
36 define('GREETING', ' Hello Everyone!!');
37
38 echo $sum;
39 echo $output;
40 echo $greeting;
41 echo $greeting2;
42 echo $string3;
43 echo GREETING;
44?>
1<?php
2/* In PHP, a variable starts with the $ sign,
3followed by the name of the variable:
4*/
5
6$txt = "Hello world!";
7$x = 5;
8$y = 10.5;
9?>