shlomi Thu Feb 7 09:01:57 2002 EDT Modified files: /phpdoc/he/language variables.xml Log: fully translated
Index: phpdoc/he/language/variables.xml diff -u phpdoc/he/language/variables.xml:1.1 phpdoc/he/language/variables.xml:1.2 --- phpdoc/he/language/variables.xml:1.1 Tue Feb 5 21:46:20 2002 +++ phpdoc/he/language/variables.xml Thu Feb 7 09:01:56 2002 @@ -2,10 +2,10 @@ <!-- EN-Revision: 1.33 Maintainer: shlomi Status: working --> <chapter id="language.variables"> - <title>Variables</title> + <title>משתנים</title> <sect1 id="language.variables.basics"> - <title>Basics</title> + <title>הסבר בסיסי</title> <simpara> משתנים ב-PHP מיוצגים על-ידי שם עם סימן הדולר בתחילתו. @@ -366,8 +366,8 @@ <term>$SERVER_SIGNATURE</term> <listitem> <simpara> - String containing the server version and virtual host name - which are added to server-generated pages, if enabled. + מחרוזת המכילה את גרסת השרת ושם ה-host הוירטואלי. המחרוזת תצורף + לדפים הנוצרים על-ידי השרת אם אופציה זו מאופשרת. </simpara> </listitem> </varlistentry> @@ -410,65 +410,62 @@ <title>משתני סביבה</title> <simpara> - These variables are imported into PHP's global namespace from the - environment under which the PHP parser is running. Many are - provided by the shell under which PHP is running and different - systems are likely running different kinds of shells, a - definitive list is impossible. Please see your shell's - documentation for a list of defined environment variables. + משתנים אלו מיובאים מהסביבה שתחתיה רץ מפרש ה-PHP + לתוך משתנים גלובלים בסקריפט. רבים מהם מיובאים מתוכניות + המעטפת (shell) שתחתיה רצה PHP וכאשר משתמשים ב-PHP במערכות + שונות ובתוכניות מעטפת שונות, לא ניתן לתעד רשימה אחידה של + משתנים אלו. יש לעיין בתיעוד תוכנת המעטפת לקבלת רשימה של משתני הסביבה. </simpara> <simpara> - Other environment variables include the CGI variables, placed - there regardless of whether PHP is running as a server module or - CGI processor. + משתני סביבה אחדים יכללו את משתני ה-CGI הממוקמים שם כאשר PHP רצה + כמודול שרת וגם כאשר PHP רצה כמעבד CGI. </simpara> </sect2> <sect2 id="language.variables.predefined.php"> - <title>PHP variables</title> + <title>משתני-PHP</title> <simpara> - These variables are created by PHP itself. The - <varname>$HTTP_*_VARS</varname> variables are available only if - the <link linkend="ini.track-vars">track_vars</link> - configuration is turned on. When enabled, the variables are - always set, even if they are empty arrays. This prevents - a malicious user from spoofing these variables. + משתנים אלו נוצרים על-ידי PHP. כל המשתנים בצורת + <varname>$HTTP_*_VARS</varname> יהיו זמינים רק אם האופציה + <link linkend="ini.track-vars">track_vars</link> מאופשרת. + כאשר אופציה זו מאופשרת, משתנים אלו תמידיוגדרו, אפילו + אם יוגדרו כמערכים ריקים כדי למנוע ממשתמש בעל כוונת זדון + לשנות את ערכם. </simpara> <note> <para> - As of PHP 4.0.3, <link - linkend="ini.track-vars">track_vars</link> is always turned on, - regardless of the configuration file setting. + החל מגרסה 4.0.3 של PHP האופציה <link + linkend="ini.track-vars">track_vars</link> תמיד פעילה + ללא התחשבות בהגדרתה בקובץ ההגדרות של PHP. </para> </note> <note> <para> - The new "Superglobals" were added in PHP version 4.1.0. See the - <ulink url="&url.php.release4.1.0;">4.1.0 Release - Announcement</ulink> for more details. These are the + נוספו משתנים "סופר-גלובלים" חדשים מגרסה 4.1.0 . יש לעיין + ב<ulink url="&url.php.release4.1.0;">הכרזה של PHP 4.1.0 </ulink> + למידע נוסף. המשתנים החדשים <varname>$_GET</varname>, <varname>$_POST</varname>, <varname>$_ENV</varname>, <varname>$_SERVER</varname>, <varname>$_COOKIE</varname>, <varname>$_REQUEST</varname> <varname>$_FILES</varname>, and <varname>$_SESSION</varname> - arrays, and they are informally known as - <emphasis>Superglobals</emphasis> since they are always - available without regard to scope. These deprecate the older - respective <varname>$HTTP_*_VARS</varname> arrays. + הם מערכים שמוגדרים כ"סופר-גלובלים" מאחר שהם זמינים תמיד ללא תלות + בטווח הגדרת הנתונים (scope). + משתנים אלו מחליפים את מערכי ה-<varname>$HTTP_*_VARS</varname> + שהיו בעבר בשימוש. </para> </note> <para> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$HTTP_*_VARS</varname> and <varname>$_*</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.registerglobals">Using Register Globals</link>. + אם אופציית <link + linkend="ini.register-globals">register_globals</link> מאופשרת, + יהיו משתנים אלו זמינים גם כן בטווח המשתנים הגלובלים בנפרד ממערכי + ה-<varname>$HTTP_*_VARS</varname> הו-<varname>$_*</varname>. + למידע נוסף, יש לעיין בפרק אבטחת המידע שכותרתו <link + linkend="security.registerglobals">אופן השימוש ברישום גלובלים</link>. </para> <para> @@ -477,10 +474,10 @@ <term>$argv</term> <listitem> <simpara> - Array of arguments passed to the script. When the script is - run on the command line, this gives C-style access to the - command line parameters. When called via the GET method, this - will contain the query string. + מערך המכיל את רשימת הארגומנטים המועברים לסקריפט. בעת הרצת + סקריפט משורת הפקודה, מערך זה מאפשר גישה בסגנון שפת C לפרמטרים + משורת הפקודה. כאשר עמוד מקבל פנייה בשיטת GET , משתנה זה יכיל + את ה-query string. </simpara> </listitem> </varlistentry> @@ -489,8 +486,8 @@ <term>$argc</term> <listitem> <simpara> - Contains the number of command line parameters passed to the - script (if run on the command line). + מכיל את מספר הפרמטרים המועברים באמצעות שורת הפקודה לסקריפט + (אם הסקריפט מורץ משורת הפקודה). </simpara> </listitem> </varlistentry> @@ -499,9 +496,8 @@ <term>$PHP_SELF</term> <listitem> <simpara> - The filename of the currently executing script, relative to - the document root. If PHP is running as a command-line - processor, this variable is not available. + שם הקובץ של הסקריפט הנוכחי, יחסית לספרייה הראשית של העמוד. + אם PHP מורצת בשורת הפקודה, משתנה זה אינו זמין. </simpara> </listitem> </varlistentry> @@ -510,8 +506,8 @@ <term>$HTTP_COOKIE_VARS</term> <listitem> <simpara> - An associative array of variables passed to the current - script via HTTP cookies. + מערך אסוציאטיבי של המשתנים המועברים לסקריפט הנוכחי + דרך עוגיות HTTP. </simpara> </listitem> </varlistentry> @@ -520,9 +516,10 @@ <term>$_COOKIE</term> <listitem> <simpara> - An associative array of variables passed to the current - script via HTTP cookies. Automatically global in any - scope. Introduced in PHP 4.1.0. + מערך אסוציאטיבי של המשתנים המועברים לסקריפט הנוכחי + דרך עוגיות HTTP. + משתנה זה מוגדר בכל טווח משתנים כלשהו. + נוסף ל-PHP החל מגרסה 4.1.0 . </simpara> </listitem> </varlistentry> @@ -531,8 +528,8 @@ <term>$HTTP_GET_VARS</term> <listitem> <simpara> - An associative array of variables passed to the current - script via the HTTP GET method. + מערך אסוציאטיבי של המשתנים המועברים לסקריפט הנוכחי + דרך שיטת HTTP GET. </simpara> </listitem> </varlistentry> @@ -541,9 +538,10 @@ <term>$_GET</term> <listitem> <simpara> - An associative array of variables passed to the current - script via the HTTP GET method. Automatically global in - any scope. Introduced in PHP 4.1.0. + מערך אסוציאטיבי של המשתנים המועברים לסקריפט הנוכחי + דרך שיטת HTTP GET. + משתנה זה מוגדר בכל טווח משתנים כלשהו. + נוסף ל-PHP החל מגרסה 4.1.0 . </simpara> </listitem> </varlistentry> @@ -552,8 +550,8 @@ <term>$HTTP_POST_VARS</term> <listitem> <simpara> - An associative array of variables passed to the current - script via the HTTP POST method. + מערך אסוציאטיבי של המשתנים המועברים לסקריפט הנוכחי + דרך שיטת HTTP POST. </simpara> </listitem> </varlistentry> @@ -562,9 +560,10 @@ <term>$_POST</term> <listitem> <simpara> - An associative array of variables passed to the current - script via the HTTP POST method. Automatically global in - any scope. Introduced in PHP 4.1.0. + מערך אסוציאטיבי של המשתנים המועברים לסקריפט הנוכחי + דרך שיטת HTTP POST. + משתנה זה מוגדר בכל טווח משתנים כלשהו. + נוסף ל-PHP החל מגרסה 4.1.0 . </simpara> </listitem> </varlistentry> @@ -573,11 +572,11 @@ <term>$HTTP_POST_FILES</term> <listitem> <simpara> - An associative array of variables containing information - about files uploaded via the HTTP POST method. See <link - linkend="features.file-upload.post-method">POST method - uploads</link> for information on the contents of - <varname>$HTTP_POST_FILES</varname>. Introduced in 4.0.0. + מערך אסוציאטיבי של משתנים המכילים מידע על קבצים שהועלו לשרת + בשיטת HTTP POST. יש לעיין ב<link + linkend="features.file-upload.post-method">העלאת קבצים + בשיטת POST</link> למידע על תכולתו של <varname>$HTTP_POST_FILES</varname>. + נוסף ל-PHP החל מגרסה 4.0.0. </simpara> </listitem> </varlistentry> @@ -586,12 +585,12 @@ <term>$_FILES</term> <listitem> <simpara> - An associative array of variables containing information - about files uploaded via the HTTP POST method. See <link - linkend="features.file-upload.post-method">POST method - uploads</link> for information on the contents of - <varname>$_FILES</varname>. Automatically global in any scope. - Introduced in PHP 4.1.0. + מערך אסוציאטיבי של משתנים המכילים מידע על קבצים שהועלו לשרת + בשיטת HTTP POST. יש לעיין ב<link + linkend="features.file-upload.post-method">העלאת קבצים + בשיטת POST</link> למידע על תכולתו של <varname>$_FILES</varname>. + משתנה זה מוגדר בכל טווח משתנים כלשהו. + נוסף ל-PHP החל מגרסה 4.1.0 . </simpara> </listitem> </varlistentry> @@ -600,8 +599,8 @@ <term>$HTTP_ENV_VARS</term> <listitem> <simpara> - An associative array of variables passed to the current - script via the parent environment. + מערך אסוציאטיבי של המשתנים המועברים לסקריפט הנוכחי + מסביבת האב. </simpara> </listitem> </varlistentry> @@ -610,9 +609,10 @@ <term>$_ENV</term> <listitem> <simpara> - An associative array of variables passed to the current - script via the parent environment. Automagically global - in any scope. Introduced in PHP 4.1.0. + מערך אסוציאטיבי של המשתנים המועברים לסקריפט הנוכחי + מסביבת האב. + משתנה זה מוגדר בכל טווח משתנים כלשהו. + נוסף ל-PHP החל מגרסה 4.1.0 . </simpara> </listitem> </varlistentry> @@ -621,9 +621,8 @@ <term>$HTTP_SERVER_VARS</term> <listitem> <simpara> - An associative array of variables passed to the current - script from the HTTP server. These variables are analogous to - the Apache variables described above. + מערך אסוציאטיבי של המשתנים המועברים לסקריפט הנוכחי + מהשרת. ערכים אלו מקבילים למשתני שרת Apache המתוארים למעלה. </simpara> </listitem> </varlistentry> @@ -632,10 +631,10 @@ <term>$_SERVER</term> <listitem> <simpara> - An associative array of variables passed to the current - script from the HTTP server. These variables are analogous to - the Apache variables described above. Automatically global - in any scope. Introduced in PHP 4.1.0. + מערך אסוציאטיבי של המשתנים המועברים לסקריפט הנוכחי + מהשרת. ערכים אלו מקבילים למשתני שרת Apache המתוארים למעלה. + משתנה זה מוגדר בכל טווח משתנים כלשהו. + נוסף ל-PHP החל מגרסה 4.1.0 . </simpara> </listitem> </varlistentry> @@ -644,8 +643,7 @@ <term>$HTTP_SESSION_VARS</term> <listitem> <simpara> - An associative array of session variables passed to the current - script. + מערך אסוציאטיבי המכיל את משתני ה-session המועברים לסקריפט הנוכחי. </simpara> </listitem> </varlistentry> @@ -654,11 +652,12 @@ <term>$_SESSION</term> <listitem> <simpara> - An associative array of session variables passed to the - current script. Automatically global in any scope. Creating - new entries in the $_SESSION array will automatically - register them as session variables, as if you called - <function>session_register</function>. Introduced in PHP 4.1.0. + מערך אסוציאטיבי המכיל את משתני ה-session המועברים לסקריפט הנוכחי. + משתנה זה מוגדר בכל טווח משתנים כלשהו. + יצירת תאים חדשים במערך זה תגרום לרישום אוטומטי של נתונים אלו + כמשתני session בדומה לפעולה המתבצעת בעת קריאה לפונקציה + <function>session_register</function>. + נוסף ל-PHP החל מגרסה 4.1.0 . </simpara> </listitem> </varlistentry> @@ -667,10 +666,10 @@ <term>$_REQUEST</term> <listitem> <simpara> - An associative array merged from the GET, POST, and Cookie variables. - In other words - all the information that is coming from the user, - and that from a security point of view, cannot be trusted. - Automatically global in any scope. Introduced in PHP 4.1.0. + מערך אסוציאטיבי הממזג את כל המידע ממשתני GET, POST ו-Cookie . + במילים אחרות, הוא מכיל את כל המידע המגיע מהמשתמש ומבחינת אבטחת מידע + אינו מומלץ לשימוש כי לא ניתן לבטוח במידע זה. + נוסף ל-PHP החל מגרסה 4.1.0 . </simpara> </listitem> </varlistentry> @@ -684,13 +683,12 @@ <sect1 id="language.variables.scope"> - <title>Variable scope</title> + <title>טווח ההגדרה של משתנים</title> <simpara> - The scope of a variable is the context within which it is defined. - For the most part all PHP variables only have a single scope. - This single scope spans included and required files as well. For - example: + טווח ההגדרה של משתנה הוא הקונטקסט שבו המשתנה מוגדר. + לכל משתני PHP יש טווח הגדרה אחד בלבד. + טווח זה כולל גם קבצים מסופחים.לדוגמה: </simpara> <informalexample> <programlisting role="php"> @@ -701,11 +699,10 @@ </programlisting> </informalexample> <simpara> - Here the <varname>$a</varname> variable will be available within - the included <filename>b.inc</filename> script. However, within - user-defined functions a local function scope is introduced. Any - variable used inside a function is by default limited to the local - function scope. For example: + המשתנה <varname>$a</varname> יהיה מוגדר גם בקובץ +המסופח-<filename>b.inc</filename>. + לעומת זאת, בפונקציה שהוגדרה על-ידי המשתמש קיים טווח הגדרה לוקאלי. + כל משתנה בתוך הפונקציה מוגדר בטווח הפונקציה בלבד כברירת מחדל. + לדוגמה: </simpara> <informalexample> @@ -724,16 +721,13 @@ </informalexample> <simpara> - This script will not produce any output because the echo statement - refers to a local version of the <varname>$a</varname> variable, - and it has not been assigned a value within this scope. You may - notice that this is a little bit different from the C language in - that global variables in C are automatically available to - functions unless specifically overridden by a local definition. - This can cause some problems in that people may inadvertently - change a global variable. In PHP global variables must be - declared global inside a function if they are going to be used in - that function. An example: + סקריפט זה לא ידפיס קלט כי פקודת ה-echo מתייחסת לגרסה הלוקאלית של + המשתנה <varname>$a</varname>, ומשתנה זה לא קיבל הצבה בטווח הגדרתו. + ניתן לראות שהתנהגות זו שונה במקצת מהתנהגות שפת C בכך שמשתנים גלובלים + בשפת C זמינים אוטומטית גם בפונקציות אלא אם נדרסו על-ידי הגדרה לוקאלית. + תתכן בעיה כאשר תכנת ינסה ללא הצלחה יתרה לשנות את ערכו של משתנה גלובלי + מתוך פונקציה. משתנה גלובלי ב-PHP חייב להיות מוצהר כמשתנה גלובלי אם + קיימת כוונה להשתמש במשתנה זה מתוך הפונקציה. דוגמה: </simpara> <informalexample> @@ -756,17 +750,16 @@ </informalexample> <simpara> - The above script will output "3". By declaring - <varname>$a</varname> and <varname>$b</varname> global within the - function, all references to either variable will refer to the - global version. There is no limit to the number of global - variables that can be manipulated by a function. + הסקריפט ידפיס "3". כאשר המשתנים <varname>$a</varname> ו- +<varname>$b</varname> + מוגדרים כגלובלים בפונקציה, כל התייחסות אליהם תתיחס לגרסה הגלובלית + שלהם. אין הגבלה למספר המשתנים הגלובלים שפונקציה + יכולה לשנות. </simpara> <simpara> - A second way to access variables from the global scope is to use - the special PHP-defined <varname>$GLOBALS</varname> array. The - previous example can be rewritten as: + + דרך נוספת לגשת טווח המשתנים הגלובלים היא בעזרת המערך המוגדר מראש- + <varname>$GLOBALS</varname>. אפשר לכתוב את הדוגמה הקודמת גם בצורה הזו: </simpara> <informalexample> @@ -787,17 +780,15 @@ </informalexample> <simpara> - The <varname>$GLOBALS</varname> array is an associative array with - the name of the global variable being the key and the contents of - that variable being the value of the array element. + המערך <varname>$GLOBALS</varname> הוא מערך אסוציאטיבי באופן + ששם המשתנה הגלובלי הוא המפתח לערך וערך המשתנה הגלובלי הוא + הערך של תא זה במערך. </simpara> <simpara> - Another important feature of variable scoping is the - <emphasis>static</emphasis> variable. A static variable exists - only in a local function scope, but it does not lose its value - when program execution leaves this scope. Consider the following - example: + תכונה נוספת שיש לציין את חשיבותה היא המשתנה ה<emphasis>סטאטי</emphasis>. + משתנה סטאטי קיים רק בטווח לוקאלי של פונקציה אך אינו מאבד + את ערכו לאחר סיום הרצת הפונקציה. לדוגמה: </simpara> <informalexample> @@ -814,13 +805,12 @@ </informalexample> <simpara> - This function is quite useless since every time it is called it - sets <varname>$a</varname> to <literal>0</literal> and prints - "0". The <varname>$a</varname>++ which increments the - variable serves no purpose since as soon as the function exits the - <varname>$a</varname> variable disappears. To make a useful - counting function which will not lose track of the current count, - the <varname>$a</varname> variable is declared static: + פונקציה זו היא חסרת תועלת לחלוטין כי בכל קריאה לפונקציה, מתאפס + ערכו של המשתנה <varname>$a</varname> והפונקציה תדפיס "0". + פעולת ה- <varname>$a++</varname> לא משרתת שום מטרה כי לאחר היציאה מהפונקציה, + המשתנה <varname>$a</varname> נעלם. כדי לייצר פונקצית ספירה + שימושית אסור לנו לאבד את הערך הנוכחי של <varname>$a</varname> ולכן + משתנה זה מוגדר כמשתנה סטאטי: </simpara> <informalexample> @@ -837,18 +827,16 @@ </informalexample> <simpara> - Now, every time the Test() function is called it will print the - value of <varname>$a</varname> and increment it. + עכשיו, בכל קריאה לפונקציה Test, יודפס ערכו של המשתנה <varname>$a</varname> + ואחר-כך יוגדל ערכו. </simpara> <simpara> - Static variables also provide one way to deal with recursive - functions. A recursive function is one which calls itself. Care - must be taken when writing a recursive function because it is - possible to make it recurse indefinitely. You must make sure you - have an adequate way of terminating the recursion. The following - simple function recursively counts to 10, using the static - variable <varname>$count</varname> to know when to stop: + אפשר להשתמש במשתנה סטאטי גם לצורך טיפול בפונקציות רקורסיביות. + פונקציה רקורסיבית היא פונקציה שקוראת לעצמה. בכתיבת פונקציות רקורסיביות יש לשים לב + בכתיבת תנאי הפסקה מתאים אחרת יווצר מצב שהפונקציה תרוץ באופן אינסופי. + הפונקציה הרקורסיבית הבאה פשוט סופרת עד 10 תוך שימוש במשתנה סטאטי- + <varname>$count</varname> כדי לדעת מתי לעצור: </simpara> <informalexample> @@ -872,12 +860,12 @@ </sect1> <sect1 id="language.variables.variable"> - <title>Variable variables</title> + <title>שמות משתנים שמשתנים</title> <simpara> - Sometimes it is convenient to be able to have variable variable - names. That is, a variable name which can be set and used - dynamically. A normal variable is set with a statement such as: + לעיתים זה נוח להשתמש בשמות משתנים - משתנים. כלומר, שם משתנה + יכול להקבע על-ידי התוכנית בצורה דינאמית. משתנה רגיל מקבל הצבה + באמצעות פקודה כגון: </simpara> <informalexample> @@ -889,10 +877,9 @@ </informalexample> <simpara> - A variable variable takes the value of a variable and treats that - as the name of a variable. In the above example, - <emphasis>hello</emphasis>, can be used as the name of a variable - by using two dollar signs. i.e. + משתנה ששמו משתנה לוקח את הערך של המשתנה ומתייחס אליו כאל שם משתנה. + בדוגמה הקודמת, המחרוזת <emphasis>hello</emphasis> יכולה לשמש גם כשם + משתנה על-ידי שימוש בשני סימני דולר: </simpara> <informalexample> @@ -904,10 +891,9 @@ </informalexample> <simpara> - At this point two variables have been defined and stored in the - PHP symbol tree: <varname>$a</varname> with contents "hello" and - <varname>$hello</varname> with contents "world". Therefore, this - statement: + בנקודה זו מוגדרים שני משתנים בטבלת הסמלים של PHP. המשתנה <varname>$a</varname> + שערכו "hello" והמשתנה <varname>$hello</varname> שערכו "world". + כפועל יוצא, הפקודה: </simpara> <informalexample> @@ -919,7 +905,7 @@ </informalexample> <simpara> - produces the exact same output as: + מייצרת פלט הזהה לפלט של: </simpara> <informalexample> @@ -931,49 +917,44 @@ </informalexample> <simpara> - i.e. they both produce: <computeroutput>hello world</computeroutput>. + שתי הדוגמאות ידפיסו: <computeroutput>hello world</computeroutput>. </simpara> <simpara> - In order to use variable variables with arrays, you have to - resolve an ambiguity problem. That is, if you write - <varname>$$a[1]</varname> then the parser needs to know if you - meant to use <varname>$a[1]</varname> as a variable, or if you - wanted <varname>$$a</varname> as the variable and then the [1] - index from that variable. The syntax for resolving this ambiguity - is: <varname>${$a[1]}</varname> for the first case and - <varname>${$a}[1]</varname> for the second. + כדי להשתמש בשם משתנה משתנה עם מערכים יש לפתור בעיית כפל + משמעות. כלומר, כאשר כותבים <varname>$$a[1]</varname> המפרש + צריך לדעת אם להשתמש ב- <varname>$a[1]</varname> כהגדרת שם למשתנה או + להשתמש ב- <varname>$$a</varname> כמשתנה בעל האינדקס [1] במערך. + התחביר לפתירת כפילות זו הוא : <varname>${$a[1]}</varname> במקרה בראשון + ו <varname>${$a}[1]</varname> במקרה השני. </simpara> </sect1> <sect1 id="language.variables.external"> - <title>Variables from outside PHP</title> + <title>משתנים מחוץ ל-PHP</title> <sect2 id="language.variables.external.form"> - <title>HTML Forms (GET and POST)</title> + <title>טפסי HTML (GET ו POST)</title> <simpara> - When a form is submitted to a PHP script, any variables from that - form will be automatically made available to the script by - PHP. If the <link linkend="ini.track-vars">track_vars</link> - configuration option is turned on, then these variables will be - located in the associative arrays + כאשר נשלח טופס לסקריפט PHP , כל המשתנים מטופס זה יהיו זמינים + בסקריפט. אם ההגדרה של <link linkend="ini.track-vars">track_vars</link> + מאופשרת, משתנים אלו ימוקמו במערכים האסוציאטיבים <varname>$HTTP_POST_VARS</varname>, - <varname>$HTTP_GET_VARS</varname>, and/or - <varname>$HTTP_POST_FILES</varname>, according to the - source of the variable in question. + <varname>$HTTP_GET_VARS</varname>, ו\או + <varname>$HTTP_POST_FILES</varname>, בהתאמה למקור + המשתנים. </simpara> <para> - For more information on these variables, please read <link - linkend="language.variables.predefined">Predefined - variables</link>. + למידע נוסף בנושא יש לעיין בפרק <link + linkend="language.variables.predefined">משתנים מוגדרים מראש</link>. </para> <para> <example> - <title>Simple form variable</title> + <title>משתנה פשוט בטופס</title> <programlisting role="php"> <![CDATA[ <form action="foo.php" method="post"> @@ -986,35 +967,36 @@ </para> <para> - When the above form is submitted, the value from the text input - will be available in - <varname>$HTTP_POST_VARS['username']</varname>. If the <link + כאר הטופס הנ"ל נשלח, הערך שמכיל שדה הטקסט בטופס יהיה זמין + במשתנה <varname>$HTTP_POST_VARS['username']</varname>. + אם אופציית <link linkend="ini.register-globals">register_globals</link> - configuration directive is turned on, then the variable will also - be available as <varname>$username</varname> in the global scope. + מאופשרת, המשתנה יוגדר גם כמשתנה <varname>$username</varname> + שמוגדר בטווח המשתנים הגלובלי. </para> <note> <para> - The <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> - configuration directive affects Get, Post and Cookie values. If - turned on, value (It's "PHP!") will automagically become (It\'s \"PHP!\"). - Escaping is needed for DB insertion. Also see - <function>addslashes</function>, <function>stripslashes</function> and + כאשר הוראת הקונפיגורציה <link linkend="ini.magic-quotes-gpc"> + magic_quotes_gpc</link> מאופשרת, מושפעים ערכי משתנים של GET, POST + וערכי עוגיות באופן שערך כמו <computeroutput> (It's "PHP!") </computeroutput> + ישתנה בצורה אוטומטית ל <computeroutput>(It\'s \"PHP!\")</computeroutput>. + תהליך זה נדרש לצורך הכנסת מידע לבסיס נתונים. + יש לעיין גם במידע על <function>addslashes</function>, +<function>stripslashes</function> ו- <link linkend="ini.magic-quotes-sybase">magic_quotes_sybase</link>. </para> </note> <simpara> - PHP also understands arrays in the context of form variables - (see the <link linkend="faq.html">related faq</link>). You may, - for example, group related variables together, or use this - feature to retrieve values from a multiple select input: + PHP מבינה גם תכני מערכים של טפסים. + (יש לעיין ב<link linkend="faq.html">שאלות ותשובות</link> למידע נוסף). + אפשר למשל להשתמש בתכונה זו על מנת לאחד משתנים מסויימים לקבוצות + או לקלוט מידע מתיבת בחירה רבת אפשרויות. </simpara> <para> <example> - <title>More complex form variables</title> + <title>משתני טופס מורכבים</title> <programlisting role="php"> <![CDATA[ <form action="array.php" method="post"> @@ -1034,16 +1016,16 @@ </para> <para> - In PHP 3, the array form variable usage is limited to - single-dimensional arrays. In PHP 4, no such restriction applies. + ב- PHP 3 קיימת הגבלה למימד אחד בלבד במערכי הטפסים. + ב- PHP 4 לא קיימת הגבלה כזו. </para> <sect3 id="language.variables.external.form.submit"> - <title>IMAGE SUBMIT variable names</title> + <title>משתני טופס של כפתור שליחה גרפי</title> <simpara> - When submitting a form, it is possible to use an image instead - of the standard submit button with a tag like:</simpara> + ניתן להגדיר תמונה ככפתור שליחה של טופס במקום כפתור שליחה סטנדרטי: + </simpara> <informalexample> <programlisting role="php"> @@ -1054,37 +1036,34 @@ </informalexample> <simpara> - When the user clicks somewhere on the image, the accompanying - form will be transmitted to the server with two additional - variables, sub_x and sub_y. These contain the coordinates of the - user click within the image. The experienced may note that the - actual variable names sent by the browser contains a period - rather than an underscore, but PHP converts the period to an - underscore automatically. + כאשר המשתמש ישלח את הטופס, משתני הטופס יועברו אל השרת ובנוסף + יועברו משתנים המציינים את מיקום הלחיצה של העכבר בתמונה ויוגדרו + כ- <varname>$sub_x</varname> ו-<varname>$sub_y</varname>. + יש לציין ששם המשתנה המקורי מכיל נקודה שמומרת ל קו-תחתי על-ידי PHP + באופן אוטומטי. </simpara> </sect3> </sect2> <sect2 id="language.variables.external.cookies"> - <title>HTTP Cookies</title> + <title>עוגיות HTTP</title> <simpara> - PHP transparently supports HTTP cookies as defined by <ulink - url="&spec.cookies;">Netscape's Spec</ulink>. Cookies are a - mechanism for storing data in the remote browser and thus - tracking or identifying return users. You can set cookies using - the <function>setcookie</function> function. Cookies are part of - the HTTP header, so the SetCookie function must be called before - any output is sent to the browser. This is the same restriction - as for the <function>header</function> function. Any cookies - sent to you from the client will automatically be turned into a - PHP variable just like GET and POST method data.</simpara> + PHP תומכת בצורה שקופה בעוגיות HTTP לפי הגדרתן ב- <ulink + url="&spec.cookies;">Netscape's Spec</ulink>. עוגיות הן + מנגנון המאפשר אגירת מידע בדפדפן ועל ידי-כך מאפשרות מעקב או + זיהוי המשתמשים. ניתן להגדיר עוגיה בעזרת הפונקציה <function>setcookie</function>. + עוגיות הן חלק מכותר ה- (HTTP header) HTTP ולכן קריאה לפונקציה + <function>setcookie</function> חייבת להתבצע לפני שנשלח + פלט כלשהו לדפדפן. הגבלה זהה חלה גם על הפונקציה <function>header</function>. + כל עוגיה שנשלחת מהלקוח הופכת באופן אוטומטי למשתנה PHP בדומה לאופן + הפעולה בשימוש ב שיטות GET ו- POST. + </simpara> <simpara> - If you wish to assign multiple values to a single cookie, just - add <emphasis>[]</emphasis> to the cookie name. For - example: + ניתן לקבוע לעוגיה אחת מספר ערכים על-ידי הוספת + <emphasis>[]</emphasis> לשם העוגיה. לדוגמה: </simpara> <informalexample> @@ -1096,14 +1075,14 @@ </informalexample> <simpara> - Note that a cookie will replace a previous cookie by the same - name in your browser unless the path or domain is different. So, - for a shopping cart application you may want to keep a counter - and pass this along. i.e. + יש לציין כי עוגיה שנקבעה תדרוס ערכים קודמים של עוגיה בעלת + שם זהה אלא אם מדובר בנתיב שונה או שם domain שונה כך שלבניית + אפליקציה של עגלת קניות, יש צורך להגדיר מונה ולהעבירו הלאה. + לדוגמה: </simpara> <example> - <title>SetCookie Example</title> + <title>דוגמת SetCookie</title> <programlisting role="php"> <![CDATA[ $Count++; @@ -1116,12 +1095,11 @@ </sect2> <sect2 id="language.variables.external.environment"> - <title>Environment variables</title> + <title>משתני סביבה</title> <para> - PHP automatically makes environment variables available as normal - PHP variables. - + PHP מגדירה באופן אוטומטי משתני סביבה כמשתני PHP רגילים. + <informalexample> <programlisting role="php"> <![CDATA[ @@ -1132,55 +1110,46 @@ </para> <para> - Since information coming in via GET, POST and Cookie mechanisms - also automatically create PHP variables, it is sometimes best to - explicitly read a variable from the environment in order to make - sure that you are getting the right version. The - <function>getenv</function> function can be used for this. You - can also set an environment variable with the - <function>putenv</function> function. + מאחר שגם המידע המגיע בעזרת GET, POST ומנגנון העוגיות נוצר + כמשתנה PHP רגיל בסקריפט, לפעמים עדיף לקרוא את משתנה הסביבה היישר מהסביבה + כדי לוודא שהתקבל הערך מהמקור הנכון. פונקציית <function>getenv</function> + משמשת לצורך זה. ניתן גם לקבוע משתנה סביבה בעזרת הפונקציה +<function>putenv</function>. </para> </sect2> <sect2 id="language.variables.external.dot-in-names"> - <title>Dots in incoming variable names</title> + <title>נקודות בשמות משתנים נקלטים</title> <para> - Typically, PHP does not alter the names of variables when they - are passed into a script. However, it should be noted that the - dot (period, full stop) is not a valid character in a PHP - variable name. For the reason, look at it: + בדרך-כלל PHP לא תשנה את שם המשתנה המועבר לסקריפט. אולם, יש לציין + כי תו הנקודה אינו תו תקין בשם משתנה. מסיבה זו הדוגמה הבאה לא תקינה: <programlisting role="php"> <![CDATA[ $varname.ext; /* invalid variable name */ ]]> </programlisting> - Now, what the parser sees is a variable named - <varname>$varname</varname>, followed by the string concatenation - operator, followed by the barestring (i.e. unquoted string which - doesn't match any known key or reserved words) 'ext'. Obviously, - this doesn't have the intended result. + במקרה זה המפרש יראה משתנה בשם <varname>$varname</varname>, + שאחריו אופורטור לחיבור מחרוזות ואחריו המילה 'ext' שאינה + מוכרת כמילה שמורה וחסרת הגדרה כלשהי. </para> <para> - For this reason, it is important to note that PHP will - automatically replace any dots in incoming variable names with - underscores. + מסיבה זו חשוב לציין שכאשר PHP מקבלת שם משתנה עם נקודה, + הנקודה תוחלף בקו-תחתי. </para> </sect2> <sect2 id="language.variables.determining-type-of"> - <title>Determining variable types</title> + <title>הבחנה בין סוגי משתנים</title> <para> - Because PHP determines the types of variables and converts them - (generally) as needed, it is not always obvious what type a given - variable is at any one time. PHP includes several functions - which find out what type a variable is. They are + ב- PHP אין הפרדה בין סוגי משתנים ובדרך-כלל התבצעות המרות + לפי הצורך ולכן לא תמיד ברור מהו סוג המשתנה בכל זמן נתון. + ב- PHP מספר פונקציות למציאת סוג המשתנה: <function>gettype</function>, <function>is_long</function>, <function>is_double</function>, <function>is_string</function>, - <function>is_array</function>, and + <function>is_array</function>, ו- <function>is_object</function>. </para> </sect2>