unknown87 Posted June 28, 2009 Share Posted June 28, 2009 I'm getting this error - can anyone help me? Notice: Undefined variable: Hello in C:\wamp\www\sandbox\variable_variables.php on line 12 <html> <head> <title>Variable Variables</title> </head> <body> <?php $a = "Hello"; $hello = "Hello everyone."; echo $a . "<br />"; echo $hello . "<br />"; echo $$a. "<br />"; ?> </body> </html> Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/163948-variables/ Share on other sites More sharing options...
Philip Posted June 28, 2009 Share Posted June 28, 2009 You're calling $$a, which looks for the variable with the value of $a or - $Hello. You obviously haven't set it up yet..... You could do: $a = 'Hello'; $hello = 'Hello everyone'; // ... $$a = 'Something'; echo $hello.'<br />'; echo $aa.'<br />'; Quote Link to comment https://forums.phpfreaks.com/topic/163948-variables/#findComment-864907 Share on other sites More sharing options...
unknown87 Posted June 28, 2009 Author Share Posted June 28, 2009 I got it work i changed it from: $a = "Hello"; to: $a = "hello"; I didn't know the capital H made a difference but it did. Quote Link to comment https://forums.phpfreaks.com/topic/163948-variables/#findComment-864914 Share on other sites More sharing options...
Ken2k7 Posted June 28, 2009 Share Posted June 28, 2009 I got it work i changed it from: $a = "Hello"; to: $a = "hello"; I didn't know the capital H made a difference but it did. Say what!? Quote Link to comment https://forums.phpfreaks.com/topic/163948-variables/#findComment-864917 Share on other sites More sharing options...
Philip Posted June 28, 2009 Share Posted June 28, 2009 I got it work i changed it from: $a = "Hello"; to: $a = "hello"; I didn't know the capital H made a difference but it did. Say what!? When he was calling $$a it was looking for $Hello, not $hello. Quote Link to comment https://forums.phpfreaks.com/topic/163948-variables/#findComment-864921 Share on other sites More sharing options...
Ken2k7 Posted June 28, 2009 Share Posted June 28, 2009 Oh! Thanks KingPhilip. Quote Link to comment https://forums.phpfreaks.com/topic/163948-variables/#findComment-864922 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.