Search code examples
phpimagettftext

Adding string to output PHP file


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


Solution

  • 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.