@@ -27,11 +27,11 @@ |
||
| 27 | 27 | $length = strlen($text); |
| 28 | 28 | $middle = $length / 2; |
| 29 | 29 | |
| 30 | - if($length % 2 == 0) { |
|
| 31 | - $returnedText = $text[$middle-1]; |
|
| 32 | - $returnedText.= $text[$middle]; |
|
| 30 | + if ($length % 2 == 0) { |
|
| 31 | + $returnedText = $text[$middle - 1]; |
|
| 32 | + $returnedText .= $text[$middle]; |
|
| 33 | 33 | } |
| 34 | - $returnedText.= $text[$middle]; |
|
| 34 | + $returnedText .= $text[$middle]; |
|
| 35 | 35 | return $returnedText; |
| 36 | 36 | |
| 37 | 37 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | for ($counter; $startpeople < $endpeople; $counter++) { |
| 35 | 35 | $startpeople = $startpeople * (1 + $percent / 100) + $aug ; |
| 36 | 36 | } |
| 37 | - return $counter; |
|
| 37 | + return $counter; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // Alternate solution with ternary: |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $counter = 0; |
| 34 | 34 | for ($counter; $startpeople < $endpeople; $counter++) { |
| 35 | - $startpeople = $startpeople * (1 + $percent / 100) + $aug ; |
|
| 35 | + $startpeople = $startpeople * (1 + $percent / 100) + $aug; |
|
| 36 | 36 | } |
| 37 | 37 | return $counter; |
| 38 | 38 | } |
@@ -40,6 +40,6 @@ discard block |
||
| 40 | 40 | // Alternate solution with ternary: |
| 41 | 41 | function nbYear($startpeople, $percent, $aug, $endpeople) |
| 42 | 42 | { |
| 43 | - return $startpeople >= $endpeople ? 0 : 1 + nbYear((int)$startpeople * (1+$percent/100) + $aug, $percent, $aug, $endpeople); |
|
| 43 | + return $startpeople >= $endpeople ? 0 : 1 + nbYear((int) $startpeople * (1 + $percent / 100) + $aug, $percent, $aug, $endpeople); |
|
| 44 | 44 | } |
| 45 | 45 | ?> |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | foreach ($arr as $value) |
| 14 | 14 | { |
| 15 | - if($value > 0) { $sum += $value; |
|
| 15 | + if ($value > 0) { $sum += $value; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | function reverseSeq($varNumber) |
| 9 | 9 | { |
| 10 | 10 | $number = []; |
| 11 | - for($i = $varNumber; $i > 0;$i--) |
|
| 11 | + for ($i = $varNumber; $i > 0; $i--) |
|
| 12 | 12 | { |
| 13 | 13 | array_push($number, $i); |
| 14 | 14 | } |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | function betterThanAverage($classPoints, $yourPoints) |
| 15 | 15 | { |
| 16 | - $average = array_sum($classPoints)/count($classPoints); |
|
| 17 | - if($average < $yourPoints) { return true; |
|
| 16 | + $average = array_sum($classPoints) / count($classPoints); |
|
| 17 | + if ($average < $yourPoints) { return true; |
|
| 18 | 18 | } |
| 19 | 19 | return false; |
| 20 | 20 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | // Alternate solution with ternary operator |
| 23 | 23 | function betterThanAverage($classPoints, $yourPoints) |
| 24 | 24 | { |
| 25 | - return array_sum($classPoints)/count($classPoints) < $yourPoints ? true : false; |
|
| 25 | + return array_sum($classPoints) / count($classPoints) < $yourPoints ? true : false; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // Another solution |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | function Remove_Char(string $string) |
| 7 | 7 | { |
| 8 | 8 | $removeFirst = substr($string, 1); |
| 9 | - $finalString = substr($removeFirst, 0, strlen($removeFirst)-1); |
|
| 9 | + $finalString = substr($removeFirst, 0, strlen($removeFirst) - 1); |
|
| 10 | 10 | return $finalString; |
| 11 | 11 | } |
| 12 | 12 | |
@@ -52,8 +52,8 @@ |
||
| 52 | 52 | ); |
| 53 | 53 | $array_count = count($array); |
| 54 | 54 | $index = 0; |
| 55 | - while ($index < $array_count){ |
|
| 56 | - if($opposite[$array[$index]] == end($stack)) { |
|
| 55 | + while ($index < $array_count) { |
|
| 56 | + if ($opposite[$array[$index]] == end($stack)) { |
|
| 57 | 57 | array_pop($stack); |
| 58 | 58 | } |
| 59 | 59 | array_push($stack, $array[$index]); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | $count = 0; |
| 18 | 18 | $arrCount = count($arr); |
| 19 | - for ($i = 0; $i < $arrCount; $i++) |
|
| 19 | + for ($i = 0; $i < $arrCount; $i++) |
|
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | for ($j = 0; $j < $arrCount; $j++) |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | function solution($number) |
| 11 | 11 | { |
| 12 | 12 | $sum = 0; |
| 13 | - for ( $i = 3; $i < $number; $i++) { |
|
| 13 | + for ($i = 3; $i < $number; $i++) { |
|
| 14 | 14 | |
| 15 | 15 | if ($i % 3 === 0 || $i % 5 === 0) { |
| 16 | 16 | $sum += $i; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | return array_sum( |
| 27 | 27 | array_filter( |
| 28 | - range(1, $number-1), function ($item) { |
|
| 28 | + range(1, $number - 1), function($item) { |
|
| 29 | 29 | return $item % 3 == 0 || $item % 5 == 0; |
| 30 | 30 | } |
| 31 | 31 | ) |