for loop in php
/*
For loop in php
*/
<?php
for ($i = 0; $i < 10; $i++) {
echo $i."<br>";
}
?>
for loop in php
/*
For loop in php
*/
<?php
for ($i = 0; $i < 10; $i++) {
echo $i."<br>";
}
?>
php loops
#Loops
<?php
#loops execute code a set number of times
/*
Types of loops
1-For
2-While
3-Do..while
4 Foreach
*/
# For Loop usually use if you know the number of times it has to execute
# @params -it takes an init, condition, increment
#for($i =0;$i<=11;$i++){
#echo 'Number: '.$i;
#echo '<br>';
#}
#While loop
# @ prams - condition
#$i = 0;
#while($i < 10){
# echo $i;
# echo '<br>';
# $i++;
#}
# Do...while loops
#@prapms - condition
/*$i = 0;
do{
echo $i;
echo '<br>';
$i++;
}
while($i < 10);*/
# Foreach --- is for arrays
# $people = array('Brad', 'Jose', 'William');
# foreach($people as $person){
# echo $person;
# echo '<br>';
# }
$people = array('Tony' => '[email protected]',
'Jose' => '[email protected]','William' => '[email protected]');
foreach($people as $person => $email){
echo $person.': '.$email;
echo '<br>';
}
?>
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}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us