Skip to content

Commit 21c0db0

Browse files
committed
Editing
1 parent 316d824 commit 21c0db0

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

PHP/fizzbuzz.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
echo $i . PHP_EOL;
1212
}
1313
}
14-
?>
14+
?>

codeup_todo_list/todo.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@ function list_items($list) {
1414
$place = '';
1515
// Iterate through list items
1616
foreach ($list as $key => $item) {
17-
// The Ben B method: doing addition first and output second helps the brain split the process
18-
$key++; //$key = $key + 1
19-
$place .= "[" . $key . "]" . " " . $item . PHP_EOL;
17+
$newKey = $key + 1;
18+
$place .= "[" . $newKey . "]" . " " . $item . PHP_EOL;
2019
// Display each item and a newline
2120
}
2221
return $place;
2322
}
2423

2524
// Get STDIN, strip whitespace and newlines,
2625
// and convert to uppercase if $upper is true
27-
function get_input($upper = FALSE) {
26+
function get_input($upper = false) {
2827
// Return filtered STDIN input
2928
if($upper == TRUE) {
3029
return strtoupper(trim(fgets(STDIN)));
@@ -66,7 +65,7 @@ function get_input($upper = FALSE) {
6665
// Get array key
6766
$key = get_input();
6867
// Remove from array
69-
unset($items[--$key]);
68+
unset($items[$key]);
7069
// Adding sort input
7170
} elseif ($input == 'S') {
7271
// Alphabetical or Reverse alphabet?

0 commit comments

Comments
 (0)