```
var longitudeArray = new Array(<?php $result = count($longitudeArray);
                                    if ($result > 1){
                                    echo implode(',', $longitudeArray); 
                                    } else {
                                    echo $longitudeArray[0];
                                    }
                                    ?>);

```

`$longitudeArray` contain array of number like: `$longitudeArray = array(23.54545, 2323.32);`
Above script create following javascript array:

```
var longitudeArray = new Array(12.32444,21.34343,23.5454);

```

but if i passes string in `$longitudeArray` like:

```
$longitudeArray = array('one', 'two');

```

instead of integer value in `$longitudeArray` then my javascript array is not creating properly or its not working.