// 不好的写法 $foo = $assoc_array[blah]; // 好的写法 $foo = $assoc_array['blah']; // 不好的写法 $foo = $assoc_array["$var"]; // 好的写法 $foo = $assoc_array[$var];
// 不好的写法
$str = "This is a really long string with no variables for the parser to find.";
do_stuff("$str");
// 好的写法
$str = 'This is a really long string with no variables for the parser to find.';
do_stuff($str);
// 有时候单引号不是那么合适
$post_url = $phpbb_root_path . 'posting.' . $phpEx . '?mode=' . $mode . '&start=' . $start;
// 双引号有时候能让代码行更集中
$post_url = "{$phpbb_root_path}posting.$phpEx?mode=$mode&start=$start";
// 在每次循环中sizeof函数都要被调用
for ($i = 0; $i < sizeof($post_data); $i++)
{
do_something();
}
// 您可以在循环起始部分对这个不变的量赋值
for ($i = 0, $size = sizeof($post_data); $i < $size; $i++)
{
do_something();
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有