Phpinspectionsea: explode(...) misused

Created on 5 Mar 2018  路  5Comments  路  Source: kalessil/phpinspectionsea

lets say i have a string a,b,c and i need to count the elements (split by ,) i would do (as usual)

$array = explode(',', 'a,b,c');
$arrayCount = count($array);

but the inspection says "misused". because this is most simple way for me, i would like to know a version
that is "okay" for the inspection ;)

many thanks

question

Most helpful comment

Hi Michael,

this one =):
image

Cheers, Vlad

All 5 comments

Hi Michael,

this one =):
image

Cheers, Vlad

In case of: $arrayCount = count(explode(',', 'a,b,c')); a QF is available.

@kalessil many thanks, my phpstorm didn麓t show me this suggestion because the count is a few rows later ;( good2know ;) btw... what is ment with the shortcut QF ? ;)

Quick-Fixes: Alt+Enter on reported statements normally do fix code for you (or gives you a list of fixes which can be applied).

okay, thanks, i know this. because explode and count were not below each other, phpstorm didn麓t show me this QF ;) you never stop learning ;)

Was this page helpful?
0 / 5 - 0 ratings