there is an array $arr = array('1a','2b','4c','5d','3g'); and there is an array check for the initial character of each element
foreach ($arr as $element){ if (substr($element, 0, 1) == 1) echo "one"; elseif (substr($element, 0, 1) == 2) echo " two "; elseif (substr($element, 0, 1) == 4) echo $element; elseif (substr($element, 0, 1) != 3 && substr($element, 0, 1) != 1 && substr($element, 0, 1) != 2) echo " not one, two or three"; } you need to simplify by replacing if and == with a ternary operator help plz, I break my head for a long time
substr($element, 0, 1)written 6 times? - teranswitchno longer in fashion? - Manitikyl