runnerjp Posted November 9, 2008 Share Posted November 9, 2008 how would i get this to work?? 'message' => '> topic:' echo $gettopic3['title'] , <?php $show = array( 'message' => '> topic:' echo $gettopic3['title'] , 'post' => '> Start new topic', 'reply' => '> reply to a post' ); if(in_array($_GET['page'],array_keys($show))) { echo $show[ $_GET['page'] ]; } ?> Quote Link to comment Share on other sites More sharing options...
.josh Posted November 9, 2008 Share Posted November 9, 2008 Can you rephrase that? Quote Link to comment Share on other sites More sharing options...
runnerjp Posted November 9, 2008 Author Share Posted November 9, 2008 ok well basicly my code was working with <?php $show = array( 'message' => '> topic:' , 'post' => '> Start new topic', 'reply' => '> reply to a post' ); if(in_array($_GET['page'],array_keys($show))) { echo $show[ $_GET['page'] ]; } ?> but i want to add $gettopic3['title'] so it shows the user which topic they are on... so really my question is how cna i add $gettopic3['title'] into my array for 'message' Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 9, 2008 Share Posted November 9, 2008 I think you mean 'message' => '> topic:' . $gettopic3['title'] , Not 'message' => '> topic:' echo $gettopic3['title'] , You use the . to concatenate strings together. Quote Link to comment Share on other sites More sharing options...
runnerjp Posted November 9, 2008 Author Share Posted November 9, 2008 ahh thanks Quote Link to comment Share on other sites More sharing options...
.josh Posted November 9, 2008 Share Posted November 9, 2008 wildteen beat me to it earlier, but I was also going to tell you that array key=> value assignments is just like a regular variable assignment, with . for concatonations, single/double quote rules, etc... Example: $blah = 'something'; $blah = 'something' . $something; $blah = "something$something"; etc... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.