Answers for "from array of arrays to array php"

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
1

string array to array in php

parse_str(unserialize($string_type_array), $array);
    var_dump($array);
Posted by: Guest on December-02-2021

Code answers related to "from array of arrays to array php"

Browse Popular Code Answers by Language