| Example 1.1. PHP-GTK Hello World Program Listing
This example is from the manual
<?php
if (!class_exists('gtk')) {
if (strtoupper(substr(PHP_OS, 0,3) == 'WIN'))
dl('php_gtk.dll');
else
dl('php_gtk.so');
}
function delete_event()
{
return false;
}
function shutdown()
{
print("Shutting down...\n");
gtk::main_quit();
}
function hello()
{
global $window;
print "Hello World!\n";
$window->destroy();
}
$window = &new GtkWindow();
$window->connect('destroy', 'shutdown');
$window->connect('delete-event', 'delete_event');
$window->set_border_width(10);
$button = &new GtkButton('Hello World!');
$button->connect('clicked', 'hello');
$window->add($button);
$window->show_all();
gtk::main();
?>
|