Home > Backend Development > PHP Tutorial > php有什么鲜为人知的技巧?

php有什么鲜为人知的技巧?

WBOY
Release: 2016-06-06 16:44:33
Original
852 people have browsed it

一些大家很少用,却很方便的函数等?

回复内容:

没事上来水一下。

1、cal_days_in_month(calendar,month,year)
作用:
针对指定的年份和日历,返回一个月中的天数。
参数:
calendar 必需。规定要使用的历法。
month 必须。规定月。
year 必须。规定年。
栗子:
<code class="language-php"><span class="cp"><?php </span>
<span class="nv">$days</span> <span class="o">=</span> <span class="nb">cal_days_in_month</span><span class="p">(</span><span class="nx">CAL_GREGORIAN</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">2015</span><span class="p">);</span>
<span class="k">echo</span> <span class="s2">"There was </span><span class="si">$days</span><span class="s2"> days in October 2015"</span><span class="p">;</span>
<span class="cp">?></span><span class="x"></span>
</span></code>
Copy after login
可变变量 PHP: 可变变量

<code class="language-text"><?php //You can even add more Dollar Signs

  $Bar = "a";
  $Foo = "Bar";
  $World = "Foo";
  $Hello = "World";
  $a = "Hello";

  $a; //Returns Hello
  $$a; //Returns World
  $$$a; //Returns Foo
  $$$$a; //Returns Bar
  $$$$$a; //Returns a

  $$$$$$a; //Returns Hello
  $$$$$$$a; //Returns World

  //... and so on ...//

?>
</code>
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template