Answer the question
In order to leave comments, you need to log in
How to output characters and their reverse order in one loop?
For example, there is a value of 4, you need to display such an order of characters
*
**
***
****
***
**
*
but you need to do this in one cycle.
<?php
$a = 4;
$b = 4;
$flag = True;
for($i = 1;$i <= $a; $i++) {
echo str_repeat("+", $i);
echo "<br>";
echo str_repeat("-", $b -= 1);
}
but I can't understand what needs to be added between two str_repeat, so that the output is correct.
Answer the question
In order to leave comments, you need to log in
function brandSearch(){
var flag = false;
var searchForm = $('#search');
var brands = [];
$('.brands .sbody button').each(function() {
if (/qwe/.test($(this).data('brand'))) {
brands.push($(this).data('brand'));
}
});
$.each(brands,function(index,value){
console.log(value);
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question