My study note of PHP language(IV)
2016-04-02 23:57
429 查看
Variable
What is the variable?used to storage the value.
How to define the variable?
$var_name="苹果"; $n=10;
Naming rules for variable names
1.The variable name must be a letter or an underscore “_” at the beginning.
2.The variable must be named only by letters, numbers, and “_”, but also contains Chinese characters.
3.Variable names are not allowed to contain spaces.
4.Variable names in PHP are case sensitive.
PHP variable data type
8 primitive types are supported:
4 scalar types: boolean, interger, float, string.
2 compound types: array, object.
2 special types: resource, null.
We don not have to declare the data type of variables, PHP will automatically change it into the automantical data type.
$var_string = "hello world!"; var_dump($string); $var_string = 312; var_dump($string);
We can see the result:
string(12) “hello world!”
int(312)
The variable has been changed into interger type. automatically.
相关文章推荐
- php之数据类型
- 每天laravel-20160627|TaggableStore
- 每天laravel-20160627|TaggableStore
- 每天laravel-20160626|RetrievesMultipleKeys
- 每天laravel-20160626|RetrievesMultipleKeys
- 11 Session和数据保持
- thinkphp3.2.3版本模板引擎会把反斜杠\过滤掉的解决办法
- thinkphp3.2.3笔记-验证码
- PHPStorm汉化
- PHPStorm安装与破解
- PHP mysql_real_escape_string() 函数防SQL注入
- php获取复选框的值CheckBox的多个值
- PHP之创建图像验证码 ---实例
- Yii 框架学习--01 框架入门
- PHP之创建图像验证码
- thinPHP中多维数组的遍历
- PHP程序,将csv转成sql文件并导入数据库
- THINKPHP学习
- 浅析ltp测试流程
- 痛苦的vsftpd配置