zoukankan      html  css  js  c++  java
  • php数据类型

    一般PHP的数据类型不是由程序员定义 PHP会根据它的值自动匹配类型

    四种标量类型:

    两种复合类型:

    最后是两种特殊类型:

    var_dump(): 查看某个表达式的值和类型 

     gettype()   如果只是想得到一个易读懂的类型的表达方式用于调试,用

    is_type() 判断类型

    <?php 
    $a_bool = TRUE; // a boolean 
    $a_str = "foo"; // a string 
    $a_str2 = 'foo'; // a string 
    $an_int = 12; // an integer 
    
    echo gettype($a_bool); // prints out: boolean 
    echo gettype($a_str); // prints out: string 
    
    // If this is an integer, increment it by four 
    if (is_int($an_int)) { 
    $an_int += 4; 
    } 
    
    // If $bool is a string, print it out 
    // (does not print out anything) 
    if (is_string($a_bool)) { 
    echo "String: $a_bool"; 
    } 
    ?> 

     查看某个类型

  • 相关阅读:
    bzoj 4610 Ceiling Functi
    uva 01350
    uva 12075
    uva 01393
    uva 11038
    CF 496E
    CF 496D
    poj 3167
    hdu 4622
    spoj 7258
  • 原文地址:https://www.cnblogs.com/YangJM/p/7072386.html
Copyright © 2011-2022 走看看