Last active
February 27, 2017 16:45
-
-
Save raplas/3268916da02ce00b259b20c1cb7bff02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Introduce { | |
private $arraylist = array(); | |
public function regist($num) { | |
$this->arraylist[] = $num; | |
} | |
public function show() { | |
for ($i=0; $i<count($this->arraylist); $i++) { | |
if ($i%2 == 0) { | |
echo $this->arraylist[$i][0] . ":" . $this->arraylist[$i][1] . "\n"; | |
} | |
else { | |
echo "奇数は出力しません。\n"; | |
} | |
} | |
} | |
} | |
$obj = new Introduce(); | |
$obj->regist(array("鈴木","熊本出身です。")); | |
$obj->regist(array("佐藤","東京出身です。")); | |
$obj->regist(array("工藤","宮崎出身です。")); | |
$obj->regist(array("宮本","愛知出身です。")); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("0228class.php"); | |
public function main(){ | |
print $obj->show(); | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment