~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Examples/php/variables/runme.php4.old

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2009-11-15 14:00:28 UTC
  • mfrom: (1.2.9 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091115140028-me7amr2rie8zz1xn
Tags: 1.3.40-2ubuntu1
* Merge from Debian testing (LP: #356529), remaining changes:
  - Drop libchicken-dev from the build-depends (it's in universe)
  - Remove Pike from package description and from configure flags
  - drop "--without-mzscheme", we don't have it in our build-depends
  - use php-config5
  - Clean Runtime/ as well.
  - debian/rules (clean): Remove Lib/ocaml/swigp4.ml.
* debian/rules: Remove hardcoded python version.
* Remove upper limit for python from Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
### THIS VERSION was written for when php global vars fakingly mirrored
 
3
### the wrapped global vars, but it was very inefficient.
 
4
### For now we don't do this (pending some changes to php itself) so
 
5
### we use accessor functions instead; WE KEEP THIS version around ready
 
6
### for when those php changes are made and we can switch back.
 
7
### Specifically we want $_GLOBALS variable overloading like object 
 
8
### property overloading
 
9
 
 
10
        require "example.php";
 
11
 
 
12
        /* Try to set the values of some global variables */
 
13
 
 
14
        $ivar = 42;
 
15
        $svar = -31000;
 
16
        $lvar = 65537;
 
17
        $uivar = 123456;
 
18
        $usvar = 61000;
 
19
        $ulvar = 654321;
 
20
        $scvar = -13;
 
21
        $ucvar = 251;
 
22
        $cvar = "S";
 
23
        $fvar = 3.14159;
 
24
        $dvar = 2.1828;
 
25
        $strvar = "Hello World";
 
26
        $cstrvar = "Goodbye";
 
27
        $iptrvar = new_int(37);
 
28
        $ptptr = new_point(37,42);
 
29
        $name = "Bill";
 
30
 
 
31
        echo "Variables (values printed from PHP)\n";
 
32
 
 
33
        echo "ivar      = $ivar\n";
 
34
        echo "svar      = $svar\n";
 
35
        echo "lvar      = $lvar\n";
 
36
        echo "uivar     = $uivar\n";
 
37
        echo "usvar     = $usvar\n";
 
38
        echo "ulvar     = $ulvar\n";
 
39
        echo "scvar     = $scvar\n";
 
40
        echo "ucvar     = $ucvar\n";
 
41
        echo "cvar      = $cvar\n";
 
42
        echo "fvar      = $fvar\n";
 
43
        echo "dvar      = $dvar\n";
 
44
        echo "strvar    = $strvar\n";
 
45
        echo "cstrvar   = $cstrvar\n";
 
46
        echo "iptrvar   = $iptrvar\n";
 
47
        echo "name      = $name\n";
 
48
        echo "ptptr     = $ptptr" , point_print($ptptr) , "\n";
 
49
        echo "pt        = $pt" , point_print($pt) , "\n";
 
50
 
 
51
        echo "\nVariables (values printed from C)\n";
 
52
 
 
53
        print_vars();
 
54
 
 
55
        echo "\nI'm going to try and update a structure variable.\n";
 
56
 
 
57
        $pt = $ptptr;
 
58
 
 
59
        echo "The new value is \n";
 
60
 
 
61
        pt_print();
 
62
 
 
63
        echo "You should see the value", point_print($ptptr), "\n";
 
64
 
 
65
        echo "\nNow I'm going to try and modify some read only variables\n";
 
66
 
 
67
        echo "Trying to set 'path'\n";
 
68
 
 
69
        /* Sadly this works */
 
70
        $path = "Whoa!";
 
71
        echo "Path = $path\n";
 
72
 
 
73
        echo "Trying to set 'status'\n";
 
74
 
 
75
        /* And this */
 
76
        $status = 0;
 
77
        echo "Status = $status\n";
 
78
 
 
79
?>
 
80