1<?php
2$pwd = getcwd();
3$f = basename(__FILE__);
4$dir1 = $pwd."/".$f.".dir1";
5$dir2 = $pwd."/".$f.".dir2";
6$dir3 = $pwd."/".$f.".dir3";
7//invalid directory
8$dir4 = $pwd."/".$f.".dir4";
9$newdirs = array($dir1, $dir2, $dir3);
10
11$reldirs = array("dir1", "dir2", "dir3");
12
13function generate_next_rel_path() {
14	global $reldirs;
15	//create the include directory structure
16	$pathSep = ":";
17	$newIncludePath = "";
18	if(substr(PHP_OS, 0, 3) == 'WIN' ) {
19	   $pathSep = ";";
20	}
21	foreach($reldirs as $newdir) {
22	   $newIncludePath .= $newdir.$pathSep;
23	}
24	return "dir4".$pathSep . $newIncludePath;
25}
26
27function generate_next_path() {
28	global $newdirs, $dir4;
29	//create the include directory structure
30	$pathSep = ":";
31	$newIncludePath = "";
32	if(substr(PHP_OS, 0, 3) == 'WIN' ) {
33	   $pathSep = ";";
34	}
35	foreach($newdirs as $newdir) {
36	   $newIncludePath .= $newdir.$pathSep;
37	}
38	return $dir4.$pathSep . $newIncludePath;
39}
40
41
42function create_include_path() {
43
44	global $newdirs;
45	//create the include directory structure
46	$pathSep = ":";
47	$newIncludePath = "";
48	if(substr(PHP_OS, 0, 3) == 'WIN' ) {
49	   $pathSep = ";";
50	}
51	foreach($newdirs as $newdir) {
52	   mkdir($newdir);
53	   $newIncludePath .= $newdir.$pathSep;
54	}
55	return $newIncludePath;
56}
57
58function relative_include_path() {
59
60	global $reldirs;
61	//create the include directory structure
62	$pathSep = ":";
63	$newIncludePath = "";
64	if(substr(PHP_OS, 0, 3) == 'WIN' ) {
65	   $pathSep = ";";
66	}
67	foreach($reldirs as $newdir) {
68	   mkdir($newdir);
69	   $newIncludePath .= $newdir.$pathSep;
70	}
71	return $newIncludePath;
72}
73
74
75function teardown_include_path() {
76
77	global $newdirs;
78	// remove the directory structure
79	foreach($newdirs as $newdir) {
80	   rmdir($newdir);
81	}
82}
83
84function teardown_relative_path() {
85
86	global $reldirs;
87	// remove the directory structure
88	foreach($reldirs as $newdir) {
89	   rmdir($newdir);
90	}
91}
92?>
93