You are here: PHP Kernel Analytics> Main Web>PHP>PHPTricks2009-07-06, Laruence

PHP技巧

数组相关

  • 使用list一次赋值
 
    list(, $var) = explode(",", $string); //一次取得explode的结果中的第二个元素

字符串相关

解析数组相关

  • 使用sscanf来剥离关键信息
 
    list($month, $day, $year) = sscanf($mandate, "%s %d %d"); 
  • 模拟短路
    $bool = $bool or $bool = true;

 
Topic revision: r4 - 2009-07-06 - 07:45:01 - Main.Laruence
 

TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Supported by Onemouse/风雪之隅 京ICP备09034578号
Ideas, requests, problems regarding PHP Kernel Analytics? Send feedback