I have lines like this:
$string1 = '35 Hose & Couplings/350902 GARDEN HOSE COUPLING, PVC, 16\/19 MM"'; $string2 = '35 Hose & Couplings/350904 GARDEN HOSE TAP CONNECTOR, PVC, 3\/4" FEMALE THREAD"';
I tried to separate the string and turn it into an array like this:
$name1 = explode('/', $string1); $name1 = trim(end($name1)); $name2 = explode('/', $string2); $name2 = trim(end($name2)); /* #results $name1[0] = '35 Hose & Couplings'; $name1[1] = '350902 GARDEN HOSE COUPLING, PVC, 16\'; $name1[2] = '19 MM"'; ... #expected results $name1[0] = '35 Hose & Couplings'; $name1[1] = '350902 GARDEN HOSE COUPLING, PVC, 16\/19 MM"'; ... */
I want to blow the line when there is only / , but when it encounters \/ , it should not insert the line, my code still blows the line if it contains \/ , is there any way to do this?
source share