基本类型

类型初始化

<?php

//常量用 "const" 和 "define",
//变量用 "$"

//整数
$number = 42; 
const maxInt = PHP_INT_MAX;
const Mb = 1048576;

//双精度浮点数
const exp = 2.71828;
$billion = 1E+9;
define('pi', 3.14);
echo pi, "\n";

//字符串
const greeting = "Hello";

//多行字符串
$text = "this is some\n" .
    "multiline text";

$multiLine = "this is some
multiline text";
echo $multiLine, "\n";

//布尔值
const sunIsStar = true;
$earthIsStar = false;

//字符 'A'    
const charA = 'A'; //"\u{41}"
echo charA;