Setting javascript variable to PHP array's specific index

biodread

New Member
I have a one (very) big PHP array (with 649 indexes). I want to set a javascript variable to specific index of it and that index will depend on another variable. Is there any way? I know i can copy whole PHP array into JavaScript Array using \[code\]json_encode($phpArray)\[/code\] , but i don't want whole array to be loaded on client side(for speed and some sort of security).\[code\] $phpArray[0] = "i am first element"; $phpArray[1] = "i am second element"; /* ......... */ $phpArray[100] = "i am 100th element";\[/code\]and now, let us say, i want to get second element of \[code\]$phpArray\[/code\] ? how can i do it?
 
Back
Top