Heim > Backend-Entwicklung > PHP-Tutorial > php指定函数参数默认值示例代码_PHP教程

php指定函数参数默认值示例代码_PHP教程

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-07-13 17:18:06
Original
1127 Leute haben es durchsucht

例1

复制代码 代码如下:



php函数指定默认值-www.jbxue.com


function printMe($param = NULL)
{
   print $param;
}
printMe("This is test");
printMe();
?>



输出结果:
This is test

例2 php函数参数默认值的使用范例,php函数参数中设置和使用默认值。

复制代码 代码如下:


 
  php函数参数默认值 - www.jbxue.com
 
 
    function textonweb ($content, $fontsize=3){
     echo "$content";
  }
  textonweb ("A
", 7);
  textonweb ("AA.
");
  textonweb ("AAA.
");
  textonweb ("AAAA!
");
  ?>
 
 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/621702.htmlTechArticle例1 复制代码 代码如下: html head titlephp函数指定默认值-www.jbxue.com/title /head body ?php function printMe($param = NULL) { print $param; } printMe("This is test"...
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Aktuelle Ausgaben
PHP-Datenerfassung?
Aus 1970-01-01 08:00:00
0
0
0
PHP-Erweiterung intl
Aus 1970-01-01 08:00:00
0
0
0
Wie man PHP gut lernt
Aus 1970-01-01 08:00:00
0
0
0
Mehrere PHP-Versionen
Aus 1970-01-01 08:00:00
0
0
0
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage