Brandon_R Posted August 19, 2009 Share Posted August 19, 2009 Hello guys i was wondering how i would go about combining basic text with a variable for example basic text = "Basic text" and the valiable is $another. $total['text'] = ??? Please Help Brandon_R Quote Link to comment Share on other sites More sharing options...
smerny Posted August 19, 2009 Share Posted August 19, 2009 huh? i'm unsure what you're asking Quote Link to comment Share on other sites More sharing options...
pudge1 Posted August 19, 2009 Share Posted August 19, 2009 echo $variable . 'text'; There you go. Quote Link to comment Share on other sites More sharing options...
Brandon_R Posted August 19, 2009 Author Share Posted August 19, 2009 Hello guys im sorry i didnt explain fully. $total['text'] = $another; $total['text'] = 'Basic Text'; How about i go about writing them in 1 line? $total['text'] = 'Basic Text' $another; doesnt work. Thank You. I know very basic questions but im kinda new to PHP Brandon_R Quote Link to comment Share on other sites More sharing options...
smerny Posted August 19, 2009 Share Posted August 19, 2009 oh ok $total['text'] = "Basic Text" . $another; or $total['text'] = "Basic Text"; $total['text'] .= $another; the dot is used to connect things into larger strings... "basic text" must always be in quotes while variables are normally outside of quotes.. you could do something like.. $num_dogs = 5; echo "There are ". $num_dogs ." dogs in the park."; Quote Link to comment Share on other sites More sharing options...
Brandon_R Posted August 19, 2009 Author Share Posted August 19, 2009 Thanks It Worked . All i was missing was a period. 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.