添加字符串以输出PHP文件

So I have this code:

imagepng($image, 'Result.png');

It will create Result.png file in my server in the same folder

Now I wonder, how to create file like

Result123.png
Result1256.png

Both 123 and 1256 is a value of

$text

Thanks

You need to do is:-

imagepng($image, "Result$text.png");

Note:- I assume that $text is a string variable containg different-different values every-time.

You can just do:

imagepng($image, 'Result' . $text . '.png');

Howerever, if you are allowing the user to enter the variable $text, this will be vulnerable to cross side scritping (XSS). In that case, use:

$newtext = strip_tags($text);
imagepng($image, 'Result' . $newtext . '.png');