Category Archives for php

php-date-range

  最近使用php处理一些问题,需要通过日期的开始和结束,获得一个日期区间的数组,   php-date-range date_default_timezone_set(‘America/Los_Angeles’);//需要设置一个时区 function dateRange( $first, $last, $step = ‘+1 day’, $format = ‘Y/m/d’ ) { $dates = array(); $current = strtotime( $first ); $last = strtotime( $last ); while( $current $dates[] = date( $format, $current ); $current … Continue reading

24. 十一月 2011 by dumpling
Categories: php | Leave a comment

php类似js indexof与lastindexof的方法[使用后的mark]

PHP strpos() 函数 PHP String 函数 定义和用法 strpos() 函数返回字符串在另一个字符串中第一次出现的位置。 如果没有找到该字符串,则返回 false。 语法 strpos(string,find,start) 参数 描述 string 必需。规定被搜索的字符串。 find 必需。规定要查找的字符。 start 可选。规定开始搜索的位置。 提示和注释 注释:该函数对大小写敏感。如需进行对大小写不敏感的搜索,请使用 stripos() 函数。 例子 <?php echo strpos(“Hello world!”,”wo”); ?> 输出: 6 PHP strripos() 函数 PHP String 函数 定义和用法 … Continue reading

04. 七月 2011 by dumpling
Categories: php | Leave a comment