If used in a regular expression, it means the beginning of a line, eg:
ereg ("^string", "no match string"); // returns false
ereg ("^string", "string match"); // returns true
If used as a comparison operator, it returns the bitwise XOR, that is, it will return true if one and only one of the arguments is true, eg:
(true ^ false) returns true;
(true ^ true) returns false;
(false ^ true) returns true;
(false ^ false) returns false;
It has a similar function when used as an assignment operator.
If used in an assignment operator, it's a little tricky. It sets the left side to the bitwise XOR of the variable to be assigned and the assigned value (right and left side). The assigned variable will be false if one of either of them is true, eg:
$test ^= false; // $test will be false, because they are both false (empty variables are false)
$test ^= true; // $test will be set to true, as one value is false and one is true.
$test ^= true; // $test will now be false, because both values are true.
2007-11-08 09:28:04
·
answer #1
·
answered by socratesone 3
·
0⤊
0⤋
As far as I know, it is only used in maths functions, meaning "exponent", i.e. 3^2 = 3².
It may exist for other purpose, but never saw it.
2007-11-08 16:19:28
·
answer #2
·
answered by just "JR" 7
·
0⤊
0⤋
The caret symbol is used in regular expressions and what it means depends on where in the expression it is used.
http://www.regular-expressions.info/reference.html
2007-11-08 15:54:13
·
answer #3
·
answered by tj 6
·
0⤊
0⤋