Heim > Backend-Entwicklung > PHP-Tutorial > PHP 函数_PHP教程

PHP 函数_PHP教程

WBOY
Freigeben: 2016-07-20 11:13:28
Original
807 Leute haben es durchsucht

字符串函数:

  

PHP 函数_PHP教程 = "fakeface" =(,0,3); = (); = ( = (,"c"); ; View Code


数学函数:

  

<span 1</span>     <span $num</span> = 123.123456<span ;
</span><span 2</span>     <span print</span> <span round</span>(<span $num</span>);<span //</span><span 输出一个整数123</span>
<span 3</span>    <span print</span> <span round</span>(<span $num</span>,3);<span //</span><span 输出数字并保留三位小数123.123</span>
<span 4</span>     <span rand</span>(1,10);<span //</span><span 在1,10随机生成一个数字</span>
Nach dem Login kopieren

数组函数:

  

<span  1</span>     <span $fav_bands</span> = <span array</span><span ();
</span><span  2</span>     <span array_push</span>(<span $fav_bands</span>, "Maroon 5");<span //</span><span 给数组添加元素</span>
<span  3</span>     <span array_push</span>(<span $fav_bands</span>, "Bruno Mars"<span );
</span><span  4</span>     <span array_push</span>(<span $fav_bands</span>, "Nickelback"<span );
</span><span  5</span>     <span array_push</span>(<span $fav_bands</span>, "Katy Perry"<span );
</span><span  6</span>     <span array_push</span>(<span $fav_bands</span>, "Macklemore"<span );
</span><span  7</span>     <span print</span> <span count</span>(<span $fav_bands</span><span ); 查看数组有多少元素
</span><span  8</span> 
<span  9</span> 
<span 10</span>    <span $names</span> = <span array</span>("david","alana","violet","rory"<span );
</span><span 11</span>     <span sort</span>(<span $names</span>);<span //</span><span  array("alana","david","rory","violet")</span>
<span 12</span>     <span print</span> <span join</span>(", ", <span $names</span>);<span //</span><span  prints alana, david, rory, violet</span>
<span 13</span>     <span rsort</span>(<span $names</span>);  <span //</span><span  array("violet","rory","david","alana")</span>
Nach dem Login kopieren

 

  

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/440352.htmlTechArticle字符串函数: = "fakeface" = ( ,0,3); = ( ); = ( = ( ,"c"); ; View Code 数学函数: = 123.123456 ( ); ( ,3); (1,10); 数组函数: = ( , "Maroon 5"); ( , "Bruno Mars" (...
Verwandte Etiketten:
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
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage