php ã§ã¯ãä¸è¨ã®ããã« static ã使ã£ã¦è¿ãå¤ãè¨æ¶ãã¦ãããã¨ãã§ãã¾ãã <?php function hoge() { static $ret = null; if ($ret !== null) return $ret; /** * * 大ããªãªã½ã¼ã¹ãæ¶è²»ããä½ãè¤éãªå¦çãæ¸ãããã¨ããã * * ï¼ * ï¼ * * ãã ãããã®é¢æ°ãå¼ã°ããã¿ã¤ãã³ã°ãç¶æ ã«ãã£ã¦ãè¿ãå¤ãå¤åããå ´å㯠* ãã®ææ³(ã¡ã¢å)ã¯ä½¿ããªãã * åä¸ããã»ã¹å ã§ä½åº¦å¼ã°ãã¦ãè¿ãå¤ãåä¸ã®å ´åã®ã¿æå¹ã * * ä¾ãã°ããã®é¢æ°å ã§ä¸è¨ã®ããã«ãå®è¡ããæå»ã«ãã£ã¦ * ä½ãå¤åãããå ´åã¯NG * * $mode = 1; * if (date('g') > 10) { * $mode = 2; * } */ $ret = $result; // $result: å¦çããçµæã
{{#tags}}- {{label}}
{{/tags}}