teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

修正

2019/03/25 08:31

投稿

m.ts10806
m.ts10806

スコア80888

answer CHANGED
@@ -14,7 +14,7 @@
14
14
  return array_key_exists($index,$this->names)? $this->names[$index]:null;
15
15
  }
16
16
 
17
- public function get_names(int $index=null)
17
+ public function sayHi(int $index=null)
18
18
  $name = array_key_exists($index,$this->names)? $this->names[$index]:'No Name';
19
19
  echo "hi, i am {$this->names[$index]}!";
20
20
  }

1

最後手抜きしてしまったので修正。

2019/03/25 08:31

投稿

m.ts10806
m.ts10806

スコア80888

answer CHANGED
@@ -14,7 +14,7 @@
14
14
  return array_key_exists($index,$this->names)? $this->names[$index]:null;
15
15
  }
16
16
 
17
- public function sayHi($index) {
17
+ public function get_names(int $index=null)
18
18
  $name = array_key_exists($index,$this->names)? $this->names[$index]:'No Name';
19
19
  echo "hi, i am {$this->names[$index]}!";
20
20
  }