looking for methods of moving a php held array into a javascript array, idealy without the use of forums and text fields.

the php side of the code is to hold a key, which i want passing to javascript, unseen.

    $arr = array('me','my self','and Irene');
    echo "var arr = new Array();"
    foreach($arr as $key=>$value) echo "arr[{$key}]='{$value}';";
    

    To find out more about javascript arrays.

    n_wattam wrote:

    the php side of the code is to hold a key, which i want passing to javascript, unseen.

    How about an example or more details?

      ok this is the idea behind why i need to do the above.

      I've been looking at encoding email address, and seen the dec/hex methods which work fine, however harvesters can still find these.

      What i want to do is take an email address in php, and hold it in a varable, possible encrypted if needed, then i want javascript to pull this varible and output it using the write command.

      Because the email would be passed though a varible when scanning the source it would not be seen, or if so it would be an encrypted email, ready for java to decrypt it first etc.

      I feel this would stop harvesters full stop from getting my emails from my sites, unless someone went out of there way to write something just for my methods.

        11 years later

        Might be a little late, but there is a PHP to Java Script converter available at

        https://github.com/Danack/PHP-to-Javascript

        Also, if you waned an automated tool to convert from php to java, you could use
        The Runtime Covnerter (online PHP to Java Conversions)

        There's no online conversion site for the PHP to Java Script. You have to run it locally.

        • Arthur
          Write a Reply...