ȥå   Խ ʬ Хåå ź ʣ ̾ѹ   ñ측 ǽ   إ   ǽRSS

PHP

Last-modified: 2013-08-26 () 17:47:02 (1545d)
Top / PHP

PHP: Hypertext Preprocessor

javaȻƤƴְ㤤䤹

ʸϢˤϡ.(ɥå)Ѥ롣

ʸϤ"פȡ'פռƻȤʬ롣

+פˤϢϡͱ黻Ȥʤ롣

㤨С$a = "abc" + 5;פξ硢"abc"ϿͤǤʤΤǣȽǤ졢$aͤϣȤʤ롣

ͤ껻Ƥ⡢ڤΤƤ줺˾Ȥʤ롣

㤨С5/3פͤϡ1.66666666667פȤʤ롣

defineؿѤ롣


   define(FOO, 123);

饹constɤѤ롣


   class Foo 
   {
       public const FOO = 123;
   }
   print("FOO: ".Foo::FOO);

ŪѿŪ᥽åɤθƤӽФˤϡ::פѤ롣


   class Foo 
   {
       public static $foo = "abc";
       public static function funcFoo()
       {
           print("foo!");
       }
   }
   print(Foo::$foo);
   Foo::funcFoo();

ХѿȤ硢globalפεҤɬפȤʤ롣


   function foo()
   {
       global $globalVar;
       $globalVar = "";
   }

֥ȤPHP4PHP5ǻͤ㤦

PHP5javaƱϤǤ
Ϥˤ硢$objectA = clone $objectB;פȤޤ
PHP5ϤǤ
Ϥˤ硢$objectA = &$objectB;פȤޤ

͡PHPѿ󰷤ˤĤƤϼεʬ䤹äǤ
Ϥ-PHPѿ(1)-ȤϤΤΤ

ҤդʤѿϡpublicȤʤ롣

PHP5Ǥϥѿ˥public, protected, privateѤǤޤҤդʤ硢ӡvarղä硢public줿Τȸʤޤ

ʵǽ

`(Хå)Ǥä printȡޥɼ¹Է̤ϤǤ롣

   $cmd = `dir`;~
   print("<pre>".$cmd."<pre>");

̥եPHPץȤɤ߹롣

ؿ̾ư
require꤬ȯ硢
include꤬ȯ硢ٹФơ³
require_onceʤɤ߹requireؿ
include_onceʤɤ߹includeؿ


require(dirname(__FILE__) . "/../foo/foo.php");
// ХѥϤΤ褦˽񤭤ޤ