summaryrefslogtreecommitdiff
path: root/tests/cpp/include/variables/007-overloaded-operators.h
blob: 88b31170cb83c44da85d021da932fe56e084c52d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
 *
 *  Test variables
 *	007-overloaded-operators.phpt
 *
 */



namespace TestVariables {

	/*
	 * Test Php::Value overloaded operators
	 */
	void overloaded_op(Php::Parameters &params)
	{
	    Php::Value value = params[0];
	    if (value == "some string")
	    {
	        Php::out  << "value == 'some string'"  << std::endl;
	    }

	    if (value == 12)
	    {
	        Php::out  << "value == 12"  << std::endl;
	    }
	    else if (value > 100)
	    {
	        Php::out  << "value > 100" << std::endl;
	    }

	    value += 10;
	    Php::out << value << std::endl;
	    
	    int r1 = value - 8;
	    Php::out << r1 << std::endl;

	    double r2 = value*123.45;
	    Php::out << r2 << std::endl;

	    double r3 = value/123.45;
	    Php::out << r3 << std::endl;
	}

}