php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
build_precommand.php
Go to the documentation of this file.
1#!/usr/bin/php
2<?php echo '<'.'?php';?>
3
12foreach(array("SPL", "Reflection", "Phar") as $ext) {
13 if (!extension_loaded($ext)) {
14 echo "$argv[0] requires PHP extension $ext.\n";
15 exit(1);
16 }
17}
18
19<?php
20
21$classes = array(
22 'DirectoryTreeIterator',
23 'DirectoryGraphIterator',
24 'InvertedRegexIterator',
25 'CLICommand',
26 'PharCommand',
27 );
28
29foreach($classes as $name) {
30 echo "if (!class_exists('$name', 0))\n{\n";
31 $f = file(dirname(__FILE__) . '/phar/' . strtolower($name) . '.inc');
32 unset($f[0]);
33 $c = count($f);
34 while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n")) {
35 unset($f[$c--]);
36 }
37 if (substr($f[$c], -2) == "\r\n") {
38 $f[$c] = substr($f[$c], 0, -2);
39 }
40 if (substr($f[$c], -1) == "\n") {
41 $f[$c] = substr($f[$c], 0, -1);
42 }
43 if (substr($f[$c], -2) == '?>') {
44 $f[$c] = substr($f[$c], 0,-2);
45 }
46 while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n")) {
47 unset($f[$c--]);
48 }
49 echo join('', $f);
50 echo "\n}\n\n";
51}
52
53echo 'new PharCommand($argc, $argv);'."\n";
54
55?>
file(string $filename, int $flags=0, $context=null)
dirname(string $path, int $levels=1)
strtolower(string $string)
join(string|array $separator, ?array $array=null)
count(Countable|array $value, int $mode=COUNT_NORMAL)
substr(string $string, int $offset, ?int $length=null)
strlen(string $string)
exit(string|int $status=0)
extension_loaded(string $extension)