I'm having some trouble with a PHP variable that doesn't seem to work when referenced with a '$'. I'm relatively new to PHP and I'm trying to understand why this might be happening. Let me explain my scenario a bit:
I have a PHP script where I've defined a variable called 'myVariable' and assigned it a value. However, when I try to use this variable later in my script by referencing it with a '$', it doesn't seem to work. The rest of my code seems fine as I have checked it thoroughly, but I just can't figure out why this variable is causing an issue.
Here's an example of what my code looks like:
$myVariable = "Hello World!";
echo myVariable; // This doesn't work
I have also tried using double quotes inside the echo statement like `echo "$myVariable";`, but that didn't solve the problem either.
I have gone through various tutorials and documentation, but I can't seem to find a solution. Can anyone please tell me what might be causing this issue? Is there something I'm missing in my code or any specific rules I should be aware of when it comes to referencing variables in PHP?
I would really appreciate any guidance or insights you can provide. Thank you in advance for your help!