Answers for "php loop html"

PHP
6

for loop in php

/*
For loop in php
*/

<?php
for ($i = 0; $i < 10; $i++) {
     echo $i."<br>";
} 
?>
Posted by: Guest on May-06-2020
1

for each php

<?php
foreach (array(1, 2, 3, 4) as &$value) {
    $value = $value * 2;
}
?>
Posted by: Guest on October-19-2020
0

how create loop php

for (initialization; condition; increment){
   code to be executed;
}
//Example
<?php
    $a = 0;
    $b = 0;
 for( $i = 0; $i<5; $i++ )
    {
        $a += 10;
        $b += 5;
    }    
echo ("At the end of the loop a = $a and b = $b" );
?>
//.......................................//
  do {
   code to be executed;
}
while (condition);
//Example
<?php
     $i = 0;
    $num = 0;
         
  do {
       $i++;
     }
         
  while( $i < 10 );
 echo ("Loop stopped at i = $i" );
?>
Posted by: Guest on February-24-2020
0

php loop

1/**
2 * @Route("/programs/{program_id}/comment/{comment_id}", name="program_show_comment")
3 * @ParamConverter("program", class="App\Entity\Program", options={"mapping": {"program_id": "id"}})
4 * @ParamConverter("comment", class="App\Entity\Comment", options={"mapping": {"comment_id": "id"}})
5 */
6public function showProgramComment(Program $program, Comment $comment): Response
7{
8  return $this->render('comment.html.twig', [
9    'program' => $program,
10    'comment' => $comment,
11  ]);
12}
Posted by: Guest on May-30-2021

Browse Popular Code Answers by Language