<?php

print("hello world!\n"); //this is my comment?> <?print("this will be seen!");?><?
try {
    echo 1;
    return;
} catch(Exception $e) {
    echo 2;
} catch(Exception $e) {
   echo 22;
}
echo 3;
?>


<?
try {
        echo 1;
} catch(Exception $e) {
        echo 2;
        return;
}
echo 3;
?>



<?
function test() 
{ 
        $fields['company'] = ''; 
        $fields['contact'] = ''; 
        $fields['email'] = ''; 
         
        return $fields; 
}
$x = test();
var_dump($x);
?>

<?php

function get_UID() {
global $User;
if (get_class($User)=='jwuser') {
return ($User->uid);
} else {
return 0; 
}
}
?>


<? 
function GetHelpline() {
/**
* Returns the helpline number set
*/

if ($this->GetCountry() == "uk") return
$this->texts["text"]["helpline-en"];
if ($this->GetCountry() == "ire") return
$this->texts["text"]["helpline-ire"];
if ($this->GetCountry() == "nz") return
$this->texts["text"]["helpline-nz"];
else return $this->texts["text"]["helpline-ot"];
}
?>


<?
function fromUpload($data) {
	$img = new CImage;
 	$img->imageFilename = ObjectState::createID();
 	$img->imageMimeType = 'image/jpeg';
 	$img->uploadedFile = $data['tmp name'];
 	return $img;
 }
?>


<?php

    // Returns an indexed array of associative arrays (including keys 'key',
    // 'name', 'desc', 'authorname', 'authorcontact', bool 'package_loaded',
    // array 'modules', array 'loaded_modules') of all currently registered
    // packages
    function EnumeratePackages()
    {
        // The array that's holding our output
        $out = array();

        // Grab a Modules object
        $m = &Modules::singleton();

        // Go through our registry
        foreach ($this->_registry as $package)
        {
            // Create the associative array for this element
            $element = array(
                'key' => $package->key,
                'name' => $package->name,
                'desc' => $package->desc,
                'authorname' => $package->authorname,
                'authorcontact' => $package->authorcontact,
                'package_loaded' =>
                    in_array($this->_loaded_packages, $package->key),
                'modules' => $m->EnumModulesByKey($package->key),
                'modules_loaded' => $m->EnumLoadedModulesByKey($package->key)
                );

            // Add element to output array
            $out[$package->key] = $element;
        }

        // Return output array
        return $out;
    }

?>


<?php
$db = ("John");
	  	    
function display(){
	global $db;
	var_dump($db);
}

display();
?>


<?
function adds($var1, $var2){
	$i= $var1+$var2;
	if($i>10) 
		return $i;
	else
		return(adds($i,$i));
}
?>

<?php
if(print("hello")){
	print("\ngood\n");
}

?><?php
/******************************************/
/******currently doesn't work well!!!******/
/******************************************/

$a=array(1,3,"a",7,0,"b",9);

if($a[0]){
	print("that's good\n");
}

if($a[4]){
	print("that's bad\n");
}

 if(($a=array(1,2))){
 print("bye");
 }


?><?php

print("hello world!\n"); //this is my comment?> <?print("this will be seen!");?><?php

print("hello world!\n"); //this is my comment?> <?print("this will be seen!");?><?php
if(print("hello")){
	print("\ngood\n");
}

?><?php
class Foo{
	var $x;
	function hell(){}
}

if($a=new Foo()){
	print("bye");
}
?> <?php

function hello($x,$y){
	print("$x $y");
}

hello(1,&$a);
?><?php
$x=1;
$y=0;

if($x==1)
if($y==0)
print("hello");
else print("else");
?><?php
define(foo,1);

$a=foo;
print("$a");


define('boo',11);
$b=boo;
print("\n$b");
?><?php
define("foo");
$a=foo;
print("$a");
?><?php
$foo =2;
$i=5;
while($i)
{
	if($i<=0) break;
	while($i)
	{
		if($i<=0) break;
		while($i)
		{
			if($i<=0) break;
			while($i)
			{
				if($i<=0) break;
				break $foo;
			}
			print("level1\n");
			--$i;
		}
		print("level2\n");
		--$i;
	}
	print("level3\n");
	--$i;
}
print("level 4 - end\n");
?><?php
while(1){
	while(1){
		while(1){
			while(1){
				while(1){
					while(1){
						break 1000;
					}
				}
			}
		}
	}
}

print("the end");
?>
	<?php

function hello_world($x,$y,$z)
{
	$z=$y=$x=0;
	$y=$x;
	$y=$z;
	$z=$y;
	$obj=new myClass();
	$obj->myFunc(1,8);
}

class myClass{
	var $a;
	function myFunc($m,$n)
	{
		print("$m is the result");
	}
}

hello_world(1,2,3);
?><?

function hello($x){
	print("\nhello: $x\n");
}

function globalHello($y){
	global $myVar;
	print("\ngHello: $y\n");
}

hello(2);
globalHello(4);

?>
<?php

function useMe()
{
	if($x<10)
	print("the value is: $x\n");
}

useMe(9);
?>
<?php
while($a<7)
{
	print("ok");
	$a++;
}
?>
	<?php
while($a<7)
{
	print("ok");
	$a++;
}
?>
	<?php
class NumberClass{
	function twoer()
	{
		$x=2;
		return $x;
	}
	
	function oner()
	{
		$x=3;
		$x++;
		return 1;
	}
}

$a=new NumberClass();
$res=$a->oner();
print("$res");
$res=$a->twoer();
print("$res");
?><?php
function changeMe(&$x)
{
	$x=3;
	print("changed to 3!\n");
}

function DONTchangeMe(&$x)
{
	print("i am what i am which is $x\n");
}

$varvar=99;
DONTchangeMe($varvar);
changeMe($varvar);
?><?php
function changeMe(&$x)
{
	$x=3;
	print("changed to 3!\n");
}

function DONTchangeMe(&$x)
{
	print("i am what i am which is $x\n");
}

$varvar=99;
DONTchangeMe($varvar);
changeMe($varvar);
?><?php
function MyReTUrn($x)
{
	if($x>5)
	return 1;
	elseif($x>0)
	return 2;
	else
	return;
}

$res=MyReTUrn(7);
print("i got $res\n");
?><?php
function noResponse($x)
{
	if($x>0) {};
}

$x=noResponse(-9);
print("$x");
?><?php
function noResponse($x)
{
	if($x>0) {};
}

$x=noResponse(-9);
print("$x");
?>?><?php
$path='c:\Documents and Settings\dubi\Desktop\test\1.php';
include($path);
include_once($path);
require($path);
require_once($path);
?>
<?php

$a=array(1,3,"a",7,0,"b",9);

if($a[0]){
	print("that's good\n");
}

if($a[4]){
	print("that's bad\n");
}

if($a=array(1,5,"a",7)){
	print("that's a mistake!\n");\
}

$c=0;	
if($c=array(1,5,"a",7)){
	print("that's a mistake!\n");
}

?><?
$variable = 1;
for($i=0;$i<10;$i++) {
    $variable += $i;
    if($variale > 10) { // typo here!
        echo $i;
    }
}
?><?
if (time() %2 == 0){
  $boolean = true;
}
else{
  $boolean = false;
}

	
if($boolean){
  print ("Zugi\n");
  exit ;
}
else{
 print ("I zugi\n");
 //if ($boolean==0)
 exit;
}
?>

abc 

<?php
if(1)
{
	print("hello");
}
else
{
	print("bye");
}
?>Source)