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 Link to comment https://forums.phpfreaks.com/topic/170938-combining-basic-text-with-variables/ 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 Link to comment https://forums.phpfreaks.com/topic/170938-combining-basic-text-with-variables/#findComment-901557 Share on other sites More sharing options...
pudge1 Posted August 19, 2009 Share Posted August 19, 2009 echo $variable . 'text'; There you go. Link to comment https://forums.phpfreaks.com/topic/170938-combining-basic-text-with-variables/#findComment-901558 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 Link to comment https://forums.phpfreaks.com/topic/170938-combining-basic-text-with-variables/#findComment-901559 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."; Link to comment https://forums.phpfreaks.com/topic/170938-combining-basic-text-with-variables/#findComment-901560 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. Link to comment https://forums.phpfreaks.com/topic/170938-combining-basic-text-with-variables/#findComment-901561 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.