php - Condensing Code for GET Variables That Return The Same Values -
i'm going placing identical content different url strings, want condense code somehow. heres code
if($_get['name']=='1'){ $section = "box 1"; } if($_get['name']=='2'){ $section = "box 1"; } if($_get['name']=='3'){ $section = "box 1"; } if($_get['name']=='4'){ $section = "box 1"; }
i tried this, no luck:
if($_get['name']=='1','2','3','4'){ $section = "box 1"; }
how condense code don't repeat same thing on , over?
if ( in_array($_get['name'], array(1,2,3,4)) ) { $selection = 'box 1'; }
i think should helps.
Comments
Post a Comment