![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
常用 基础代码
Sabrina_wen
这个作者很懒,什么都没留下…
展开
-
常用基础 的代码,虽不常用,但是要会
Class{/** * 读取文件 */ function scandir($path){ $files=array(); $handle=opendir($path); if($filename=@readdir($handle)){ if($filename==’.’ || $filename==’.原创 2017-01-01 16:17:40 · 263 阅读 · 0 评论 -
输入年月 返回当前月份的天数
function get_days( $data ){ $days = data('t',strtotime($data)) return $days;}原创 2017-01-01 16:42:08 · 1628 阅读 · 0 评论 -
简单翻转程序
$str = 'one dream one world';$arr=explode(' ',$str);krsort($arr);$strd=implode(' ',$arr);echo $strd;'world one dream one'扩展: 按照字母 或者 数字大小 sort() 函数用于对数组单元从低到高进行排序。 rsort() 函数用于对数组单元从高到低进行排序。 a原创 2017-01-01 23:32:41 · 460 阅读 · 0 评论 -
if 简写
$a = 0;$a>0 || ($b='This is test'); echo $b;//This is test$a = 1;$a>0 && ($b='This is test'); echo $b;原创 2017-07-28 14:00:10 · 423 阅读 · 0 评论 -
关于值传递和址传递
$data = array(‘a’, ‘b’, ‘c’); foreach($data as $key=>$val) { $val = &$data[$key];}问题1:程序执行时,每一次循环结束后变量$data的值是什么?请解释。(10分)答:当第一次循环时,第一次的值val是和val是和data[key]址传递关系,共用同一地址,所以当下一次循环是key]址传递关系,共用同原创 2017-01-01 22:46:08 · 391 阅读 · 0 评论