gilk9 Posted January 5, 2010 Share Posted January 5, 2010 I need to construct a new file name from the words "Lesson" and ".zip" and a variable $lessonnumber. The three elements are in the order Lesson $lessonnumber .zip The final format of the new variable $newfile would be Lesson123.zip I have been experimenting with variations of $lesson = 'Lesson '; $zip = '.zip'; $newfile = $lesson.$nextlessonnum.$zip; Trying to concatenate numbers and strings has got me beat! All help appreciated,thanks Link to comment https://forums.phpfreaks.com/topic/187220-concatenation-help-please/ Share on other sites More sharing options...
oni-kun Posted January 5, 2010 Share Posted January 5, 2010 What are you trying to do? $nextlessonnum = 123; $lesson = 'Lesson'; $zip = '.zip'; $newfile = $lesson.$nextlessonnum.$zip; echo $newfile; //Output: Lesson123.zip That works fine. Concatinating strings and numbers are the same. http://php.net/manual/en/language.types.type-juggling.php Link to comment https://forums.phpfreaks.com/topic/187220-concatenation-help-please/#findComment-988669 Share on other sites More sharing options...
gilk9 Posted January 5, 2010 Author Share Posted January 5, 2010 Thanks for that, I was wanting confirmation that my general coding direction was appropriate. It was. When I commented out lines one by one I found my error. Just had a stray character causing the problem. Thanks again, D Link to comment https://forums.phpfreaks.com/topic/187220-concatenation-help-please/#findComment-988719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.