summaryrefslogtreecommitdiff
path: root/tests/php/phpt/variables/001-process_globals.phpt
blob: 022e99cb07e4de8cc009d2d7174303983044e1e4 (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
47
--TEST--
Global variables in PHP-CPP
--DESCRIPTION--
The author of the original: Jasper van Eck<jasper.vaneck@copernica.com>
--SKIPIF--
<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?>
--FILEEOF--
<?php

// we first need to set a number of globals
$b = 10;
$d = function($a,$b,$c) {
    return $a+$b+$c;
};

// fun global var
$e = array(
    function($a) {
        return $a;
    }
);


// call the C++ function that will do something
$d = TestVariables\process_globals();

// the global variable $a should not have the value 1
echo("a = $a\n");

// the variable $b should not be 11
echo("b = $b\n");

// $c should be an array with value 200
echo("c['member'] = ".$c['member']."\n");

// $d is overwritten and now is 6
echo("d = $d\n");

// e should be replaced by a string
echo("e = $e\n");

--EXPECT--
a = 1
b = 11
c['member'] = 200
d = 6
e = hello