first of all sorry for title - i don't know how to put it better... I need to test if something is an empty string and if it is not than I want to store it. I have something like this:
if (getStringBetween($array[0], "house", "dog") <> '') {
$text = getStringBetween($array[0], "house", "dog");
}
Can it be make shorter so I don't repeat this getStringBetween($array[0], "house", "dog") twice.
I know I can do it this way:
$a = getStringBetween($array[0], "house", "dog");
if ($a <> '') {
$text = $a;
}
but is this the best way? Can it be done without storing this "extra" $a variable?
Thanks!
Aucun commentaire:
Enregistrer un commentaire