Skip to content

Commit

Permalink
Depersonalize variables.xml (GH-3835)
Browse files Browse the repository at this point in the history
At least we remove the grossest style guideline violations.  This still
partly reads like a tutorial, though.  And the page is long.
  • Loading branch information
cmb69 authored Oct 5, 2024
1 parent c08494c commit a885fa2
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions language/variables.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ $täyte = 'mansikka'; // valid; 'ä' is (Extended) ASCII 228.

<para>
By default, variables are always assigned by value. That is to say,
when you assign an expression to a variable, the entire value of
when an expression is assigned to a variable, the entire value of
the original expression is copied into the destination
variable. This means, for instance, that after assigning one
variable's value to another, changing one of those variables will
Expand Down Expand Up @@ -272,8 +272,8 @@ test();
such diagnostics then nothing at all will be outputted.
This is 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
and it has not been assigned a value within this scope.
Note 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
Expand Down Expand Up @@ -440,7 +440,7 @@ function test()
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
possible to make it recurse indefinitely. It has to be ensured to
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:
Expand Down Expand Up @@ -469,7 +469,7 @@ function test()
</para>

<para>
Prior to PHP 8.3.0, you could only initialize a static variable using
Prior to PHP 8.3.0, static variables could only be initialized using
a constant expression. As of PHP 8.3.0, dynamic expressions
(e.g. function calls) are also allowed:
</para>
Expand Down Expand Up @@ -640,8 +640,8 @@ Static object: object(stdClass)#3 (1) {

<simpara>
This example demonstrates that when assigning a reference to a static
variable, it's not <emphasis>remembered</emphasis> when you call the
<literal>&amp;get_instance_ref()</literal> function a second time.
variable, it is not <emphasis>remembered</emphasis> when the
<literal>&amp;get_instance_ref()</literal> function is called a second time.
</simpara>
</sect2>
</sect1>
Expand Down Expand Up @@ -718,11 +718,11 @@ echo "$a $hello";
</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]
In order to use variable variables with arrays,
an ambiguity problem has to be resolved. That is, if the parser sees
<varname>$$a[1]</varname> then it needs to know if
<varname>$a[1]</varname> was meant to be used as a variable, or if
<varname>$$a</varname> was wanted as the variable and then the <literal>[1]</literal>
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.
Expand All @@ -731,7 +731,7 @@ echo "$a $hello";
<simpara>
Class properties may also be accessed using variable property names. The
variable property name will be resolved within the scope from which the
call is made. For instance, if you have an expression such as
call is made. For instance, if there is an expression such as
<varname>$foo->$bar</varname>, then the local scope will be examined for
<varname>$bar</varname> and its value will be used as the name of the
property of <varname>$foo</varname>. This is also true if
Expand Down Expand Up @@ -824,7 +824,7 @@ I am r.
</para>

<para>
There are only two ways to access data from your HTML forms.
There are only two ways to access data from HTML forms.
Currently available methods are listed below:
</para>

Expand All @@ -843,8 +843,8 @@ echo $_REQUEST['username'];
</para>

<para>
Using a GET form is similar except you'll use the appropriate
GET predefined variable instead. GET also applies to the
Using a GET form is similar except the appropriate
GET predefined variable can be used instead. GET also applies to the
<literal>QUERY_STRING</literal> (the information after the '?' in a URL). So,
for example, <literal>http://www.example.com/test.php?id=3</literal>
contains GET data which is accessible with <varname>$_GET['id']</varname>.
Expand All @@ -861,9 +861,9 @@ echo $_REQUEST['username'];

<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. For
(see the <link linkend="faq.html">related faq</link>).
For example, related variables may be grouped together, or this
feature may be used to retrieve values from a multiple select input. For
example, let's post a form to itself and upon submission display
the data:
</simpara>
Expand Down Expand Up @@ -941,7 +941,7 @@ if ($_POST) {
PHP transparently supports HTTP cookies as defined by <link
xlink:href="&url.rfc;6265">RFC 6265</link>. Cookies are a
mechanism for storing data in the remote browser and thus
tracking or identifying return users. You can set cookies using
tracking or identifying return users. It is possible to 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
Expand All @@ -960,8 +960,8 @@ if ($_POST) {
</note>

<simpara>
If you wish to assign multiple values to a single cookie variable, you
may assign it as an array. For example:
If multiple values should be assigned to a single cookie variable,
they can be assigned as an array. For example:
</simpara>

<informalexample>
Expand All @@ -977,16 +977,16 @@ if ($_POST) {

<simpara>
That will create two separate cookies although <varname>MyCookie</varname> will now
be a single array in your script. If you want to set just one cookie
with multiple values, consider using <function>serialize</function> or
be a single array in the script. If just one cookie should be set
with multiple values, consider using <function>serialize</function> or
<function>explode</function> on the value first.
</simpara>

<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.
name in the browser unless the path or domain is different. So,
for a shopping cart application a counter may be kept,
and passed along. I.e.
</simpara>

<example>
Expand Down

0 comments on commit a885fa2

Please sign in to comment.