-
Notifications
You must be signed in to change notification settings - Fork 61
/
extensions.php
71 lines (63 loc) · 1.52 KB
/
extensions.php
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* This builds the table of supported PHP extensions
*/
$ports=array(8051,8052,8053,8054,8055,8056,8070,8071,8072,8073,8074,8080,8000);
# Ensure that chars show in browser correctly.
header('Content-Type: text/plain; charset=utf-8');
# fetch extension info
$allmods = array();
foreach($ports as $k => $port) {
$mods = @file("http://localhost:$port/?modules");
if(!$mods || substr(trim($mods[0]),0,1) == '<') {
# not the response we're looking for
unset($ports[$k]);
continue;
}
foreach($mods as $mod) {
$mod = trim($mod);
if($mod == 'core') continue;
$allmods[$mod][$port] = 1;
}
}
$ports = array_values($ports);
ksort($allmods);
# Build table header:
# Extension | PHP 5.1 | PHP 5.2 | ... | PHP 7.1
print 'Extension ';
foreach($ports as $port) {
$major = substr($port,2,1);
$minor = substr($port,3,1);
if($major) {
$version = "PHP $major.$minor";
} else {
$version = "nightly";
}
echo '| '.$version.' ';
}
echo "\n";
#
# Line below header.
#
# Right colon for right alignment.
echo '------------:';
foreach($ports as $port) {
# Colons on both sides for centre alignment.
echo '|:-------:';
}
echo "\n";
#
# Output modules table.
#
foreach($allmods as $mod => $inf) {
# Left align mod name, and pad with spaces.
printf('%-12s ', $mod);
foreach($ports as $port) {
if(isset($inf[$port])) {
echo '| ✓ ';
} else {
echo '| ';
}
}
echo "\n";
}