Method `-()
- Method
`-
 
- mixed`-(- mixed- arg1)
 - mixed`-(- mixed- arg1,- mixed- arg2,- mixed...- extras)
 - mixed`-(- object- arg1,- mixed- arg2)
 - mixed`-(- mixed- arg1,- object- arg2)
 - int`-(- int- arg1,- int- arg2)
 - float`-(- float- arg1,- int|- float- arg2)
 - float`-(- int|- float- arg1,- float- arg2)
 - string`-(- string- arg1,- string- arg2)
 - array`-(- array- arg1,- array- arg2)
 - mapping`-(- mapping- arg1,- array- arg2)
 - mapping`-(- mapping- arg1,- mapping- arg2)
 - mapping`-(- mapping- arg1,- multiset- arg2)
 - multiset`-(- multiset- arg1,- multiset- arg2)
- Description
- Negation/subtraction/set difference. - Every expression with the - -operator becomes a call to this function, i.e.- -ais the same as- predef::`-(a)and- a-bis the same as- predef::`-(a,b). Longer- -expressions are normally optimized to one call, so e.g.- a-b-cbecomes- predef::`-(a,b,c).
- Returns
- If there's a single argument, that argument is returned negated. If - arg1is an object with an lfun::`-(), that function is called without arguments, and its result is returned.- If there are more than two arguments the result is: - `-(`-(.- arg1,- arg2), @- extras)- Otherwise, if - arg1is an object with an lfun::`-(), that function is called with- arg2as argument, and its result is returned.- Otherwise, if - arg2is an object with an lfun::``-(), that function is called with- arg1as argument, and its result is returned.- Otherwise the result depends on the argument types: - arg1can have any of the following types:- int|- float- The result is - arg1-- arg2- arg1or- arg2is a float.- string- The result is - arg1with all nonoverlapping occurrences of the substring- arg2removed. In cases with two overlapping occurrences, the leftmost is removed.- array|- mapping|- multiset- The result is like - arg1but without the elements/indices that match any in- arg2(according to `>, `<, `== and, in the case of mappings, hash_value).- The function is not destructive on the arguments - the result is always a new instance. 
- Note
- In Pike 7.0 and earlier the subtraction order was unspecified. 
- Note
- If this operator is used with arrays or multisets containing objects which implement lfun::`==() but not lfun::`>() and lfun::`<(), the result will be undefined. 
- See also