Home >Backend Development >PHP Tutorial >php内嵌函数用法实例_php技巧

php内嵌函数用法实例_php技巧

WBOY
WBOYOriginal
2016-05-16 20:19:541042browse

本文实例讲述了php内嵌函数用法。分享给大家供大家参考。具体分析如下:

php中可以在函数内部内嵌一个函数,调用范围仅限于函数本身

<&#63;php
function msg()
{
  echo("<center><h2>Displaying even
  numbers</h2></center><p><p>");
  function displayeven()
  {
   $ctr=0;
   echo("<font size=4>");
   for($i=2;$i<=100;$i+=2)
   {
     echo("$i    ");
     $ctr++;
     if($ctr%10==0)
     {
      echo("<p>");
     }
   }
   echo("</font>");
  }
}
msg();
displayeven();
&#63;>

希望本文所述对大家的php程序设计有所帮助。

Statement:
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