Might be helpful:
I had to create and "INSERT INTO" on every 50th row:
<?php
$lineBreak = 50;
$tableName = 'user';
$tableFields = 'id, name, password';
?>
in the loop:
<?php
if ($counter === 0 || $counter % $lineBreak === 0) {
echo "INSERT INTO $tableName ($tableFields) VALUES (";
} else {
echo ' (';
}
// add values comma-delimited
if ($counter === 0 || $counter % $lineBreak === 0) {
$insertStmt .= ');';
} else {
$insertStmt .= '),';
}
?>
(in my case I had to check if $no % $o === 0)
MOD
PHP code
<?php
/*
* Makes the value of "result" congruent to "value1" modulo "value2".
* opcode number: 5
*/
echo 6 % 3;
?>
PHP opcodes
Function name: (null)
Compiled variables: none
| line | # | op | fetch | ext | return | operands |
|---|---|---|---|---|---|---|
| 6 | 0 | MOD | ~0 | 6,3 | ||
| 1 | ECHO | ~0 | ||||
| 7 | 2 | RETURN | 1 |
napora dot adam at gmail dot com ¶
11 months ago
shaunny at hotmail dot com ¶
3 years ago
A simple check to see if a number is divisible by another number,
i.e. if a number is even.
<?php
if ($counter % 2) {
echo "This number is not even.";
} else {
echo "This number is even.";
}
?>
