27 August 2019

How to assign variables in php with for loop?

assign variables in php with for loop
for($i = 0; $i <= 7; $i++) {
     $name = "variable{$i}";
     $$name = "foo";
}
or
for($i = 0; $i <= 7; $i++) {
     ${"variable$i"} = "foo";
}
or
${"jassi"} .= $_POST['skip'.$daynum];

No comments:

Post a Comment

How to create video slider with cuncks of videos without download all videos?

 Create video slider with cuncks of videos without download all videos function custom_video_slider_shortcode() { $slider_id = 'vide...