What is the difference between client-side and server-side programming?
PHP Snippet 1:
<script type="text/javascript">
var foo = 'bar';
<?php
file_put_contents('foo.txt', ' + foo + ');
?>
var baz = <?php echo 42; ?>;
alert(baz);
</script>
PHP Snippet 2:
<script type="text/javascript">
var foo = 'bar';
var baz = 42;
alert(baz);
</script>