Answers for "php to javascript array"

PHP
1

convert php array to javascript array

<?php
    $vegetables = ['apple', 'strawberry', 'banana'];
?>

<script>
var arr = "<?php echo implode(",", $vegetables); ?>".split(",");
console.log(arr); //["apple", "strawberry", "banana"]
Vue.component('#app7', {
    props: arr,
    template: '<li>{{ item.text }}</li>'
})

</script>
Posted by: Guest on October-09-2021
2

php array to js

var arrNums = json_encode(<?php echo $arrNums; ?>);
Posted by: Guest on June-22-2020
1

copy php array to javascript

var js_array = [<?php echo '"'.implode('","', $php_array).'"' ?>];
Posted by: Guest on March-29-2020
0

convert a php array into a javascript array

var js_array = [<?php echo '"'.implode('","',  $disabledDaysRange ).'"' ?>];
Posted by: Guest on February-25-2021

Code answers related to "php to javascript array"

Browse Popular Code Answers by Language