rspec/rules/S2425/php/rule.adoc
2022-02-04 16:28:24 +00:00

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[]