Jump to content

concatenation help please


gilk9

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.