LoginSignup
1
0

More than 5 years have passed since last update.

PHP_Cording_20180709

Posted at

三日坊主にならないように

PHPのコメントアウトはCやC++と同じ。

comment_sample.php
<?php
    echo 'テスト1'; //コメント1
    /* 複数行のコメント
    複数行のコメント */
    echo 'テスト2'; #コメント1
?>

連想配列から値を取り出す。

array_sample.php
//連想配列
$num = array(
  array('alpha' => 'A', 'number' => 1),
  array('alpha' => 'B', 'number' => 2),
  array('alpha' => 'C', 'number' => 3)
);

foreach($num as $samp){
    foreach($samp as $samp2){
        echo $samp2 //'A'、1、'B'、2、'C'、3の順で表示される
    }
}

1.初めのforeachでは$numのarrayを取り出す。
2.2番目のforeachでは上記arrayの中のarrayを3つ順番に取り出す。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0