-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.php
More file actions
28 lines (28 loc) · 745 Bytes
/
variables.php
File metadata and controls
28 lines (28 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
// echo "We talk about variables".'<br>';
$name = 'Hoang'; //string
$age = 18;//integer
// echo $age;
$has_mercedes = false;
//echo $has_mercedes;
//var_dump($has_mercedes);
$product_price = 22.45; //Float
//var_dump($product_price);
echo "<br>";
//string concatenation
//echo $name.' is '.$age.' years old'."<br>";
//this is better
//echo "${name} is ${age} years old...";
//expression
//echo '1' + '2';
$sum = '2' + '3';
//var_dump($sum);
//echo 5 * 3;
//echo 10 / 2;
//echo 5 / 0;
echo 10 % 3;//remains
//constants
define('SERVER_NAME', 'localhost');
define('DATABASE_NAME', 'test_db');
echo "server: ".SERVER_NAME.', db : '.DATABASE_NAME;
?>