Index: phpdoc/pl/Translators
diff -u phpdoc/pl/Translators:1.2 phpdoc/pl/Translators:1.3
--- phpdoc/pl/Translators:1.2 Tue Oct 23 12:12:40 2001
+++ phpdoc/pl/Translators Tue Oct 30 07:31:01 2001
@@ -2,6 +2,7 @@
Polish PHP Documentation Translation Team Member List (PPDTTML? :)
DomBal Marcin Dąbrowski dombal <email protected>
+kurtz Wojciech Jukowski wojtek <email protected>
Leon Leszek Krupiński leszek <email protected>
Yagood Paweł Paprota yagood <email protected>
slawek Sławomir Pucia slawek <email protected>
@@ -58,7 +59,7 @@
aspell.xml
bc.xml
bzip2.xml
-calendar.xml
+calendar.xml kurtz started 1.15
ccvs.xml
classobj.xml
com.xml
@@ -67,13 +68,13 @@
curl.xml
cybercash.xml
cybermut.xml
-datetime.xml
+datetime.xml kurtz started 1.49
dba.xml
dbase.xml
dbm.xml
dbplus.xml
dbx.xml
-dir.xml
+dir.xml kurtz started 1.21
domxml.xml
errorfunc.xml
exec.xml
@@ -85,7 +86,7 @@
funchand.xml
gettext.xml
gmp.xml
-http.xml Qrak done ?.??
+http.xml Qrak done 1.28
hw.xml
ibase.xml
icap.xml
@@ -99,7 +100,7 @@
java.xml
ldap.xml
mail.xml Qrak done 1.29
-math.xml Qrak started ?.??
+math.xml Qrak started 1.55
mbstring.xml
mcal.xml
mcrypt.xml
@@ -131,11 +132,11 @@
satellite.xml
sem.xml
sesam.xml
-session.xml
+session.xml leon started 1.53
shmop.xml
snmp.xml
sockets.xml
-strings.xml
+strings.xml kurtz started 1.117
swf.xml
sybase.xml
uodbc.xml
@@ -153,7 +154,7 @@
control-structures.xml
expressions.xml Leon done 1.14
functions.xml Leon done 1.17
-oop.xml Leon started 1.28
+oop.xml Leon done 1.28
operators.xml Qrak started 1.27
references.xml
types.xml
Index: phpdoc/pl/bookinfo.xml
diff -u phpdoc/pl/bookinfo.xml:1.2 phpdoc/pl/bookinfo.xml:1.3
--- phpdoc/pl/bookinfo.xml:1.2 Tue Oct 23 12:15:00 2001
+++ phpdoc/pl/bookinfo.xml Tue Oct 30 07:31:01 2001
@@ -1,5 +1,5 @@
-
+
@@ -62,9 +62,6 @@
Marcin Dąbrowski
-
-
- Paweł Paprota
Index: phpdoc/pl/language-snippets.ent
diff -u phpdoc/pl/language-snippets.ent:1.1 phpdoc/pl/language-snippets.ent:1.2
--- phpdoc/pl/language-snippets.ent:1.1 Tue Oct 23 07:19:35 2001
+++ phpdoc/pl/language-snippets.ent Tue Oct 30 07:31:02 2001
@@ -1,7 +1,7 @@
-
+
Ten moduł jest w stadium EKSPERYMENTALNYM. Oznacza to, że zachowanie tych funkcji, ich nazwy, w zasadzie WSZYSTKO udokumentowane tutaj może zostać zmienione w przyszłych wersjach PHP BEZ WCZEŚNIEJSZEGO UPRZEDZENIA. Używaj tego modułu na własne ryzyko.'>
-Ta funkcja jest w stadium EKSPERYMENTALNYM. Oznacza to, że zachowanie teh funkcji, jej nazwa, w zasadzie wszystko udokumentowane tutaj może zostać zmienione w przyszłych wersjach PHP BEZ WCZEŚNIEJSZEGO UPRZEDZENIA. Używaj tej funkcji na własne ryzyko.'>
+Ta funkcja jest w stadium EKSPERYMENTALNYM. Oznacza to, że zachowanie funkcji, jej nazwa, w zasadzie wszystko udokumentowane tutaj może zostać zmienione w przyszłych wersjach PHP BEZ WCZEŚNIEJSZEGO UPRZEDZENIA. Używaj tej funkcji na własne ryzyko.'>
Ze wszystkim, co wysyła dane bezpośrednio do przeglądarki, możesz używać funkcji kontroli wyjścia aby przejąć wyjście tej funkcji i zapisać je - na przykład - w zmiennej tekstowej.'>
Index: phpdoc/pl/functions/mysql.xml
diff -u phpdoc/pl/functions/mysql.xml:1.1 phpdoc/pl/functions/mysql.xml:1.2
--- phpdoc/pl/functions/mysql.xml:1.1 Tue Oct 23 07:19:36 2001
+++ phpdoc/pl/functions/mysql.xml Tue Oct 30 07:31:02 2001
@@ -1,5 +1,5 @@
-
+
Funkcje MySQLMySQL
@@ -1760,8 +1760,8 @@
- mysql_query zwraca &true; (nie-zero) lub &false;
- informując czy zapytanie zakończyło się sukcesem lub też nie.
+ mysql_query zwraca &true; lub &false;
+ informując czy zapytanie zakończyło się sukcesem czy też nie.
Zwrócona wartość &true; oznacza, że zapytanie było prawidłowe i
może być wykonane przez serwer. Nie mówi natomiast nic o liczbie
przetworzonych lub zwróconych wierszy. Jest również możliwe, że
Index: phpdoc/pl/language/constants.xml
diff -u phpdoc/pl/language/constants.xml:1.1 phpdoc/pl/language/constants.xml:1.2
--- phpdoc/pl/language/constants.xml:1.1 Tue Oct 23 07:19:37 2001
+++ phpdoc/pl/language/constants.xml Tue Oct 30 07:31:02 2001
@@ -1,244 +1,244 @@
-
-
+
+
- Constants
+ Stałe
- A constant is a identifier (name) for a simple value. As the name
- suggests, that value cannot change during the execution of the script
- (the magic constants __FILE__ and
- __LINE__ are the only exception). A constant
- is case-sensitive by default. By convention constants are always
- uppercase.
+ Stała jest identyfikatorem (nazwą) dla prostej wartości. Jak sama
+ nazwa wskazuje, wartość ta nie może się zmieniać podczas działania
+ skryptu (poza wyjątkami: __FILE__
+ i __LINE__). Domyślnie, przy stałych
+ uwzględniana jest wielkość liter. Przyjęto, że stałe są pisane dużymi
+ literami.
- The name of a constant follows the same rules as any label in PHP. A
- valid constant name starts with a letter or underscore, followed
- by any number of letters, numbers, or underscores. As a regular
- expression, it would be expressed thus:
+ Nazwa stałej podlega takim samym zasadom jak każda inna w PHP.
+ Prawidłowa nazwa stałej rozpoczyna się literą, znakiem podkreślenia
+ ("_"), następnie mogą występować litery, cyfry lub znaki podkreślenia.
+ Dobrze reprezentuje to takie wyrażenie regularne:
[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
-
+
- For our purposes here, a letter is a-z, A-Z, and the ASCII
- characters from 127 through 255 (0x7f-0xff).
+ Na nasze potrzeby, litery to a-z, A-Z, oraz znaki ASCII
+ od 127 do 255 (0x7f-0xff).
- The scope of a constant is global.
+ Zakres stałej jest globalny.
- Syntax
+ Składnia
- You can define a constant by using the
- define-function. Once a constant is defined,
- it can never be changed or undefined.
+ Możesz definiować stałą używając funkcji define.
+ Kiedy stała zostanie zdefiniowana, nie może być już zmieniona albo
+ undefined.
- Only scalar data (boolean, integer,
- double and string) can be contained
- in constants.
+ Tylko skalarne typy danych
+ (boolean, integer, double
+ i string) mogą być zawarte w stałych.
- You can get the value of a constant by simply specifying its name.
- Unlike with variables, you should not prepend
- a constant with a $.
- You can also use the function constant, to
- read a constant's value, if you are to obtain the constant's name
- dynamically.
- Use get_defined_constants to get a list of
- all defined constants.
+ Możesz użyć wartości stałej poprzez zwykłe użycie jej nazwy.
+ Inaczej niż przy zmiennych, w stałych NIE
+ powinieneś prepend stałej znakiem $.
+ Możesz także użyć funkcji constant, aby
+ odczytać wartość stałej, której nazwa jest przekazywana dynamicznie.
+ Użyj funkcji get_defined_constants aby otrzymać
+ listę zdefiniowanych stałych.
- Constants and (global) variables are in a different namespace.
- This implies that for example &true; and
- $TRUE are generally different.
+ Stałe i globlane zmienne są pisane inaczej, a to oznacza, że np.
+ &true; i $TRUE są różne.
- If you use an undefined constant, PHP assumes that you mean
- the name of the constant itself. A
- notice will be issued
- when this happens. Use the defined-function if
- you want to know if a constant is set.
+ Jeśli użyjesz niezdefiniowanej stałej, PHP przyjmuje, że chcesz użyć
+ nazwy stałej samej w sobie. Zostanie wtedy wysłane
+ ostrzeżenie.
+ Użyj funkcji defined jeśli chcesz się dowiedzieć
+ czy stała jest zdefiniowana.
- This are the differences with variables:
+ Różnice pomiędzy stałymi, a zmiennymi:
- Constants do not have a dollar sign ($) before them;
+ Stałe nie mają znaku dolara ($) przed nazwą;
- Constants may be defined and accessed anywhere without regard to variable
- scoping rules;
+ Stałe mogą być definiowane oraz używane wszędzie bez zważania na
+ zasady dotyczące zakresu ich dostępności;
- Constants may not be redefined or undefined once they have
- been set; and
+ Stałe nie mogą być redefiniowane lub undefined po tym jak raz zostały
+ zdefiniowane; i
- Constants may only evaluate to scalar values.
+ Stałe mogą zawierać tylko wartości skalarne.
-
+
- Defining Constants
+ Definiowanie stałych
<?php
-define("CONSTANT", "Hello world.");
-echo CONSTANT; // outputs "Hello world."
-echo Constant; // outputs "Constant" and issues a notice.
+define("STALA", "Hello world!");
+echo STALA; // wyświetli "Hello world!"
+echo Stala; // wyświetli "Stala" i zgłosi ostrzeżenie
?>
-
+
-
+
- Predefined constants
+ Predefiniowane stałe
- The predefined constants (always available) are:
+ Predefiniowanymi stałymi (zawsze dostępnymi) są:
- __FILE__ (case-insensitive)
+ __FILE__ (nieważna wielkość liter)
- The name of the script file presently being parsed. If used
- within a file which has been included or required, then the
- name of the included file is given, and not the name of the
- parent file.
+ Nazwa pliku ze skryptem PHP, który jest aktualnie parsowany
+ (przetwarzany); stała użyta w pliku, który został, który został
+ włączony (include) lub jest wymagany (require), zwraca nazwę
+ tego właśnie pliku, a nie nazwę pliku głównego.
-
+
- __LINE__ (case-insensitive)
+ __LINE__ (nieważna wielkość liter)
- The number of the line within the current script file which is
- being parsed. If used within a file which has been included or
- required, then the position within the included file is given.
+ Numer linii w pliku, który jest aktualnie parsowany (przetwarzany).
+ Stała użyta w pliku włączonym (include) zwraca pozycję w tym pliku.
-
+
PHP_VERSION
- The string representation of the version of the PHP parser
- presently in use; e.g. '4.0.7-dev'.
+ Łańcuch reprezentujący aktualnie używaną wersję parsera PHP, np.
+ '4.0.7-dev'.
-
+
PHP_OS
- The name of the operating system on which the PHP parser is
- executing;. Possible values may be :
+ Nazwa systemu operacyjnego, na którym uruchomiony jest parser
+ PHP. Możliwe wartości to:
"AIX", "Darwin" (MacOS), "Linux", "SunOS", "WIN32", "WINNT".
- Note: other values may be available too.
+ Uwaga: inne wartości również mogą być dostępne.
-
+
- &true; (case-insensitive)
+ &true; (nieważna wielkość liter)
- A &true; value (see the boolean type).
+ Wartość &true; (zobacz: typ boolean).
-
+
- &false; (case-insensitive)
+ &false; (nieważna wielkość liter)
- A &false; value (see the boolean type).
+ Wartość &false; (zobacz: typboolean).
-
+
- &null; (case-insensitive)
+ &null; (nieważna wielkość liter)
- A &null; value (see the null type).
+ Wartość &null; (zobacz: typ null).
-
+
E_ERROR
- Denotes an error other than a parsing error from which
- recovery is not possible.
+ Oznacza błąd inny niż błąd przy parsowaniu (przetwarzaniu),
+ którego naprawienie nie jest możliwe.
-
+
E_WARNING
- Denotes a condition where PHP knows something is wrong, but
- will continue anyway; these can be caught by the script
- itself. An example would be an invalid regexp in
+ Oznacza stan, w którym PHP "wie", że coś jest źle, ale
+ kontynuuje działanie; błędy takie mogą być przechwycone przez sam
+ skrypt.
+ Przykładem może być nieprawidłowe wyrażenie regularne w funkcji
ereg.
-
+
E_PARSE
- The parser choked on invalid syntax in the script
- file. Recovery is not possible.
+ Parser stanął przy nieprawidłowej składni w skrypcie. Naprawa
+ błędu i kontynuacja nie jest możliwa.
-
+
E_NOTICE
- Something happened which may or may not be an error. Execution
- continues. Examples include using an unquoted string as an array
- index, or accessing a variable which has not been set.
+ Zdarzyło się coś co może acz nie musi być błędem. PHP kontynuuje
+ działanie. Przykładem może być używanie niepodanego łańcucha jako
+ indeksu w tablicy albo żadanie dostępu do niezadeklarowanej
+ zmiennej.
-
+
E_ALL
- All of the E_* constants rolled into one. If used with
- error_reporting, will cause any and all
- problems noticed by PHP to be reported.
+ Wszystkie stałe E_* w jednej. Jeśli stała ta zostanie użyta z
+ funkcją error_reporting, spowoduje to, że
+ jakiekolwiek problemy zauważone przez PHP będą zgłaszane przez
+ funkcję.
@@ -247,28 +247,28 @@
- The E_* constants are typically used with the
- error_reporting function for setting the
- error reporting level. See all these constants at
- Error handling.
+ Stałe E_* są zwykle używane z funkcją
+ error_reporting aby ustawić poziom zgłaszania
+ błędów. Zobacz wszystkie takie stałe w rozdziale
+ Obsługa błędów.
- Using __FILE__ and __LINE__
+ Używanie __FILE__ i __LINE__
<?php
-function report_error($file, $line, $message)
+function report_error($plik, $linia, $komunikat)
{
- echo "An error occured in $file on line $line: $message.";
+ echo "Wystąpił błąd w $plik w linii $linia: $message.";
}
-report_error(__FILE__, __LINE__, "Something went wrong!");
+report_error(__FILE__, __LINE__, "Coś poszło źle!");
?>
-
+
+
Klasy i Obiekty
@@ -108,13 +108,11 @@
-
- Classes are types, that is, they are blueprints for actual
- variables. You have to create a variable of the desired type with
- the new operator.
+ Klasy są typami, które są w zasadzie tylko schematami dla właściwych
+ zmiennych. Zmienne pożądanego typu musisz stworzyć korzystając z operatora
+ new.
-
@@ -134,50 +132,45 @@
- Both, $cart and $another_cart, have functions add_item(),
- remove_item() and a variable items. These are distinct
- functions and variables. You can think of the objects as
- something similar to directories in a filesystem. In a
- filesystem you can have two different files README.TXT, as
- long as they are in different directories. Just like with
- directories where you'll have to type the full pathname in
- order to reach each file from the toplevel directory, you
- have to specify the complete name of the function you want
- to call: In PHP terms, the toplevel directory would be the
- global namespace, and the pathname separator would be ->.
- Thus, the names $cart->items and $another_cart->items
- name two different variables. Note that the variable is
- named $cart->items, not $cart->$items, that is, a
- variable name in PHP has only a single dollar sign.
+ I $koszyk i $inny_koszyk mają funkcje dodaj_produkt(), usun_produkt() i
+ zmienne. Są to osobne funkcje i zmienne. Obiekty mogą być postrzegane jako
+ katalogi w systemie plików. W systemie plików możesz mieć dwa różne pliki
+ README.TXT, ale tylko jeśli istnieją w osobnych katalogach. Aby odczytać
+ plik, będąc w głównym katalogu, musisz podać pełną ścieżkę do tego pliku.
+ Tak samo jest przy obiektach: musisz podać pełną nazwę funkcji, z której
+ chcesz skorzystać. W terminologii PHP katalogiem głównym będzie globalna
+ przestrzeń nazw a separatorem ścieżki będzie ->. W związku z tym nazwy
+ $koszyk i $inny_koszyk zawierają zupełnie inne zmienne. Zauważ, że zmienna
+ nazywa się $koszyk->artykuly, a nie $koszyk->$artykuly, ponieważ
+ nazwa zmiennej może zawierać tylko jeden znak dolara.
-// correct, single $
-$cart->items = array("10" => 1);
+// poprawnie, jeden $
+$koszyk->artykuly = array("10" => 1);
-// invalid, because $cart->$items becomes $cart->""
-$cart->$items = array("10" => 1);
+// niepoprawnie, poniważ $koszyk->$artykuly zamienia się na $koszyk->""
+$koszyk->$artykuly = array("10" => 1);
-// correct, but may or may not be what was intended:
-// $cart->$myvar becomes $cart->items
-$myvar = 'items';
-$cart->$myvar = array("10" => 1);
+// poprawnie, ale może (ale nie musi) nie być tym, co zamierzaliśmy:
+// $koszyk->$zmienna staje się $koszyk->artykuly
+$zmienna = 'artykuly';
+$koszyk->$zmienna = array("10" => 1);
- Within a class definition, you do not know under which name the object will
- be accessible in your program: At the time the Cart class was
- written, it was unknown that the object will be named $cart or
- $another_cart later. Thus, you cannot write $cart->items within
- the Cart class itself. Instead, in order to be able to access it's own
- functions and variables from within a class, one can use the
- pseudo-variable $this which can be read as 'my own' or
- 'current object'. Thus, '$this->items[$artnr] += $num' can
- be read as 'add $num to the $artnr counter of my own items
- array' or 'add $num to the $artnr counter of the items array
- within the current object'.
+ Wewnątrz definicji klasy, nie wiesz pod jaką nazwą obiekt będzie dostępny
+ dla twojego programu: w momencie pisania klasy Koszyk, nie było wiadomo,
+ że obiekty będą się nazywać $koszyk lub $inny_koszyk. W związku z tym nie
+ możesz napisać $koszyk->artykuly wewnątrz klasy Koszyk. Zamiast tego,
+ aby uzyskać dostęp do funkcji i zmiennych zawartych w klasie, można użyć
+ pseudo-zmiennej $this, która może być odczytana jako 'moje własne' lub
+ 'bieżący obiekt'. A więc '$this->artykuly[$nrart] += $liczba' może być
+ odczytane jako 'dodaj $liczba do licznika $nrart z mojej własnej tablicy
+ artykuly' lub 'dodaj $liczba do licznika $nrartz tablicy artykuly zawartej
+ w bieżącym obiekcie'.
@@ -185,123 +178,122 @@
extends
- Often you need classes with similar variables and functions
- to another existing class. In fact, it is good practice to
- define a generic class which can be used in all your
- projects and adapt this class for the needs of each of your
- specific projects. To facilitate this, classes can be
- extensions of other classes. The extended or derived class
- has all variables and functions of the base class (this is
- called 'inheritance' despite the fact that nobody died) and what
- you add in the extended definition. It is not possible to
- substract from a class, that is, to undefine any existing
- functions or variables. An extended class is always dependent
- on a single base class, that is, multiple inheritance is
- not supported. Classes are extended using the keyword 'extends'.
+ Bardzo często zachodzi potrzeba stworzenia klasy o funkcjach i zmiennych
+ podobnych do już istniejącej klasy. Zasadniczo dobrze jest stworzyć
+ szablonową klasę, która może być użyta we wszystkich twoich projektach i
+ przystosowywać ją do specyficznych potrzeb twojego projektu. Aby ułatwić
+ ten proces, klasy mogą być rozszerzeniami innych klas. Rozszerzone, lub
+ mówiąc inaczej 'dziedziczone', klasy mają wszystkie zmienne i funkcje
+ klasy podstawowej (nazywa się to dziedziczeniem, mimo że nikt nie
+ umarł) oraz to co do niej dodałeś w definicji rozszerzenia. Nie można
+ odjąć pewnych rzeczy z klasy podstawowej, czyli oddefiniować istniejących
+ w klasie podstawowej funkcji i zmiennych. Rozszerzona klasa jest zawsze
+ zależna od jednej klasy bazowej - dziedziczenie wielokrotne nie jest
+ obsługiwane. Klasy można rozszerzyć używając słowa kluczowego 'extends'.
-class Named_Cart extends Cart
+class Nazwany_Koszyk extends Koszyk
{
- var $owner;
+ var $wlasciciel;
- function set_owner ($name)
+ function ustaw_wlasciciela ($nazwa)
{
- $this->owner = $name;
+ $this->wlasciciel = $nazwa;
}
}
- This defines a class Named_Cart that has all variables and
- functions of Cart plus an additional variable $owner and an
- additional function set_owner(). You create a named cart the usual
- way and can now set and get the carts owner. You can still use
- normal cart functions on named carts:
+ Definiuje to klasę Nazwany_Koszyk, który ma wszystkie zmienne i funkcje
+ klasy Koszyk plus dodatkowa zmienna $wlasciciel i dodatkowa funkcja
+ ustaw_wlasciciela(). Nazwany koszyk tworzy się normalnym sposobem.
+ Możesz teraz ustawiać i pobierać nazwę właściciela koszyka. Cały czas
+ możesz używać zwykłych funkcji koszyka dla nazwanego koszyka:
-$ncart = new Named_Cart; // Create a named cart
-$ncart->set_owner("kris"); // Name that cart
-print $ncart->owner; // print the cart owners name
-$ncart->add_item("10", 1); // (inherited functionality from cart)
+$nkoszyk = new Nazwany_Koszyk; // Stwórz nazwany koszyk
+$nkoszyk->ustaw_wlasciciela("kris"); // Nazwij koszyk
+print $nkoszyk->wlasciciel; // Wyświetl właściciela koszyka
+$nkoszyk->dodaj_przedmiot("10", 1); // (funkcjonalność odziedziczona z
+ // koszyka)
- Constructors
+ Konstruktory
- In PHP 3 and PHP 4 constructors behave differently. The PHP 4
- semantics are strongly preferred.
+ Konstruktory zachowują się inaczej w PHP 3 i w PHP 4. Semantyka PHP 4
+ jest mocno zalecana.
- Constructors are functions in a class that are automatically
- called when you create a new instance of a class with
- new. In PHP 3, a
- function becomes a constructor when it has the same name as
- the class. In PHP 4, a function becomes a constructor, when
- it has the same name as the class it is defined in - the
- difference is subtle, but crucial (see below).
+ Konstruktory są funkcjami klasy, które są automatycznie wywoływane przy
+ tworzeniu nowej instancji klasy korzystając z operatora
+ new. W PHP 3 funkcja staje się konstruktorem kiedy ma
+ taką samą nazwę jak klasa. W PHP 4 funkcja staje się konstruktorem, kiedy
+ ma taką samą nazwę jak klasa, w której ta funkcja została zdefiniowana -
+ różnica jest subtelna, ale bardzo ważna (zobacz poniżej)
-// Works in PHP 3 and PHP 4.
-class Auto_Cart extends Cart
+// Działa w PHP 3 i PHP 4.
+class Auto_Koszyk extends Koszyk
{
- function Auto_Cart()
+ function Auto_Koszyk()
{
- $this->add_item ("10", 1);
+ $this->dodaj_artykul ("10", 1);
}
}
- This defines a class Auto_Cart that is a Cart plus a constructor
- which initializes the cart with one item of article number "10"
- each time a new Auto_Cart is being made with "new". Constructors
- can take arguments and these arguments can be optional, which
- makes them much more useful. To be able to still use the class
- without parameters, all parameters to constructors should be
- made optional by providing default values.
+ Ten kod definiuję klasę Auto_Koszyk, który jest klasą Koszyk pluc
+ konstruktor, który inicjalizuje wózek z jednym artykułem "10" za każdym
+ razem, kiedy Auto_Koszyk jest tworzony operatorem "new". Konstruktory mogą
+ pobierać argumenty i te argumenty mogą być opcjonalne, przez co są jeszcze
+ bardziej użyteczne. Aby w dalszym ciągu móc używać klasy bez parametrów,
+ wszystkie parametry konstruktora powinny stać się opcjonalne przez dodanie
+ domyślnych wartości.
-// Works in PHP 3 and PHP 4.
-class Constructor_Cart extends Cart
+// Działa w PHP 3 i PHP 4.
+class Kontruktor_Koszyk extends Koszyk
{
- function Constructor_Cart($item = "10", $num = 1)
+ function Konstruktor_Koszyk($artykul = "10", $ilosc = 1)
{
- $this->add_item ($item, $num);
+ $this->dodaj_artykul ($artykul, $ilosc);
}
}
-// Shop the same old boring stuff.
+// Kup te same nudne rzeczy...
-$default_cart = new Constructor_Cart;
+$zwykly_koszyk = new Konstruktor_Koszyk;
-// Shop for real...
+// Czas na prawdziwe zakupy...
-$different_cart = new Constructor_Cart("20", 17);
+$inny_koszyk = new Konstruktor_Koszyk("20", 17);
- In PHP 3, derived classes and constructors have a number of
- limitations. The following examples should be read carefully
- to understand these limitations.
+ W PHP 3, dziedziczone klasy i konstruktory mają wiele ograniczeń.
+ Poniższe przykłady powinny być dokładnie przeczytane w celu zrozumienia
+ tych ograniczeń.
@@ -311,7 +303,7 @@
{
function A()
{
- echo "I am the constructor of A.<br>\n";
+ echo "Jestem konstruktorem klasy A.<br>\n";
}
}
@@ -319,27 +311,27 @@
{
function C()
{
- echo "I am a regular function.<br>\n";
+ echo "Zwykła funkcja.<br>\n";
}
}
-// no constructor is being called in PHP 3.
+// W PHP 3 nie zostanie wywołany żaden konstruktor.
$b = new B;
- In PHP 3, no constructor is being called in the above example.
- The rule in PHP 3 is: 'A constructor is a function of the same
- name as the class.'. The name of the class is B, and there is
- no function called B() in class B. Nothing happens.
+ W PHP 3 w powyższym przykładzie nie będzie wywołany żaden konstruktor.
+ Zasadą PHP 3 jest: 'Konstruktor to funkcja o takiej samej nazwie jak
+ klasa'. Nazwą klasy jest B, a w klasie B nie ma funkcji o nazwie B(). Nic
+ się nie dzieje.
- This is fixed in PHP 4 by introducing another rule: If a class
- has no constructor, the constructor of the base class is being
- called, if it exists. The above example would have printed
- 'I am the constructor of A.<br>' in PHP 4.
+ Zostało to poprawione w PHP 4 przez wprowadzenie innej zasady: jeśli klasa
+ nie ma konstruktora, używany jest konstruktor klasy bazowej, jeśli taki
+ istnieje. W PHP 4 powyższy przykład wyświetli 'Jestem konstruktorem klasy
+ A.<br>'.
@@ -348,13 +340,13 @@
{
function A()
{
- echo "I am the constructor of A.<br>\n";
+ echo "Jestem konstruktorem klasy A.<br>\n";
}
function B()
{
- echo "I am a regular function named B in class A.<br>\n";
- echo "I am not a constructor in A.<br>\n";
+ echo "Jestem zwykłą funkcją o nazwie B w klasie A.<br>\n";
+ echo "Nie jestem konstruktorem w klasie A.<br>\n";
}
}
@@ -362,53 +354,51 @@
{
function C()
{
- echo "I am a regular function.<br>\n";
+ echo "Jestem zwykłą funkcją.<br>\n";
}
}
-// This will call B() as a constructor.
+// Wywoła to B() jako konstruktor.
$b = new B;
- In PHP 3, the function B() in class A will suddenly become a
- constructor in class B, although it was never intended to be.
- The rule in PHP 3 is: 'A constructor is a function of the same
- name as the class.'. PHP 3 does not care if the function is
- being defined in class B, or if it has been inherited.
+ W PHP 3, funkcja B() z klasy A niespodziewanie stanie się konstruktorem w
+ klasie B, pomimo że wcale nie miała nim być. Zasadą PHP 3 jest:
+ 'Konstruktor to funkcja o takiej samej nazwie co klasa'. PHP 3 nie
+ obchodzi czy funkcja została zdefiniowana w klasie B czy została
+ odziedziczona.
- This is fixed in PHP 4 by modifying the rule to: 'A constructor
- is a function of the same name as the class it is being defined
- in.'. Thus in PHP 4, the class B would have no constructor function
- of its own and the constructor of the base class would have been
- called, printing 'I am the constructor of A.<br>'.
+ Zostało to poprawione w PHP 4 przez modyfikację tej zasady do:
+ 'Konstruktor to funkcja o tej samej nazwie co klasa w której została
+ zdefiniowana'. W związku z tym w PHP 4 clasa B nie miałaby własnego
+ konstruktora. Wywołany byłby tylko konstruktor klasy bazowej, wyświetlając
+ 'Jestem konstruktorem klasy A.<br>'.
- Neither PHP 3 nor PHP 4 call constructors of the base class
- automatically from a constructor of a derived class. It is
- your responsibility to propagate the call to constructors
- upstream where appropriate.
+ Ani PHP 3 ani PHP 4 nie wywoła automatycznie konstruktora klasy bazowej z
+ kontruktora klasy pochodnej. Twoim zadaniem jest propagacja wywołań
+ konstruktorów klas nadrzędnych, jeśli to konieczne.
- There are no destructors in PHP 3 or PHP 4. You may use
- register_shutdown_function instead
- to simulate most effects of destructors.
+ Ani w PHP 3 ani w PHP 4 nie ma destruktorów. Zamiast tego możesz użyć
+ register_shutdown_function aby symulować działanie
+ destruktorów.
- Destructors are functions that are called automatically
- when an object is destroyed, either with unset
- or by simply going out of scope. There are no destructors
- in PHP.
+ Destruktory są funkcjami, które są wywoływanie automatycznie kiedy obiekty
+ są niszczone albo przez użycie unset albo przez
+ wyjście z zasięgu. W PHP nie ma destruktorów.
@@ -417,82 +407,76 @@
- The following is valid for PHP 4 only.
+ Poniższe dotyczy tylko PHP 4.
- Sometimes it is useful to refer to functions and variables
- in base classes or to refer to functions in classes that
- have not yet any instances. The :: operator is being used
- for this.
+ Czasami dobrze jest odnosić się do funkcji i zmiennych w klasie bazowej
+ lub odnosić się do funkcji i klas które nie mają jeszcze instancji. Służy
+ do tego operator ::.
class A
{
- function example()
+ function przyklad()
{
- echo "I am the original function A::example().<br>\n";
+ echo "Jestem orginalną funkcją A::przyklad().<br>\n";
}
}
class B extends A
{
- function example()
+ function przyklad()
{
- echo "I am the redefined function B::example().<br>\n";
- A::example();
+ echo "Jestem przedefiniowaną funkcją B::przyklad().<br>\n";
+ A::przyklad();
}
}
-// there is no object of class A.
-// this will print
-// I am the original function A::example().<br>
-A::example();
+// nie ma obiektu klasy A.
+// poniższe wyświetli
+// Jestem orginalną funkcją A::przyklad().<br>
+A::przyklad();
-// create an object of class B.
+// stwórz nowy obiekt klasy B.
$b = new B;
-// this will print
-// I am the redefined function B::example().<br>
-// I am the original function A::example().<br>
-$b->example();
+// poniższe wyświetli
+// Jestem przedefiniowaną funkcją B::przyklad().<br>
+// Jestem orginalną funkcją A::przyklad().<br>
+$b->przyklad();
- The above example calls the function example() in
- class A, but there is no object of class A, so that
- we cannot write $a->example() or similar. Instead we
- call example() as a 'class function', that is, as a
- function of the class itself, not any object of that
- class.
+ Powyższy przekład wywołuje funkcję przyklad() z klasy A, ale nie tworząc
+ obiektu tej klasy, przez co nie możemy napisać nic w stylu $a->przyklad().
+ Zamiast tego możemy wywołać przyklad() jako 'funkcję klasy', czyli jako
+ funkcję tylko klasy, nie żadnego obiektu tej klasy.
- There are class functions, but there are no class variables.
- In fact, there is no object at all at the time of the call.
- Thus, a class function may not use any object variables (but
- it can use local and global variables), and it may no use
- $this at all.
+ Istnieją funkcje klasy, ale nie ma zmiennych klasy. Faktycznie w czasie
+ wykonania nie ma żadnego obiektu. W związku z tym funkcje klasy nie mogą
+ używać żadnych zmiennych obiektu (ale mogą używać zmiennych lokalnych i
+ globalnych), ani w ogóle $this.
- In the above example, class B redefines the function example().
- The original definition in class A is shadowed
- and no longer available, unless you are refering specifically
- to the implementation of example() in class A using the
- ::-operator. Write A::example() to do this (in fact, you
- should be writing parent::example(), as shown in the next
- section).
+ W powyższym przykładzie, klasa B przedefiniowuje funkcję przyklad().
+ Orginalna definicja z klasy A jest zasłonięta i niedostępna, chyba że
+ odwołasz się do konkretnej implementacji poprzez operator ::. Aby to
+ zrobić, napisz A::przyklad() (powinieneś jednak użyć parent::przyklad(),
+ tak jak to pokazano w następnej części).
- In this context, there is a current object and it may
- have object variables. Thus, when used from WITHIN an
- object function, you may use $this and object variables.
+ W tym kontekście, istnieje bieżący obiekt i który ma zmienne obiektu. W
+ związu z tym jeśli funkcja jest użyta Z WEWNĄTRZ funkcji obiektu, możesz
+ używać $this i zmiennych obiektu.
@@ -501,91 +485,85 @@
parent
- You may find yourself writing code that refers to
- variables and functions in base classes. This is
- particularly true if your derived class is a refinement
- or specialisation of code in your base class.
+ Może się zdarzyć, że będziesz pisał kod, który odnosi się do funkcji i
+ zmiennych klasy bazowej. Jest to możliwe jeśli twoja klasa pochodna jest
+ uściśleniem lub specjalizacją klasy bazowej.
- Instead of using the literal name of the base class in your
- code, you should be using the special name
- parent, which refers to the name of your
- base class as given in the extends
- declation of your class. By doing this, you avoid using the
- name of your base class in more than one place. Should
- your inheritance tree change during implementation, the
- change is easily made by simply changing the
- extends declaration of your class.
+ Zamiast jawnego podawania nazwy klasy bazowej w kodzie, powinieneś użyć
+ specjalnej nazwy parent, która odnosi się do nazwy klasy
+ bazowej podanej przy extends podczas deklaracji twojej
+ klasy. Robiąc to, unikasz użycia nazwy klasy bazowej w więcej niż jednym
+ miejscu. Jeśli twoje drzewo dziedziczenia zmieniłoby się podczas
+ implementacji, zmiana będzie wymagała poprawki tylko w jednym miejscu -
+ przy słowie kluczowym extends w deklaracji klasy.
class A
{
- function example()
+ function przyklad()
{
- echo "I am A::example() and provide basic functionality.<br>\n";
+ echo "Jestem A::przyklad() I dostarczam podstawową funkcjonalność.<br>\n";
}
}
class B extends A
{
- function example()
+ function przyklad()
{
- echo "I am B::example() and provide additional functionality.<br>\n";
- parent::example();
+ echo "Jestem B::przyklad() i dostarczam dodatkową funkcjonalność.<br>\n";
+ parent::przyklad();
}
}
$b = new B;
-// This will call B::example(), which will in turn call A::example().
-$b->example();
+// Wywoła to B::przyklad(), który z kolei wywoła A::przyklad().
+$b->przyklad();
- Serializing objects - objects in sessions
+ Serializacja obiektów - obiekty w sesjach
- In PHP 3, objects will lose their class association
- throughout the process of serialization and unserialization.
- The resulting variable is of type object, but has no class
- and no methods, thus it is pretty useless (it has become
- just like an array with a funny syntax).
+ W PHP 3 obiekty tracą powiązania między klasami w czasie procesu
+ serializacji i odserializacji. Wynikowa zmienna będzie typu obiekt, ale
+ bez klasy i bez metod, a więc w zasadzie bezużyteczną (zostanie poprostu
+ zmienną ze śmieszną składnią).
- The following information is valid for PHP 4 only.
+ Poniższe informacje dotyczą tylko PHP 4.
- serialize returns a string containing a
- byte-stream representation of any value that can be stored in
- PHP. unserialize can use this string to
- recreate the original variable values. Using serialize to
- save an object will save all variables in an object. The
- functions in an object will not be saved, only the name of
- the class.
+ serialize zwraca string będący reprezentacją dowolnej
+ wartości, która może być przechowywana przez PHP.
+ unserialize może użyć tego stringu aby odtworzyć
+ orginalne wartości zmiennej. Użycie serializacji do zapisania obiektu
+ zachowa wszystkie zmienne z obiektu. Zapisane nie będą funkcje z obiektu, a
+ jedynie nazwa klasy.
- In order to be able to unserialize an
- object, the class of that object needs to be defined. That
- is, if you have an object $a of class A on page1.php and
- serialize this, you'll get a string that refers to class A
- and contains all values of variabled contained in $a. If
- you want to be able to unserialize this on page2.php,
- recreating $a of class A, the definition of class A must
- be present in page2.php. This can be done for example
- by storing the class defintion of class A in an include
- file and including this file in both page1.php and page2.php.
+ Aby istniała możliwość użycia funkcji unserialize do
+ odzyskania obiektu, musi być zdefiniowana klasa tego obiektu. Oznacza to,
+ że jeśli obiekt $a klasy A istnieje na page1.php i zserializujesz go,
+ otrzymasz string, który odnosi się do klasy A i zawiera wartości wszystkich
+ zmiennych zawartych w $a. Jeśli chcesz, aby istniała możliwość
+ odserializacji tego obiektu na page2.php, na page2.php musi istnieć
+ definicja klasy A. Można to zrobić na przykład przez przechowywanie
+ definicji klasy A w zewnętrznym pliku includowanym przez page1.php i
+ page2.php.
@@ -593,11 +571,11 @@
classa.inc:
class A
{
- var $one = 1;
+ var $jeden = 1;
- function show_one()
+ function pokaz_jeden()
{
- echo $this->one;
+ echo $this->jeden;
}
}
@@ -606,115 +584,110 @@
$a = new A;
$s = serialize($a);
- // store $s somewhere where page2.php can find it.
+ // przechowaj $s gdzieś, gdzie page2.php będzie mogła go znaleźć
$fp = fopen("store", "w");
fputs($fp, $s);
fclose($fp);
page2.php:
- // this is needed for the unserialize to work properly.
+ // to jest niezbędne aby funkcja unserialize działała prawidłowo.
include("classa.inc");
$s = implode("", <email protected>("store"));
$a = unserialize($s);
- // now use the function show_one() of the $a object.
- $a->show_one();
+ // teraz użyj funkcji pokaz_jeden z obiektu $a.
+ $a->pokaz_jeden();
- If you are using sessions and use session_register
- to register objects, these objects are serialized automatically
- at the end of each PHP page, and are unserialized automatically on
- each of the following pages. This basically means that these objects
- can show up on any of your pages once they become part of your
- session.
+ Jeśli używasz sesji i session_register do rejestracji
+ obiektów, te obiekty są serializowane automatycznie na końcu każdej strony
+ PHP i odserializowane automatycznie na każdej z następnych stron.
+ Zasadniczo znaczy to, że te obiekty mogą pokazać się na dowolnej z twoich
+ stron jeśli tylko staną się częścią twojej sesji.
- It is strongly recommended that you include the class
- definitions of all such registered objects on all of your
- pages, even if you do not actually use these classes on all
- of your pages. If you don't and an object is being
- unserialized without its class definition being present, it
- will lose its class association and become an object of class
- stdClass without any functions available
- at all, that is, it will become quite useless.
+ Mocno zalecane jest includowanie definicji klas wszystkich zarejestrowanych
+ obiektów na wszystkich twoich stronach, nawet jeśli nie używasz tych
+ zmiennych na twoich stronach. Jeśli tego nie zrobisz a obiekty zostaną
+ odserializowane bez definicji klasy, powiązania klasowe zostaną utracone a
+ obiek stanie się obiektem klasy stdClass bez żadnych
+ dostępnych funkcji, a więc będzie całkiem bezużyteczny.
- So if in the example above $a became part of a session by
- running session_register("a"), you should
- include the file classa.inc on all of your
- pages, not only page1.php and page2.php.
+ A więc jeśli w powyższym przykładzie $a stanie się częścią sesji przez
+ wywołanie session_register("a"), powinieneć includować
+ plik classa.inc na wszystkich stronach, nie tylko
+ page1.php i page2.php.
- The magic functions __sleep and __wakeup
+ Magiczne funkcje __sleep i __wakeup
- serialize checks if your class has a function with
- the magic name __sleep. If so, that function is
- being run prior to any serialization. It can clean up the object
- and is supposed to return an array with the names of all variables
- of that object that should be serialized.
+ serialize sprawdza, czy twoja klasa zawiera funkcję o
+ magicznej nazwie __sleep. Jeśli tak, ta funkcja jest
+ wywoływana przed każdą serializacją. Może ona czyścić obiekt i powinna
+ zwracać tablicę z nazwami wszystkich zmiennych obiektu, które powinny być
+ serializowane.
- The intended use of __sleep is to close any
- database connections that object may have, committing pending
- data or perform similar cleanup tasks. Also, the function is
- useful if you have very large objects which need not be
- saved completely.
+ Założonym użyciem __sleep jest zamknięcie wszystkich
+ połączeń do baz danych, które obiekt może utrzymywać, zatwierdzenie
+ wszystkich oczekujących danych lub wykonanie innych podobnych czynności
+ czyszczących. Funkcja ta jest także przydatna jeśli masz bardzo duże
+ obiekty, które nie muszą być zachowane w całości.
- Conversely, unserialize checks for the
- presence of a function with the magic name
- __wakeup. If present, this function can
- reconstruct any ressources that object may have.
+ Analogicznie, unserialize sprawdza czy istnieje
+ funkcja o magicznej nazwie __wakeup. Jeśli tak, funkcja
+ może rekonstruować dowolne zasoby które obiekt może posiadać.
- The intended use of __wakeup is to
- reestablish any database connections that may have been lost
- during serialization and perform other reinitialization
- tasks.
+ Założonym użyciem __wakeup jest odnowienie połączeń z
+ bazami danych, które mogły zostac utracone w procesie serializacji, oraz
+ wykonanie innych czynności odbudowujących obiekt.
- References inside the constructor
+ Referencje wewnątrz konstruktora
- Creating references within the constructor can lead to confusing
- results. This tutorial-like section helps you to avoid problems.
+ Tworzenie referencji wewnątrz konstruktora może prowadzić do dziwnych
+ efektów. Ten rozdział ma pomóc w unikaniu takich problemów.
class Foo
{
- function Foo($name)
+ function Foo($nazwa)
{
- // create a reference inside the global array $globalref
+ // stworz referencje wewnatrz globalnej tablicy $globalref
global $globalref;
$globalref[] = &$this;
- // set name to passed value
- $this->setName($name);
- // and put it out
- $this->echoName();
+ // ustaw nazwę na przekazaną wartość
+ $this->ustawNazwe($nazwa);
+ // i wyświetl ją
+ $this->wyswietlNazwe();
}
- function echoName()
+ function wyswietlNazwe()
{
- echo "<br>",$this->name;
+ echo "<br>",$this->nazwa;
}
- function setName($name)
+ function ustawNazwe($nazwa)
{
- $this->name = $name;
+ $this->nazwa = $nazwa;
}
}
@@ -722,86 +695,87 @@
- Let us check out if there is a difference between
- $bar1 which has been created using
- the copy = operator and
- $bar2 which has been created using
- the reference =& operator...
+ Sprawdźmy, czy jest jakaś różnica pomiędzy
+ $bar1, który jest tworzony przy pomocy operatora
+ przypisania =, a $bar2, który został
+ stworzony używając operatora referencji =&...
-$bar1 = new Foo('set in constructor');
-$bar1->echoName();
-$globalref[0]->echoName();
-
-/* output:
-set in constructor
-set in constructor
-set in constructor */
-
-$bar2 =& new Foo('set in constructor');
-$bar2->echoName();
-$globalref[1]->echoName();
-
-/* output:
-set in constructor
-set in constructor
-set in constructor */
+$bar1 = new Foo('ustawione w konstruktorze');
+$bar1->wyswietlNazwe();
+$globalref[0]->wyswietlNazwe();
+
+/* wyjście:
+ustawione w konstruktorze
+ustawione w konstruktorze
+ustawione w konstruktorze */
+
+$bar2 =& new Foo('ustawione w konstruktorze');
+$bar2->wyswietlNazwe();
+$globalref[1]->wyswietlNazwe();
+
+/* wyjście:
+ustawione w konstruktorze
+ustawione w konstruktorze
+ustawione w konstruktorze */
- Apparently there is no difference, but in fact there is a
- very significant one: $bar1 and
- $globalref[0] are _NOT_ referenced, they
- are NOT the same variable. This is because "new" does not
- return a reference by default, instead it returns a copy.
+ Wydaje się, że nie ma żadnej różnicy, ale na prawdę jest jedna, i to
+ bardzo istotna: $bar1 i
+ $globalref[0]NIE są referencjami,
+ NIE są tą samą zmienna. Dzieje się tak, ponieważ
+ "new" nie zwraca domyślnie referencji, ale kopię.
- There is no performance loss (since PHP 4 and up use reference
- counting) returning copies instead of references. On the
- contrary it is most often better to simply work with copies
- instead of references, because creating references takes some
- time where creating copies virtually takes no time (unless none
- of them is a large array or object and one of them gets changed
- and the other(s) one(s) subsequently, then it would be wise to
- use references to change them all concurrently).
+ Zwracanie kopii zamiast referencji nie powoduje utraty wydajności (od
+ PHP 4 używane jest zliczanie referencji). Jednakże zazwyczaj lepiej jest
+ pracować poprostu z kopiami zamiast referencji, poniewać tworzenie
+ referencji zabiera trochę czasu, podczas gdy tworzenie kopii obiektów
+ teoretycznie w ogóle nie zabiera czasu (chyba że któraś z tych zmiennych
+ jest dużą tablicą lub obiektem i jedno z nich ulega zmianie, po czym tej
+ samej zmianie ulegają pozostałe zmienne; wtedy lepiej jest użyć
+ referencji do zmieniania ich równolegle).
- To prove what is written above let us watch the code below.
+ Aby udowodnić to, co zostało zapisane powyżej, przyjrzyjmy się poniższemu
+ programowi.
-// now we will change the name. what do you expect?
-// you could expect that both $bar1 and $globalref[0] change their names...
-$bar1->setName('set from outside');
-
-// as mentioned before this is not the case.
-$bar1->echoName();
-$globalref[0]->echoName();
-
-/* output:
-set from outside
-set in constructor */
-
-// let us see what is different with $bar2 and $globalref[1]
-$bar2->setName('set from outside');
-
-// luckily they are not only equal, they are the same variable
-// thus $bar2->name and $globalref[1]->name are the same too
-$bar2->echoName();
-$globalref[1]->echoName();
-
-/* output:
-set from outside
-set from outside */
+// teraz zmienimy nazwę. czego się spodziewasz?
+// możesz się spodziewać, że i $bar1 i $globalref[0] zmienią swoje nazwy...
+$bar1->ustawNazwe('ustawiona z zewnątrz');
+
+// jak napisano powyżej, nic takiego się nie stanie
+$bar1->wyswietlNazwe();
+$globalref[0]->wyswietlNazwe();
+
+/* wyjście:
+ustawiona z zewnątrz
+ustawiona w konstruktorze */
+
+// zobaczmy co się dzieje z $bar2 i $globalref[1]
+$bar2->ustawNazwe('ustawiona z zewnątrz');
+
+// na szczęście ta zmienna nie zachowuje się jak ta z poprzedniego przypadku
+// są to te same zmienne, z więc $bar2->nazwa i $globalref[1]->nazwa są także
+// tymi samymi zmiennymi
+$bar2->wyswietlNazwe();
+$globalref[1]->wyswietlNazwe();
+
+/* wyjście:
+ustawiona z zewnątrz
+ustawiona z zewnątrz */
- Another final example, try to understand it.
+ Ustatni przykład. Postaraj się go zrozumieć/
@@ -809,19 +783,19 @@
{
function A($i)
{
- $this->value = $i;
- // try to figure out why we do not need a reference here
+ $this->wartosc = $i;
+ // domyśl się dlaczego nie potrzebujemy tutaj referencji
$this->b = new B($this);
}
- function createRef()
+ function stworzRef()
{
$this->c = new B($this);
}
- function echoValue()
+ function wyswietlWartosc()
{
- echo "<br>","class ",get_class($this),': ',$this->value;
+ echo "<br>","klasa ",get_class($this),': ',$this->value;
}
}
@@ -833,35 +807,34 @@
$this->a = &$a;
}
- function echoValue()
+ function wyswietlWartosc()
{
- echo "<br>","class ",get_class($this),': ',$this->a->value;
+ echo "<br>","klasa ",get_class($this),': ',$this->a->value;
}
}
-
-// try to undestand why using a simple copy here would yield
-// in an undesired result in the *-marked line
+// spróbuj zrozumieć dlaczego użycie tu prostego kopiowania może powodować
+// nieporządany efekt w linii uznaczonej znaczkiem '*'
$a =& new A(10);
-$a->createRef();
+$a->stworzRef();
-$a->echoValue();
-$a->b->echoValue();
-$a->c->echoValue();
+$a->wyswietlWartosc();
+$a->b->wyswietlWartosc();
+$a->c->wyswietlWartosc();
$a->value = 11;
-$a->echoValue();
-$a->b->echoValue(); // *
-$a->c->echoValue();
+$a->wyswietlWartosc();
+$a->b->wyswietlWartosc(); // *
+$a->c->wyswietlWartosc();
/*
-output:
-class A: 10
-class B: 10
-class B: 10
-class A: 11
-class B: 11
-class B: 11
+wyjście:
+klasa A: 10
+klasa B: 10
+klasa B: 10
+klasa A: 11
+klasa B: 11
+klasa B: 11
*/