What is the difference between client-side and server-side programming?
问题 I have this code: <script type=\"text/javascript\"> var foo = \'bar\'; <?php file_put_contents(\'foo.txt\', \' + foo + \'); ?> var baz = <?php echo 42; ?>; alert(baz); </script> Why does this not write \"bar\" into my text file, but alerts \"42\"? NB: Earlier revisions of this question were explicitly about PHP on the server and JavaScript on the client. The essential nature of the problem and solutions is the same for any pair of languages when one is running on the client and the other on