![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2004
Posts: 32
Rep Power: 0
![]() |
Is it possible to transfer variables, or at least the information stored in them, to variables in other languages. How can I easily get the values in a PHP array into a Javascript array?
__________________
<CENTER><span style='font-size:17pt;line-height:100%'>My Homepage</span></CENTER> |
|
|
|
|
|
#2 |
|
Expert Programmer
|
I you take a look around the internet, there is a class available in PHP which will write Java serialized variables (and arrays).
Actually the serialize() and unserialize() functions is PHP work very much as they do in Java (though I am not sure they have the same name), just the format used to store information about the variable and/or array is slightly different... Also, if you take a look for these functions on the PHP website (www.php.net) I think you will also find a small bit of information and probably code snippets to do this for you.
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
|
|
#3 |
|
Programming Guru
![]() |
Stupid double post.
__________________
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() |
Javascript is a client-side language lol. So all you'll need to do is output JScript to fill the array.
<script type="text/javascript">
var jsArr = array(
<?php
foreach($phpArr as $col => $val)
echo " \"{$col}\" => \"{$val}\"\n";
?>
};
</script>That converts $phpArr[PHP] to jsArr[Javascript].
__________________
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|