We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f279967 commit dbdafb5Copy full SHA for dbdafb5
1_2.php
@@ -0,0 +1,16 @@
1
+#!/usr/bin/php
2
+<?php
3
+error_reporting( -1 );
4
+$file = trim( file_get_contents( '1_1.in' ) );
5
+$len = strlen( $file );
6
+$step = $len / 2;
7
+$sum = 0;
8
+$i = 0;
9
+for ( $j = 0; $j < $len; $j++ ) {
10
+ $c1 = $file[$i];
11
+ $k = ( $i + $step ) % $len;
12
+ $c2 = $file[$k];
13
+ $i++;
14
+ if ( $c1 == $c2 ) $sum += $c1;
15
+}
16
+echo "sum: $sum\n";
foo
@@ -0,0 +1,12 @@
+/* Recursion via a self-yielding generator.
+ *
+ * Crashes all currently supported PHP versions that support generator delegation (7.0, 7.1).
+ * A generator delegating to itself, causing a recursion.
+ */
+function a()
+{
+ yield from a();
+foreach(a() as $v);
0 commit comments