rspec/rules/S2425/php/rule.adoc

16 lines
455 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.
== Noncompliant Code Example
----
$fruit=("apple","pear","raspberry","gooseberry","red currant");
echo sizeof($fruit); // Noncompliant
----
== Compliant Solution
----
$fruit=("apple","pear","raspberry","gooseberry","red currant");
echo count($fruit);
----