Skip to content

Instantly share code, notes, and snippets.

@onesword0618
Last active June 11, 2019 16:19
Show Gist options
  • Select an option

  • Save onesword0618/4c92b32dc95968fcad3a71ccfa36f2ec to your computer and use it in GitHub Desktop.

Select an option

Save onesword0618/4c92b32dc95968fcad3a71ccfa36f2ec to your computer and use it in GitHub Desktop.
<?php
$juices = array("apple", "orange", "koolaid1" => "purple");
echo "He drank some $juices[0] juice.".PHP_EOL;
echo "He drank some $juices[1] juice.".PHP_EOL;
echo "He drank some $juices[koolaid1] juice.".PHP_EOL;
class people {
public $john = "John Smith";
public $jane = "Jane Smith";
public $robert = "Robert Paulsen";
public $smiths = "Smiths";
}
$people = new people();
echo "$people->john drank some $juices[0] juice.".PHP_EOL;
echo "$people->john then said hello to $people->jane.".PHP_EOL;
echo "$people->john's wife greeted $people->robert.".PHP_EOL;
echo "$people->robert greeted the two $people->smiths.".PHP_EOL;
?>
@onesword0618
Copy link
Copy Markdown
Author

リファレンスのサンプルコード
動作不良を起こしているのは
https://gist.github.com/onesword0618/4c92b32dc95968fcad3a71ccfa36f2ec#file-juices-php-L13

または、変数の設定値が変だった
https://gist.github.com/onesword0618/4c92b32dc95968fcad3a71ccfa36f2ec#file-juices-php-L21

@onesword0618
Copy link
Copy Markdown
Author

PHP_EOL
は改行コードを表している。
自動で実行環境の改行コードに置換してくれる

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment