Detailed explanation of the specific usage syntax of PHP function sizeof()_PHP tutorial

WBOY
Release: 2016-07-15 13:29:38
Original
1250 people have browsed it

Everyone has reviewed PHP function sizeof() syntax:

sizeof(arrayname);

Tips and instructions

Note: This function may return 0 if a variable is not set, but may also return 0 if a variable contains an empty array. The isset() function can be used to test whether a variable is set.

Let’s take a look at an example of the PHP function sizeof().

<ol class="dp-xml"><li class="alt">
<span><strong><font color="#006699"><span class="tag"><?</SPAN><SPAN class=tag-name>php</SPAN></FONT></STRONG><SPAN> </SPAN></SPAN><LI class=""><SPAN>$</SPAN><SPAN class=attribute><FONT color=#ff0000>people</FONT></SPAN><SPAN> = </SPAN><SPAN class=attribute-value><FONT color=#0000ff>array</FONT></SPAN><SPAN>("a", "Joe", "b", "C");  </SPAN></SPAN><LI class=alt><SPAN>$</SPAN><SPAN class=attribute><FONT color=#ff0000>result</FONT></SPAN><SPAN> = </SPAN><SPAN class=attribute-value><FONT color=#0000ff>sizeof</FONT></SPAN><SPAN>($people);  </SPAN></SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN>echo $result;  </SPAN><LI class=""><SPAN></SPAN><SPAN class=tag><STRONG><FONT color=#006699>?></span></font></strong></span><span> </span>
</li></ol>
Copy after login

The output result is :4

From the above example, we can see that the PHP function sizeof() is the same as the count method.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446353.htmlTechArticleEveryone has passed the PHP function sizeof() syntax: sizeof(arrayname); Tips and instructions Note: This function may be Returns 0 if a variable is not set, but may also return 0 if a...
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