37 lines
737 B
Plaintext
37 lines
737 B
Plaintext
``++sizeof()++`` is an alias of ``++count()++`` so the two offer the same results, but ``++sizeof()++`` has a different meaning in other languages and may confuse developers who are new to PHP.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,php]
|
|
----
|
|
$fruit=("apple","pear","raspberry","gooseberry","red currant");
|
|
echo sizeof($fruit); // Noncompliant
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
[source,php]
|
|
----
|
|
$fruit=("apple","pear","raspberry","gooseberry","red currant");
|
|
echo count($fruit);
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|