make variable data an array php code example
Example 1: php declare array
$arr = array(
'v1',
'v2',
'v3'
);
$arr = [
'v1',
'v2',
'v3'
];
$arr = array(
'k1' => 'v1',
'k2' => 'v2',
'k3' => 'v3'
);
$arr = [
'k1' => 'v1',
'k2' => 'v2',
'k3' => 'v3'
];
Example 2: how to store array in variable php
$something = array(
'http://www.marleenvanlook.be/admin.php',
'http://www.marleenvanlook.be/checklogin.php',
'http://www.marleenvanlook.be/checkupload.php',
'http://www.marleenvanlook.be/contact.php',
);
foreach($something as $key => $value) {
$key = 'something' . $key;
$$key = $value;
}
echo $something2;