Re: Re: Patch-tastic!
| From: | Kristian Koehntopp | Date: | Thu, 06 Jun 2002 08:06:22 +0000 |
| Subject: | Re: Re: Patch-tastic! | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-84918@lists.php.net to get a copy of this message | ||
Am Mittwoch, 5. Juni 2002 16:41 schrieb Jason T. Greene:
> If '+' concatenates what does '-' do?
It drives you nuts.
At least it does so in pike, which is a (discretionary, it has a
type "mixed") statically typed language and overloads the
arithmetic operators for string types.
See
http://pike.roxen.com/documentation/tutorial/tutorial_5.html#5.1
for the full details. Here is the relevant excerpt:
operands: string + string
return type: string
In this case, any int or float is first converted to a string.
Then the two strings are concatenated and the resulting string
is returned.
operands: string - string
return type: string
A copy of the left string with all occurrences of the right
string removed.
operands: array(string) * string
return type: string
All the strings in the array are concatenated with the string on
the right in between each string. Example: ({"foo","bar"})*"-"
will return "foo-bar".
operands: string / string
return type: array(string)
In symmetry with the multiplication operator, the division
operator can split a string into pieces. The right string will
be split at every occurrence of the right string and an array
containing the results will be returned. Example: "foo-bar"/"-"
will return ({"foo","bar"})
Now if you would kindly look up the overloaded operator
definitions for arrays and hashes (called mappings in pike) and
after that retire to a secluded place _before_ you vomit?
Thank you,
Kristian