qwertzpoi Posted July 28, 2010 Share Posted July 28, 2010 Hello I have one problem with fwrite() I have one script to get width and height from javascript and echo it with PHP. echo "Screen width is: ". $_GET['width'] ."<br />\n"; echo "Screen height is: ". $_GET['height'] ."<br />\n"; It works but i want to store the result in a file fwrite($info,"Height: $_GET['height'] <br />"); But then I get error Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING //////////////////////// it would be even better if I don't have to print the values but directly store them in $iinfo sorry if something similar was soved but those examples were different or i was unable to transform it to solve my problem Quote Link to comment https://forums.phpfreaks.com/topic/209146-parse-error-parse-error-expecting-t_string-or-t_variable-or-t_num_string/ Share on other sites More sharing options...
Alex Posted July 28, 2010 Share Posted July 28, 2010 If you're accessing an element of an array inside of a string you need to wrap it in curly braces like so: fwrite($info,"Height: {$_GET['height']} <br />"); Quote Link to comment https://forums.phpfreaks.com/topic/209146-parse-error-parse-error-expecting-t_string-or-t_variable-or-t_num_string/#findComment-1092281 Share on other sites More sharing options...
qwertzpoi Posted July 28, 2010 Author Share Posted July 28, 2010 Thank you very much it worked as expected. Quote Link to comment https://forums.phpfreaks.com/topic/209146-parse-error-parse-error-expecting-t_string-or-t_variable-or-t_num_string/#findComment-1092289 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.