$myText = (string)$myVar; There are more details for string casting and conversion in the Strings section of the PHP manual, including special handling for booleans and nulls.
Tag Archives: variables
php Include File in a Variable
Simply using include() or require() to output the contents of a ‘include’ file on another web page may work perfectly 90% of the time. However, there will be times where you may want to save it into a variable instead – especially if you are using PHP template classes to generate your web pages. Anyone …
Building Variables In PHP
A question I often get is this: how can I make multiple variables into one? The problem is, you put them together, you go to call the variable, but instead of acting like a variable it acts like text. Here is one of the examples sent to me.
PHP variable creation into one line
variable creation into one line