How do you echo content before the while loop? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How do you set a default value for a MySQL Datetime column?How do you parse and process HTML/XML in PHP?How do you use bcrypt for hashing passwords in PHP?How do I skip an item in while loop if variable empty?How to echo days with no results in while loop?echo out image in mysql while loop not working?Is there any know issue with PHP 5.3.29 and $stmt->get_result() function?How to bind paramater from binded result in while stmtDistinct values from while loopUnable to connect my sql server from PHP
Is CEO the "profession" with the most psychopaths?
Hangman Game with C++
What's the meaning of "fortified infraction restraint"?
Did Krishna say in Bhagavad Gita "I am in every living being"
Question about debouncing - delay of state change
Illegal assignment from sObject to Id
How to compare two different files line by line in unix?
How come Sam didn't become Lord of Horn Hill?
How does light 'choose' between wave and particle behaviour?
How would a mousetrap for use in space work?
Is there any word for a place full of confusion?
Dating a Former Employee
An adverb for when you're not exaggerating
Find 108 by using 3,4,6
Is a ledger board required if the side of my house is wood?
Project Euler #1 in C++
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
How to tell that you are a giant?
Performance gap between vector<bool> and array
Why does the remaining Rebel fleet at the end of Rogue One seem dramatically larger than the one in A New Hope?
Chebyshev inequality in terms of RMS
How do I find out the mythology and history of my Fortress?
Why should I vote and accept answers?
What do you call the main part of a joke?
How do you echo content before the while loop?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How do you set a default value for a MySQL Datetime column?How do you parse and process HTML/XML in PHP?How do you use bcrypt for hashing passwords in PHP?How do I skip an item in while loop if variable empty?How to echo days with no results in while loop?echo out image in mysql while loop not working?Is there any know issue with PHP 5.3.29 and $stmt->get_result() function?How to bind paramater from binded result in while stmtDistinct values from while loopUnable to connect my sql server from PHP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I’m trying to figure out how to echo out content above the while loop and underneath the check for num_rows, but I need to get the content from the while loop before doing that.
$sql = "SELECT * FROM table WHERE column = ?";
$stmt = $db->prepare($sql);
$stmt->bind_param('s', $test);
$result = $stmt->execute();
$stmt_result = $stmt->get_result();
if ($stmt_result->num_rows > 0)
echo "<div id='wrapper'>"; //I need to add HTML content here if $status === 2
while ($row = $stmt_result->fetch_assoc())
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
Maybe I'm missing the obvious. How is it done?
To summarize, this is the output I'm looking for:
//if status !== 2: (i get 3 results)
<div id='wrapper'>
//title
//description
//title
//description
//title
//description
</div>
//if status === 2: (i get 1 result)
<div id='other_wrapper'>
//title
//description
</div>
//if status === 3: (i get 5 results)
<div id='yet_another_wrapper'>
//title
//description
//title
//description
//title
//description
//title
//description
//title
//description
</div>
php mysql
add a comment |
I’m trying to figure out how to echo out content above the while loop and underneath the check for num_rows, but I need to get the content from the while loop before doing that.
$sql = "SELECT * FROM table WHERE column = ?";
$stmt = $db->prepare($sql);
$stmt->bind_param('s', $test);
$result = $stmt->execute();
$stmt_result = $stmt->get_result();
if ($stmt_result->num_rows > 0)
echo "<div id='wrapper'>"; //I need to add HTML content here if $status === 2
while ($row = $stmt_result->fetch_assoc())
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
Maybe I'm missing the obvious. How is it done?
To summarize, this is the output I'm looking for:
//if status !== 2: (i get 3 results)
<div id='wrapper'>
//title
//description
//title
//description
//title
//description
</div>
//if status === 2: (i get 1 result)
<div id='other_wrapper'>
//title
//description
</div>
//if status === 3: (i get 5 results)
<div id='yet_another_wrapper'>
//title
//description
//title
//description
//title
//description
//title
//description
//title
//description
</div>
php mysql
1
You can't echo something that hasn't been loaded yet. You need to call that afterfetch_assoc
has retrieved the relevant data.
– tadman
Mar 21 at 17:16
Maybe i'm using the wrong approach. Is there a way to get a row using theecho $stmt_result->fetch_assoc()['status]
before the while loop? Using it together with the while loop doesn't do anything.
– BillWhickomb
Mar 21 at 17:18
If you fetch and pluck out a single entry then it won't be available within the loop. Try fetching and saving to an array, then inspecting, echo as necessary, then loop again over the array.
– tadman
Mar 21 at 17:26
add a comment |
I’m trying to figure out how to echo out content above the while loop and underneath the check for num_rows, but I need to get the content from the while loop before doing that.
$sql = "SELECT * FROM table WHERE column = ?";
$stmt = $db->prepare($sql);
$stmt->bind_param('s', $test);
$result = $stmt->execute();
$stmt_result = $stmt->get_result();
if ($stmt_result->num_rows > 0)
echo "<div id='wrapper'>"; //I need to add HTML content here if $status === 2
while ($row = $stmt_result->fetch_assoc())
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
Maybe I'm missing the obvious. How is it done?
To summarize, this is the output I'm looking for:
//if status !== 2: (i get 3 results)
<div id='wrapper'>
//title
//description
//title
//description
//title
//description
</div>
//if status === 2: (i get 1 result)
<div id='other_wrapper'>
//title
//description
</div>
//if status === 3: (i get 5 results)
<div id='yet_another_wrapper'>
//title
//description
//title
//description
//title
//description
//title
//description
//title
//description
</div>
php mysql
I’m trying to figure out how to echo out content above the while loop and underneath the check for num_rows, but I need to get the content from the while loop before doing that.
$sql = "SELECT * FROM table WHERE column = ?";
$stmt = $db->prepare($sql);
$stmt->bind_param('s', $test);
$result = $stmt->execute();
$stmt_result = $stmt->get_result();
if ($stmt_result->num_rows > 0)
echo "<div id='wrapper'>"; //I need to add HTML content here if $status === 2
while ($row = $stmt_result->fetch_assoc())
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
Maybe I'm missing the obvious. How is it done?
To summarize, this is the output I'm looking for:
//if status !== 2: (i get 3 results)
<div id='wrapper'>
//title
//description
//title
//description
//title
//description
</div>
//if status === 2: (i get 1 result)
<div id='other_wrapper'>
//title
//description
</div>
//if status === 3: (i get 5 results)
<div id='yet_another_wrapper'>
//title
//description
//title
//description
//title
//description
//title
//description
//title
//description
</div>
php mysql
php mysql
edited Mar 21 at 17:22
BillWhickomb
asked Mar 21 at 17:14
BillWhickombBillWhickomb
66110
66110
1
You can't echo something that hasn't been loaded yet. You need to call that afterfetch_assoc
has retrieved the relevant data.
– tadman
Mar 21 at 17:16
Maybe i'm using the wrong approach. Is there a way to get a row using theecho $stmt_result->fetch_assoc()['status]
before the while loop? Using it together with the while loop doesn't do anything.
– BillWhickomb
Mar 21 at 17:18
If you fetch and pluck out a single entry then it won't be available within the loop. Try fetching and saving to an array, then inspecting, echo as necessary, then loop again over the array.
– tadman
Mar 21 at 17:26
add a comment |
1
You can't echo something that hasn't been loaded yet. You need to call that afterfetch_assoc
has retrieved the relevant data.
– tadman
Mar 21 at 17:16
Maybe i'm using the wrong approach. Is there a way to get a row using theecho $stmt_result->fetch_assoc()['status]
before the while loop? Using it together with the while loop doesn't do anything.
– BillWhickomb
Mar 21 at 17:18
If you fetch and pluck out a single entry then it won't be available within the loop. Try fetching and saving to an array, then inspecting, echo as necessary, then loop again over the array.
– tadman
Mar 21 at 17:26
1
1
You can't echo something that hasn't been loaded yet. You need to call that after
fetch_assoc
has retrieved the relevant data.– tadman
Mar 21 at 17:16
You can't echo something that hasn't been loaded yet. You need to call that after
fetch_assoc
has retrieved the relevant data.– tadman
Mar 21 at 17:16
Maybe i'm using the wrong approach. Is there a way to get a row using the
echo $stmt_result->fetch_assoc()['status]
before the while loop? Using it together with the while loop doesn't do anything.– BillWhickomb
Mar 21 at 17:18
Maybe i'm using the wrong approach. Is there a way to get a row using the
echo $stmt_result->fetch_assoc()['status]
before the while loop? Using it together with the while loop doesn't do anything.– BillWhickomb
Mar 21 at 17:18
If you fetch and pluck out a single entry then it won't be available within the loop. Try fetching and saving to an array, then inspecting, echo as necessary, then loop again over the array.
– tadman
Mar 21 at 17:26
If you fetch and pluck out a single entry then it won't be available within the loop. Try fetching and saving to an array, then inspecting, echo as necessary, then loop again over the array.
– tadman
Mar 21 at 17:26
add a comment |
3 Answers
3
active
oldest
votes
Maybe something like this could work for you.
Put these lines in place of the while loop
$rows = $stmt_result->fetch_all(MYSQLI_ASSOC);
foreach ($rows as $row)
if ($row['status'] === 2)
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
That's pretty brilliant, I'll give it a try :)
– BillWhickomb
Mar 21 at 17:27
add a comment |
Try this:
$idv =0;
if ($stmt_result->num_rows > 0)
while ($row = $stmt_result->fetch_assoc())
if($row['status'] ==2 && $idv==0)
$idv =1;
echo "<div id='wrapper'>"; //adds div once only if status is 2
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
Also a good solution, plus it lets me keep the while loop. Give me a moment while i try the solutions
– BillWhickomb
Mar 21 at 17:29
add a comment |
The above answers a great, but someone provided the perfect solution:
$wrappers = [
'wrapper' => [/* items from db with status not 2 or 3 */]
'other_wrapper' => [/* items from db with status 2 */]
'yet_another_wrapper' => [/* items from db with status 3 */]
];
function getWrapperNameForStatus($status)
if($status === 2)
return 'other_wrapper';
if($status === 3)
return 'yet_another_wrapper';
return 'wrapper';
$wrappers = [];
while ($row = $stmt_result->fetch_assoc())
$wrapperName = getWrapperNameForStatus($row['status']);
$wrappers[$wrapperName][] = [
'title' => $row['title'],
'description' => $row['description'],
'status' => $row['status']
];
Credit goes to https://www.phphelp.com/u/JimL for this solution. It's clean, gives you the ability to post unlimited content within unlimited wrappers, and it prevents code duplication. Thanks Jim.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55285827%2fhow-do-you-echo-content-before-the-while-loop%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Maybe something like this could work for you.
Put these lines in place of the while loop
$rows = $stmt_result->fetch_all(MYSQLI_ASSOC);
foreach ($rows as $row)
if ($row['status'] === 2)
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
That's pretty brilliant, I'll give it a try :)
– BillWhickomb
Mar 21 at 17:27
add a comment |
Maybe something like this could work for you.
Put these lines in place of the while loop
$rows = $stmt_result->fetch_all(MYSQLI_ASSOC);
foreach ($rows as $row)
if ($row['status'] === 2)
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
That's pretty brilliant, I'll give it a try :)
– BillWhickomb
Mar 21 at 17:27
add a comment |
Maybe something like this could work for you.
Put these lines in place of the while loop
$rows = $stmt_result->fetch_all(MYSQLI_ASSOC);
foreach ($rows as $row)
if ($row['status'] === 2)
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
Maybe something like this could work for you.
Put these lines in place of the while loop
$rows = $stmt_result->fetch_all(MYSQLI_ASSOC);
foreach ($rows as $row)
if ($row['status'] === 2)
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
answered Mar 21 at 17:25
Giovanni BarcaGiovanni Barca
337
337
That's pretty brilliant, I'll give it a try :)
– BillWhickomb
Mar 21 at 17:27
add a comment |
That's pretty brilliant, I'll give it a try :)
– BillWhickomb
Mar 21 at 17:27
That's pretty brilliant, I'll give it a try :)
– BillWhickomb
Mar 21 at 17:27
That's pretty brilliant, I'll give it a try :)
– BillWhickomb
Mar 21 at 17:27
add a comment |
Try this:
$idv =0;
if ($stmt_result->num_rows > 0)
while ($row = $stmt_result->fetch_assoc())
if($row['status'] ==2 && $idv==0)
$idv =1;
echo "<div id='wrapper'>"; //adds div once only if status is 2
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
Also a good solution, plus it lets me keep the while loop. Give me a moment while i try the solutions
– BillWhickomb
Mar 21 at 17:29
add a comment |
Try this:
$idv =0;
if ($stmt_result->num_rows > 0)
while ($row = $stmt_result->fetch_assoc())
if($row['status'] ==2 && $idv==0)
$idv =1;
echo "<div id='wrapper'>"; //adds div once only if status is 2
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
Also a good solution, plus it lets me keep the while loop. Give me a moment while i try the solutions
– BillWhickomb
Mar 21 at 17:29
add a comment |
Try this:
$idv =0;
if ($stmt_result->num_rows > 0)
while ($row = $stmt_result->fetch_assoc())
if($row['status'] ==2 && $idv==0)
$idv =1;
echo "<div id='wrapper'>"; //adds div once only if status is 2
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
Try this:
$idv =0;
if ($stmt_result->num_rows > 0)
while ($row = $stmt_result->fetch_assoc())
if($row['status'] ==2 && $idv==0)
$idv =1;
echo "<div id='wrapper'>"; //adds div once only if status is 2
$title = $row['title'];
$description = $row['descript'];
$status = $row['status'];
if ($status === 2)
echo $status;
continue; //skip to the next iteration
echo $title;
echo $description;
answered Mar 21 at 17:27
CoursesWebCoursesWeb
3,38931522
3,38931522
Also a good solution, plus it lets me keep the while loop. Give me a moment while i try the solutions
– BillWhickomb
Mar 21 at 17:29
add a comment |
Also a good solution, plus it lets me keep the while loop. Give me a moment while i try the solutions
– BillWhickomb
Mar 21 at 17:29
Also a good solution, plus it lets me keep the while loop. Give me a moment while i try the solutions
– BillWhickomb
Mar 21 at 17:29
Also a good solution, plus it lets me keep the while loop. Give me a moment while i try the solutions
– BillWhickomb
Mar 21 at 17:29
add a comment |
The above answers a great, but someone provided the perfect solution:
$wrappers = [
'wrapper' => [/* items from db with status not 2 or 3 */]
'other_wrapper' => [/* items from db with status 2 */]
'yet_another_wrapper' => [/* items from db with status 3 */]
];
function getWrapperNameForStatus($status)
if($status === 2)
return 'other_wrapper';
if($status === 3)
return 'yet_another_wrapper';
return 'wrapper';
$wrappers = [];
while ($row = $stmt_result->fetch_assoc())
$wrapperName = getWrapperNameForStatus($row['status']);
$wrappers[$wrapperName][] = [
'title' => $row['title'],
'description' => $row['description'],
'status' => $row['status']
];
Credit goes to https://www.phphelp.com/u/JimL for this solution. It's clean, gives you the ability to post unlimited content within unlimited wrappers, and it prevents code duplication. Thanks Jim.
add a comment |
The above answers a great, but someone provided the perfect solution:
$wrappers = [
'wrapper' => [/* items from db with status not 2 or 3 */]
'other_wrapper' => [/* items from db with status 2 */]
'yet_another_wrapper' => [/* items from db with status 3 */]
];
function getWrapperNameForStatus($status)
if($status === 2)
return 'other_wrapper';
if($status === 3)
return 'yet_another_wrapper';
return 'wrapper';
$wrappers = [];
while ($row = $stmt_result->fetch_assoc())
$wrapperName = getWrapperNameForStatus($row['status']);
$wrappers[$wrapperName][] = [
'title' => $row['title'],
'description' => $row['description'],
'status' => $row['status']
];
Credit goes to https://www.phphelp.com/u/JimL for this solution. It's clean, gives you the ability to post unlimited content within unlimited wrappers, and it prevents code duplication. Thanks Jim.
add a comment |
The above answers a great, but someone provided the perfect solution:
$wrappers = [
'wrapper' => [/* items from db with status not 2 or 3 */]
'other_wrapper' => [/* items from db with status 2 */]
'yet_another_wrapper' => [/* items from db with status 3 */]
];
function getWrapperNameForStatus($status)
if($status === 2)
return 'other_wrapper';
if($status === 3)
return 'yet_another_wrapper';
return 'wrapper';
$wrappers = [];
while ($row = $stmt_result->fetch_assoc())
$wrapperName = getWrapperNameForStatus($row['status']);
$wrappers[$wrapperName][] = [
'title' => $row['title'],
'description' => $row['description'],
'status' => $row['status']
];
Credit goes to https://www.phphelp.com/u/JimL for this solution. It's clean, gives you the ability to post unlimited content within unlimited wrappers, and it prevents code duplication. Thanks Jim.
The above answers a great, but someone provided the perfect solution:
$wrappers = [
'wrapper' => [/* items from db with status not 2 or 3 */]
'other_wrapper' => [/* items from db with status 2 */]
'yet_another_wrapper' => [/* items from db with status 3 */]
];
function getWrapperNameForStatus($status)
if($status === 2)
return 'other_wrapper';
if($status === 3)
return 'yet_another_wrapper';
return 'wrapper';
$wrappers = [];
while ($row = $stmt_result->fetch_assoc())
$wrapperName = getWrapperNameForStatus($row['status']);
$wrappers[$wrapperName][] = [
'title' => $row['title'],
'description' => $row['description'],
'status' => $row['status']
];
Credit goes to https://www.phphelp.com/u/JimL for this solution. It's clean, gives you the ability to post unlimited content within unlimited wrappers, and it prevents code duplication. Thanks Jim.
answered Mar 22 at 10:12
BillWhickombBillWhickomb
66110
66110
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55285827%2fhow-do-you-echo-content-before-the-while-loop%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You can't echo something that hasn't been loaded yet. You need to call that after
fetch_assoc
has retrieved the relevant data.– tadman
Mar 21 at 17:16
Maybe i'm using the wrong approach. Is there a way to get a row using the
echo $stmt_result->fetch_assoc()['status]
before the while loop? Using it together with the while loop doesn't do anything.– BillWhickomb
Mar 21 at 17:18
If you fetch and pluck out a single entry then it won't be available within the loop. Try fetching and saving to an array, then inspecting, echo as necessary, then loop again over the array.
– tadman
Mar 21 at 17:26