forked from weburg/head-first-design-patterns-in-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
34 lines (30 loc) · 853 Bytes
/
Copy pathbootstrap.php
File metadata and controls
34 lines (30 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/*
* A couple of custom PHP utils to make the code work much more closely to the
* original Java source code.
*/
/*
* Put the lib dir on the include path for easy inclusion of library files
*/
INI_Set("include_path", INI_Get("include_path") . PATH_SEPARATOR . dirname(__FILE__) . DIRECTORY_SEPARATOR . "library");
/*
* Remove the first element off of the argv array, since it represents the file
* that was called and we only want arguments, in order to mimic Java's args.
*/
if (isset($_SERVER["argv"])) {
array_shift($_SERVER["argv"]);
}
/*
* Mimic all classes being in the same Java package by autoloading classes in
* the same directory
*/
function __autoload($className) {
require_once $className . ".php";
}
/*
* Mimic Java's println()
*/
function println($string_message = "") {
return print $string_message . "\n";
}
?>