You can use the following code to add variables into an array within a foreach loop in PHP:

$myArray = array();

foreach($myVars as $var){
   $myArray[] = $var;
}

In this example, $myVars is an array of variables that you want to add to $myArray. Within the loop, you can use the [] syntax to add each variable to the end of $myArray.

i want to put some vars into array in foreach loop php

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

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