Example below:
$var1 = 'This is how the word';
$var2 = NULL;
$var3 = 'is used in a string.';
echo "$var1 $var2 $var3";
Desired result:
This how is how the word NULL is used in a string.
Actual result:
This is how the word is used in a string.
Would like to do the manipulation on the $var2 = NULL; line if possible. I’ve tried adding single and double quotes – single leads to …word ‘NULL’ is… and double is the same as above.
2
Answers
Just make NULL a string if you need that to visually print.
but if you are debugging and need to see what boolean is returned, than
var_dump
or at leastprint_r
are your friends.Either the question itself is confusing or the approach towards it is confusing.
Why are you even using 3 variables.
Just do it like this.
AND/OR
If you are looping through lots of words that goes in the middle.
Just use a small if/else statement inside the loop when the word is NULL.