Questions tagged as 'loop'

2
answers

PHP logic: how to construct this looping (for, while, foreach)?

Good evening. I'm in the following situation: I'm reading an XLS and playing in a table. This XLS has 52 rows and 6 columns. What I'm getting caught up to do is: $result[linha 1][coluna A] $result[linha 1][coluna B] $result[linha 1][colu...
asked by 03.01.2016 / 04:27
2
answers

How to get the values of an array from a key

I need to get the values ($ src), within this foreach, of each key separately in that array: <?php foreach( get_post_gallery( $post->id, false ) as $key => $src ) { echo $key; //resultado: link, size - ids - src...
asked by 06.11.2015 / 19:05
1
answer

Infinite loop with data stream in PHP

I have the following code below: <?php $Start = microtime(true); $Code = <<<'Code' <?php for($i = 0; $i < 300; $i++){ echo '.'; } Code; include 'data://text/plain,'.$Code; echo microtime(true) - $Start; PHP is enter...
asked by 19.10.2015 / 23:21
1
answer

How to return array indexes in method

Well I could not find a better title for my case, I have the following function : public function select_tokens() { $sql = "SELECT * FROM 'users'"; $select_tokens = Database::DB()->prepare($sql); $select_tokens->execute();...
asked by 31.07.2017 / 12:57
2
answers

Repeat loop is not running

I am making a code where you have a vector (with 15 positions) with predetermined values (10 any values and 5 times the value 0), and where the user will enter a new value to go to the end of the list ( substituting 0). It seems to me that ev...
asked by 22.03.2015 / 17:59
1
answer

Get last child from a product category

Hello, good afternoon. I need to get the last child of a category within a product loop: Categoria -categoria filho --categoria ultimo filho This gives me always the Father, that is, 'Category': <?php $product_cats = wp_...
asked by 05.03.2015 / 20:34
1
answer

Stop accepting data to queue

I need to stop queuing when the user types a negative number (-1), check if the queue is empty so that when typing the negative number does not give any error and the main, I need the user to tell what specific value he #include <iostream&g...
asked by 26.11.2014 / 12:59
1
answer

How to manipulate Labels using a loop

How can I use these labels using a loop, instead of creating 40 lines of code repeated? jLabel1.setIcon(new ImageIcon(getClass().getResource("/cards/"+cards.get(1)+".png"))); jLabel2.setIcon(new ImageIcon(getClass().getResource("/cards/"+cards...
asked by 12.09.2014 / 11:57
2
answers

want to read more than 1 .txt file in C [closed]

I wanted to create multiple .txt files and did this through a loop, and I did. But the only way I can read all the files is by doing another loop, for example: it does a looping of 3 passwords, that is, I created 3 passwords, 3 .txt files, but a...
asked by 03.11.2018 / 03:35
2
answers

Infinite loop on the switch

The problem is that in all three cases, cout repeats infinitely. #include<iostream> using namespace std; #include<locale.h> int main(){ setlocale(LC_ALL, "Portuguese"); bool a; int consumo;...
asked by 15.08.2018 / 22:52