php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
phar.php
Go to the documentation of this file.
1#!/usr/local/bin/php
2<?php
3
12
13if (!extension_loaded('phar'))
14{
15 if (!class_exists('PHP_Archive', 0)) {
16 echo "Neither Extension Phar nor class PHP_Archive are available.\n";
17 exit(1);
18 }
19 if (!in_array('phar', stream_get_wrappers())) {
20 stream_wrapper_register('phar', 'PHP_Archive');
21 }
22 if (!class_exists('Phar',0)) {
23 require 'phar://'.__FILE__.'/phar.inc';
24 }
25}
26
27foreach(array("SPL", "Reflection") as $ext)
28{
29 if (!extension_loaded($ext)) {
30 echo "$argv[0] requires PHP extension $ext.\n";
31 exit(1);
32 }
33}
34
36{
37 $file = 'phar://' . __FILE__ . '/' . $file;
38 if (file_exists($file)) {
39 include($file);
40 }
41}
42
43function command_autoload($classname)
44{
45 command_include(strtolower($classname) . '.inc');
46}
47
49
50spl_autoload_register('command_autoload');
51
52new PharCommand($argc, $argv);
53
54__HALT_COMPILER();
55
56?>
in_array(mixed $needle, array $haystack, bool $strict=false)
file_exists(string $filename)
stream_wrapper_register(string $protocol, string $class, int $flags=0)
stream_get_wrappers()
strtolower(string $string)
static mapPhar(?string $alias=null, int $offset=0)
$file
Definition encryption.php:9
command_autoload($classname)
Definition phar.php:43
if(!extension_loaded('phar')) foreach(array("SPL", "Reflection") as $ext) command_include($file)
Definition phar.php:35
spl_autoload_register(?callable $callback=null, bool $throw=true, bool $prepend=false)
class_exists(string $class, bool $autoload=true)
exit(string|int $status=0)
extension_loaded(string $extension)