rspec/rules/S2425/php/rule.adoc

35 lines
711 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::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[]