Hello, I have created a simple function that prints a personalized greeting by reading the greeting contents from a file. I pass the user's name to the function, and the function reads the file contents into a string variable. I am then using str_replace to replace the word USER in the string with the user's name that was passed to the function. Then the function correctly prints the personalized greeting as I wish.
My question is, is there another way to do something similar, such as embedding a variable name directly into the text file? In other words, instead of my text file reading: Hello USER ... Can I do something like this: Hello $user_name ... and then write my function to replace $user_name with the passed parameter prior to printing? The reason I ask is because I am going to want to do three substitutions, and I'd rather not do three str_replace calls if I don't have to. Plus the latter seems to be a more robust way of making the changes. Thanks, and apologies if this has been asked before and I missed it. I'm just not sure how to phrase this for a search engine. Nelson