PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/php/callback/runme.php

#
PHP | 47 lines | 25 code | 15 blank | 7 comment | 0 complexity | 3bb65d3070c9428657770f5c850fe2ec MD5 | raw file
 1<?php
 2
 3# This file illustrates the cross language polymorphism using directors.
 4
 5require("example.php");
 6
 7# Class, which overwrites Callback::run().
 8
 9class PhpCallback extends Callback {
10  function run() {
11    print "PhpCallback.run()\n";
12  }
13};
14
15# Create an Caller instance
16
17$caller = new Caller();
18
19# Add a simple C++ callback (caller owns the callback, so
20# we disown it first by clearing the .thisown flag).
21
22print "Adding and calling a normal C++ callback\n";
23print "----------------------------------------\n";
24
25$callback = new Callback();
26$callback->thisown = 0;
27$caller->setCallback($callback);
28$caller->call();
29$caller->delCallback();
30
31print "\n";
32print "Adding and calling a PHP callback\n";
33print "------------------------------------\n";
34
35# Add a PHP callback.
36
37$callback = new PhpCallback();
38$callback->thisown = 0;
39$caller->setCallback($callback);
40$caller->call();
41$caller->delCallback();
42
43# All done.
44
45print "php exit\n";
46
47?>