Re: Re: Rewriting string

From: Date: Thu, 13 Jan 2011 20:31:19 +0000
Subject: Re: Re: Rewriting string
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-310743@lists.php.net to get a copy of this message
Admin wrote:
$categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 'testimonials');
If(in_array($_GET['page'], $categories)) { echo '<li><a href=index.php?page='.$_GET['page'].'>'.str_replace("_"," ",$_GET['page']).'</a></li>'; }else{ echo '<li>'.str_replace("_"," ",$_GET['page']).'</li>'; } I normally never write someones code for them but you are just not getting it. The above code works use it.
i assume you're joking - that code is simply going to give 6 list items all with the same value - $_GET['page'] please do check you know what you're talking about before you post.

« previous php.general (#310743) next »