Sophie

Sophie

distrib > Mandriva > 9.1 > i586 > by-pkgid > 3c88344d1f3d15057277d028d0022277 > files > 509

swig-1.3.11-4mdk.i586.rpm

<?php

	dl("libexample.so");

	/* Try to set the values of some global variables */

	$ivar = 42;
	$svar = -31000;
	$lvar = 65537;
	$uivar = 123456;
	$usvar = 61000;
	$ulvar = 654321;
	$scvar = -13;
	$ucvar = 251;
	$cvar = "S";
	$fvar = 3.14159;
	$dvar = 2.1828;
	$strvar = "Hello World";
	$cstrvar = "Goodbye";
	$iptrvar = new_int(37);
	$ptptr = new_point(37,42);
	$name = "Bill";

	echo "Variables (values printed from PHP)\n";

	echo "ivar	= $ivar\n";
	echo "svar	= $svar\n";
	echo "lvar	= $lvar\n";
	echo "uivar	= $uivar\n";
	echo "usvar	= $usvar\n";
	echo "ulvar	= $ulvar\n";
	echo "scvar	= $scvar\n";
	echo "ucvar	= $ucvar\n";
	echo "cvar	= $cvar\n";
	echo "fvar	= $fvar\n";
	echo "dvar	= $dvar\n";
	echo "strvar	= $strvar\n";
	echo "cstrvar	= $cstrvar\n";
	echo "iptrvar	= $iptrvar\n";
	echo "name	= $name\n";
	echo "ptptr	= $ptptr" , point_print($ptptr) , "\n";
	echo "pt	= $pt" , point_print($pt) , "\n";

	echo "\nVariables (values printed from C)\n";

	print_vars();

	echo "\nI'm going to try and update a structure variable.\n";

	$pt = $ptptr;

	echo "The new value is \n";

	pt_print();

	echo "You should see the value", point_print($ptptr), "\n";

	echo "\nNow I'm going to try and modify some read only variables\n";

	echo "Trying to set 'path'\n";

	/* Sadly this works */
	$path = "Whoa!";
	echo "Path = $path\n";

	echo "Trying to set 'status'\n";

	/* And this */
	$status = 0;
	echo "Status = $status\n";

?>