Forum Moderators: open

Message Too Old, No Replies

Split function.

Very quick question.

         

MartinWeb

11:35 pm on Sep 30, 2009 (gmt 0)

10+ Year Member



Hi. Quick question:

Is all of the syntax correct?

var s = "<?php echo $squares; ?>";
var sqareArray = s.split(".");

The variable $squares is 1,2,3,4,5,6,7.0,2,3,4,5,6,7

I ask this, because when I run this I am told that the variable squareArray is empty.

Thank you!

rainborick

11:59 pm on Sep 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your syntax is correct. I tried substituting your sample string for the PHP code in your example and it worked. My guess is that either the PHP code is the problem, or you're spelling "sqareArray" as "squareArray" elsewhere in your JavaScript.

MartinWeb

1:08 am on Oct 1, 2009 (gmt 0)

10+ Year Member



Thank you.
That fixed it. :)