I want to pass an array to the html-code. The array will contain some information and I will use javascript to manipulate this info. I could have done the same programming with php instead of javascript, but then I need to load the page over and over again.
Below is a simplyfication of what I want to do:
<?
$myArr = array(1, 2, 3, 4);
?>
<HTML>
<SCRIPT>
Here I want to have some javescriptcode that shows info stored in the array "arr".
</SCRIPT>
<form>
<input type="hidden" name="arr[]" value='<? echo $myArr ?>' />
</form>
</HTML>
What is the advantage of useing serialization the htmlspecialchars-function?