Convert carriage return and line feed to line feed (UNIX line ending).
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
aea0d1a5ec
commit
583f43e1f7
|
@ -1,28 +1,28 @@
|
||||||
class Program {
|
class Program {
|
||||||
private callback $condition = bool(int $x) { return ($x > 100); };
|
private callback $condition = bool(int $x) { return ($x > 100); };
|
||||||
private int[] $numbers = {34, 56, 22, 1, 5, 67, 897, 123, 55, 101};
|
private int[] $numbers = {34, 56, 22, 1, 5, 67, 897, 123, 55, 101};
|
||||||
|
|
||||||
int[] filter(callback $condition, int[] $numbers) {
|
int[] filter(callback $condition, int[] $numbers) {
|
||||||
int $len = sizeof($numbers);
|
int $len = sizeof($numbers);
|
||||||
int[] $filtered;
|
int[] $filtered;
|
||||||
for(int $i = 0; $i < $len; $i++) {
|
for(int $i = 0; $i < $len; $i++) {
|
||||||
if($condition($numbers[$i])) {
|
if($condition($numbers[$i])) {
|
||||||
$filtered[] = $numbers[$i];
|
$filtered[] = $numbers[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $filtered;
|
return $filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
int[] $filtered = $this->filter($this->condition, $this->numbers);
|
int[] $filtered = $this->filter($this->condition, $this->numbers);
|
||||||
var_dump($filtered);
|
var_dump($filtered);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Should output
|
* Should output
|
||||||
|
|
||||||
Array ( [0] => 897 [1] => 123 )
|
Array ( [0] => 897 [1] => 123 )
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,6 +23,6 @@ class Program {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Should output
|
/* Should output
|
||||||
---------------This is some text------------
|
---------------This is some text------------
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
class Operations {
|
class Operations {
|
||||||
|
|
||||||
public callback ops(int $x, int $y, string $op){
|
public callback ops(int $x, int $y, string $op){
|
||||||
switch($op) {
|
switch($op) {
|
||||||
case 'ADD':
|
case 'ADD':
|
||||||
return int() using ($x, $y) {
|
return int() using ($x, $y) {
|
||||||
return $x + $y;
|
return $x + $y;
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 'SUB':
|
case 'SUB':
|
||||||
return int() using ($x, $y) {
|
return int() using ($x, $y) {
|
||||||
return $x - $y;
|
return $x - $y;
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return string() {
|
return string() {
|
||||||
return 'Operation is not supported by class.';
|
return 'Operation is not supported by class.';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Program {
|
class Program {
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
callback $fn;
|
callback $fn;
|
||||||
object $op = new Operations();
|
object $op = new Operations();
|
||||||
$fn = $op->ops(6, 7, 'ADD');
|
$fn = $op->ops(6, 7, 'ADD');
|
||||||
print($fn() + "\n");
|
print($fn() + "\n");
|
||||||
$fn = $op->ops(6, 2, 'SUB');
|
$fn = $op->ops(6, 2, 'SUB');
|
||||||
print($fn() + "\n");
|
print($fn() + "\n");
|
||||||
$fn = $op->ops(6, 7, 'MUL');
|
$fn = $op->ops(6, 7, 'MUL');
|
||||||
print($fn() + "\n");
|
print($fn() + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
class Program {
|
class Program {
|
||||||
|
|
||||||
string cycle(char $a, char $b, int $i = 0) {
|
string cycle(char $a, char $b, int $i = 0) {
|
||||||
static char[] $switches;
|
static char[] $switches;
|
||||||
if($switches[$i])
|
if($switches[$i])
|
||||||
$switches[$i] = !$switches[$i];
|
$switches[$i] = !$switches[$i];
|
||||||
else
|
else
|
||||||
!($switches[$i] = true);
|
!($switches[$i] = true);
|
||||||
return ($switches[$i]) ? $a : $b;
|
return ($switches[$i]) ? $a : $b;
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
int $i, $j, $k;
|
int $i, $j, $k;
|
||||||
for($i = 1; $i < 3; $i++) {
|
for($i = 1; $i < 3; $i++) {
|
||||||
print($i + $this->cycle('a', 'b') + PHP_EOL);
|
print($i + $this->cycle('a', 'b') + PHP_EOL);
|
||||||
for($j = 1; $j < 5; $j++) {
|
for($j = 1; $j < 5; $j++) {
|
||||||
print(' ' + $j + $this->cycle('a', 'b', 1) + PHP_EOL);
|
print(' ' + $j + $this->cycle('a', 'b', 1) + PHP_EOL);
|
||||||
for($k = 1; $k < 3; $k++) {
|
for($k = 1; $k < 3; $k++) {
|
||||||
print(' ' + $k + $this->cycle('c', 'd', 2) + PHP_EOL);
|
print(' ' + $k + $this->cycle('c', 'd', 2) + PHP_EOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue