<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
		<id>https://wiki.nonip.net/index.php?action=history&amp;feed=atom&amp;title=Php%2Fphp5%E3%82%AF%E3%83%A9%E3%82%B9%E3%83%A1%E3%83%A2</id>
		<title>Php/php5クラスメモ - 変更履歴</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.nonip.net/index.php?action=history&amp;feed=atom&amp;title=Php%2Fphp5%E3%82%AF%E3%83%A9%E3%82%B9%E3%83%A1%E3%83%A2"/>
		<link rel="alternate" type="text/html" href="https://wiki.nonip.net/index.php?title=Php/php5%E3%82%AF%E3%83%A9%E3%82%B9%E3%83%A1%E3%83%A2&amp;action=history"/>
		<updated>2026-04-24T15:52:39Z</updated>
		<subtitle>このウィキのこのページに関する変更履歴</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>https://wiki.nonip.net/index.php?title=Php/php5%E3%82%AF%E3%83%A9%E3%82%B9%E3%83%A1%E3%83%A2&amp;diff=240&amp;oldid=prev</id>
		<title>127.0.0.1: ページの作成:「==__callメソッドの引数== 未定義のメソッドにアクセスがあった場合、__callが呼ばれる  __call($name, $args){} $nameはメソッド名,$argsは...」</title>
		<link rel="alternate" type="text/html" href="https://wiki.nonip.net/index.php?title=Php/php5%E3%82%AF%E3%83%A9%E3%82%B9%E3%83%A1%E3%83%A2&amp;diff=240&amp;oldid=prev"/>
				<updated>2015-05-19T18:09:12Z</updated>
		
		<summary type="html">&lt;p&gt;ページの作成:「==__callメソッドの引数== 未定義のメソッドにアクセスがあった場合、__callが呼ばれる  __call($name, $args){} $nameはメソッド名,$argsは...」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==__callメソッドの引数==&lt;br /&gt;
未定義のメソッドにアクセスがあった場合、__callが呼ばれる&lt;br /&gt;
 __call($name, $args){}&lt;br /&gt;
$nameはメソッド名,$argsは引数の連想配列&lt;br /&gt;
&lt;br /&gt;
==Singletonパターン==&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 /**&lt;br /&gt;
  * Singletonパンターン&lt;br /&gt;
  *&lt;br /&gt;
  * @ex&lt;br /&gt;
  * $obj = Singleton::getInstance();&lt;br /&gt;
  * $obj-&amp;gt;setName(&amp;quot;test&amp;quot;);&lt;br /&gt;
  * echo $obj-&amp;gt;getName();&lt;br /&gt;
  */&lt;br /&gt;
 class Singleton {&lt;br /&gt;
     private static $_singleton;&lt;br /&gt;
     private $_name;&lt;br /&gt;
     private function __construct() {&lt;br /&gt;
     }&lt;br /&gt;
     public static function getInstance() {&lt;br /&gt;
         if (!is_object(self::$_singleton)) {&lt;br /&gt;
             self::$_singleton = new Singleton();&lt;br /&gt;
         }&lt;br /&gt;
         return self::$_singleton;&lt;br /&gt;
     }&lt;br /&gt;
     public function setName($name) {&lt;br /&gt;
         $this-&amp;gt;_name = $name;&lt;br /&gt;
     }&lt;br /&gt;
     public function getName() {&lt;br /&gt;
         return $this-&amp;gt;_name;&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==ライブラリをクラスで作る時はPSR-0を従う==&lt;br /&gt;
 http://d.hatena.ne.jp/hnw/20101006&lt;br /&gt;
&lt;br /&gt;
==インターフェイスを使う==&lt;br /&gt;
*index.php&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 require_once 'SampleLogic.php';&lt;br /&gt;
 $logic = new SampleLogic();&lt;br /&gt;
 $logic-&amp;gt;execLogic();&lt;br /&gt;
&lt;br /&gt;
*SampleLogic.php&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 require_once 'InterfaceLogic.php';&lt;br /&gt;
 class SampleLogic implements InterfaceLogic&lt;br /&gt;
 {&lt;br /&gt;
   public function execLogic()&lt;br /&gt;
   {&lt;br /&gt;
     echo &amp;quot;exec&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
*InterFaceLogic.php&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 interface InterfaceLogic&lt;br /&gt;
 {&lt;br /&gt;
   public function execLogic();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==namespace例(php ver5.3から==&lt;br /&gt;
*animal.php&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 namespace animal;&lt;br /&gt;
 class Dog&lt;br /&gt;
 {&lt;br /&gt;
   static public function call()&lt;br /&gt;
   {&lt;br /&gt;
      print &amp;quot;wan&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
*main.php&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 namespace main;&lt;br /&gt;
 require_once 'animal.php';&lt;br /&gt;
 use animal;&lt;br /&gt;
 echo \animal\Dog::call();  // wan&lt;/div&gt;</summary>
		<author><name>127.0.0.1</name></author>	</entry>

	</feed>