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 download/create content in doc from website by adding code in chrome console?

 Download/Create content in doc from website by adding code in chrome console function exportHTMLtoDoc(elementId, fileName = 'document...