To put variables into an array in PHP, you can use the following syntax:

$var1 = "Hello";
$var2 = "World";

$array = array($var1, $var2);

// or using shorthand syntax

$array = [$var1, $var2];

This will create an array with the values of $var1 and $var2. You can then access these values using their index in the array, like so:

echo $array[0]; // Output: Hello
echo $array[1]; // Output: World
i want to put some vars into array php

原文地址: https://www.cveoy.top/t/topic/bG1Q 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录