「new」 - クラスのインスタンスつまりオブジェクトを生成する際に利用
「clone」 - オブジェクトのクローン(コピー)を格納する際に利用
<pre>
<?php
class COLOR{
//empty
}
#オブジェクトの生成
var_dump( new COLOR );
#オブジェクトのクローンの生成
$n = new COLOR;
var_dump( clone $n );
?>
</pre>
▼結果
/demo/clone.html
<pre>
<?php
class COLOR{
//empty
}
#オブジェクトの生成
var_dump( new COLOR );
#オブジェクトのクローンの生成
$n = new COLOR;
var_dump( clone $n );
?>
</pre>
順位 | ページタイトル抜粋 | % |
---|---|---|
1 | define と const の違い | 48 |
2 | include | 44 |
3 | Doctrine | 42 |
4 | include require | 38 |
5 | popen | 38 |
6 | Propel | 35 |
7 | include_path | 35 |
8 | syntax error | 35 |
9 | Exceptionクラス | 35 |
10 | SessionHandler::gc | 34 |
11 | json_encode関数 | 33 |
12 | foreach文 | 32 |
13 | session.gc_maxlifetime | 30 |
14 | Composer | 30 |
15 | set_error_handler | 29 |
16 | No route found fo | 29 |
17 | ErrorExceptionクラス | 29 |
18 | Generators | 29 |
19 | setcookie関数 | 27 |
20 | register_shutdown_function | 27 |
2023/6/04 20:29 更新 |