Answers for "php set variable from array"

PHP
2

set array in javascript from php

//set array in javascript from php array
var jsarry =  <?php echo '["' . implode('", "', $phparry) . '"]' ?>;
Posted by: Guest on December-01-2020
0

assign array to variable php

$info = array('coffee', 'brown', 'caffeine');

// Listing all the variables
list($drink, $color, $power) = $info;
echo "$drink is $color and $power makes it special.\n";

// Listing some of them
list($drink, , $power) = $info;
echo "$drink has $power.\n";

// Or let's skip to only the third one
list( , , $power) = $info;
echo "I need $power!\n";

// list() doesn't work with strings
list($bar) = "abcde";
var_dump($bar); // NULL
Posted by: Guest on July-22-2020

Code answers related to "php set variable from array"

Browse Popular Code Answers by Language