Blogger Information
Blog 29
fans 0
comment 0
visits 34923
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP的数据类型
小臣
Original
979 people have browsed it

PHP的数据类型有四种、8个

一、标量类型

  1. 整型(integer)

  2. 浮点型(floor)

  3. 字符串(string)

  4. 布尔型(bloon)

二、复杂类型

  1. 数组(array)

  2. 对象(object)

三、特殊类型

  1. NULL

  2. 资源(resource)

<?php
$a_bool  =  TRUE ;    // 布尔
 $a_str   =  "foo" ;   // 字符串
 $a_str2  =  'foo' ;   // 字符串
 $an_int  =  12 ;      // 整型
 // 获取变量的类型
 echo  gettype ( $a_bool );  // bloon
 echo  gettype ( $a_str );   // string

// 判断是否为整型数字
 if ( is_int ( $an_int )) {
     $an_int  +=  4 ;
}

 // 判断是否为字符串
 if ( is_string ( $a_bool )) {
    echo  "String:  $a_bool " ;
}
 ?>



Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post