Answers for "convert javascript objects array to php array"

PHP
9

php convert array to object

$object = (object) $array;
Posted by: Guest on March-17-2020
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
0

array to object php

$object = json_decode(json_encode($array), FALSE);
Posted by: Guest on January-22-2021

Code answers related to "convert javascript objects array to php array"

Browse Popular Code Answers by Language