zoukankan      html  css  js  c++  java
  • php 小知识

    一 运算符

    1 当一个变量的值为true即布尔类型时,如果使用==号来做判断的话,那么true=='abc'是为真,最好是使用全等号来做判断

    test code
    function aa($bb) {
      if ($bb=1) {
        return ture;
       }else{
    
        return 'cc';
      }
    }
    
    $cc = aa(1);
    
    if ($cc=='cc') {
      echo 'ok';
    }
    
    这里使用 == 就会输出ok,如果
    
    if ($cc === 'cc'){
      echo 'ok';
    }
    
    这里使用 === 全等号,就不会输出ok

    所以,我们在使用函数返回数据的时候最好是不要返回不同类型的值

    2 标识符

    2.1 lt ,<   2.2 le , <=  2.3 gt , >    2.4 ge , >=    2.5 eq , ==    2.6 ne , !=

    二 数组

    1 当对一个数组使用变量做键值赋值时,如果此变量是非0开头的数字型字符串,那么赋值后的数组的键值会为数字,这时使用array_multisort或sort排序就会更改键值:

    $key = '2002';
    $arr [$key] = 'test';
    结果:
    array(2002=>'test');
    case
  • 相关阅读:
    Expectation Maximization Algorithm
    Cramer-Rao Bounds (CRB)
    宽带DOA估计方法
    Statistical Methods for Machine Learning
    Bootstrap Method
    算法学习————猫树
    扩展KMP详解
    网络流的模型和应用
    [CQOI2011]动态逆序对
    CF1278F Cards
  • 原文地址:https://www.cnblogs.com/phpor/p/2619684.html
Copyright © 2011-2022 走看看