Php - Find only one number in a string -
i have php script loads different ids , send them page on variable, separated coma:
.../page.php?items=12,13,43,17, i load mysql while loop table shows up, , need see if id of table item same adds style table row.
so did was:
$style = (strstr($_get['ids'], $segn['itemid'])) ? 'style="background:lightgreen;"' : '' ; <tr class="gradex" <?= $style ?> >; in case worked single numbers. in case have ids: 1, 2, 3 ... 12 , page request "page.php?items=12" ids '12', '1' , '2'.
i thought use explode(',' , $_get['ids']) guess goes long.
how ids? (i've no affinity whatsoever regexp...).
instead of:
strstr($_get['ids'], $segn['itemid']) you this:
in_array($segn['itemid'], explode(',',$_get['ids']));
Comments
Post a Comment