Home >php教程 >php手册 >php内嵌函数用法实例解析

php内嵌函数用法实例解析

WBOY
WBOYOriginal
2016-06-06 20:06:10954browse

这篇文章主要介绍了php内嵌函数用法,实例分析了php内嵌函数的调用方法与使用技巧,具有一定参考借鉴价值,需要的朋友可以参考下

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

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

<?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();
?>

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