PHP 2
, , .
, ,
.
, PHP
, construct.
. ?
-. , ,
, - (- ,
, - ). , -
. .
-
, .. .
, ,
, , ,
. ,
. , unset(). ,
,
, - ,
.
, .
. PHP ,
destruct (__destruct):
8 | function __construct( $number ){ |
13 | function __destruct(){ |
19 | echo "<p>Name: " . $this ->name. "<br>" ; |
20 | echo "Login: " . $this ->login. "<br>" ; |
21 | echo "Password: " . $this ->password. "<br>" ; |
26 | $user1 ->name = "Vasya" ; |
27 | $user1 ->login = "vas" ; |
28 | $user1 ->password = 123; |
33 | $user2 ->name = "Petya" ; |
34 | $user2 ->login = "pet" ; |
35 | $user2 ->password = 321; |
40 | $user3 ->name = "Vova" ; |
41 | $user3 ->login = "vov" ; |
42 | $user3 ->password = 456; |
, , ,
, -
. -
- " !".
, ,
! -
, .
. ,
. -
, ,
.
, ,
:
- Users ;
- name, login, password;
- , Users;
:
8 | function __construct( $name , $login , $password ){ |
10 | $this ->login = $login ; |
11 | $this ->password = $password ; |
16 | echo "<p>Name: " . $this ->name. "<br>" ; |
17 | echo "Login: " . $this ->login. "<br>" ; |
18 | echo "Password: " . $this ->password. "<br>" ; |
22 | $user1 = new Users( "Vasya" , "vas" , "123" ); |
26 | $user2 = new Users( "Petya" , "pet" , "321" ); |
30 | $user3 = new Users( "Vova" , "vov" , "456" ); |
4 PHP, ,
. , .
, ,
Users, Users
(function Users(){}). .
-
, .
? : $object2 = $object1.
, , ? , ?
. ? ,
PHP - 4 5. 4 PHP
. 2 - 1.
, - $object2 =
&$object1. - ?
, , windows -
. . ,
. 4
PHP.
5 ? $object2 =
$object1 . ,
? clone:
$object2 = clone $object1.
, ,
.
, - .
8 | function __construct( $name , $login , $password ){ |
10 | $this ->login = $login ; |
11 | $this ->password = $password ; |
21 | echo "<p>Name: " . $this ->name. "<br>" ; |
22 | echo "Login: " . $this ->login. "<br>" ; |
23 | echo "Password: " . $this ->password. "<br>" ; |
27 | $user1 = new Users( "Vasya" , "vas" , "123" ); |
31 | $user2 = new Users( "Petya" , "pet" , "321" ); |
35 | $user3 = new Users( "Vova" , "vov" , "456" ); |
:
- Users __clone();
- __clone ;
- : name = "User", login = "User", password = "qwerty";
- , ;
:
8 | function __construct( $name , $login , $password ){ |
10 | $this ->login = $login ; |
11 | $this ->password = $password ; |
17 | $this ->login = "User" ; |
18 | $this ->password = "qwerty" ; |
23 | echo "<p>Name: " . $this ->name. "<br>" ; |
24 | echo "Login: " . $this ->login. "<br>" ; |
25 | echo "Password: " . $this ->password. "<br>" ; |
29 | $user1 = new Users( "Vasya" , "vas" , "123" ); |
33 | $user2 = new Users( "Petya" , "pet" , "321" ); |
37 | $user3 = new Users( "Vova" , "vov" , "456" ); |
, , Sequence diagram - - , . .
| | 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _. 10.11.2021 - 12:36: - Conscience -> . ? - _. 10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _. 10.11.2021 - 12:35: - Ecology -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> . - _. 10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _. 10.11.2021 - 09:18: - New Technologies -> , 5G- - _. 10.11.2021 - 09:18: - Ecology -> - _. 10.11.2021 - 09:16: - Ecology -> - _. 10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _. 10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
|