rspec/rules/S2425/php/rule.adoc

27 lines
594 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
``++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.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
$fruit=("apple","pear","raspberry","gooseberry","red currant");
echo sizeof($fruit); // Noncompliant
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
$fruit=("apple","pear","raspberry","gooseberry","red currant");
echo count($fruit);
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::rspecator-view[]