@@ -38,12 +38,17 @@ extension = /path/filebin.so
38
38
39
39
## Proto types:
40
40
``` php
41
- filebin (string path, int flag = MAGIC_NONE, string magic_path = MIGIC_FILE): string|NULL
42
- filebin (string path, string magic_path = MIGIC_FILE, int flag = MAGIC_NONE): string|NULL
41
+ filebin (string path, int flag = MAGIC_NONE, string magic_path = MIGIC_FILE): string|false
42
+ filebin (string path, string magic_path = MIGIC_FILE, int flag = MAGIC_NONE): string|false
43
43
```
44
44
45
45
The 2th argument and the 3th argument can be swapped with each other.
46
46
47
+ ** Return value :**
48
+ if success, return mime strings.
49
+ if failure, return false.
50
+
51
+
47
52
## Constant
48
53
Name | Value
49
54
-- | --
@@ -87,7 +92,7 @@ Name | Description
87
92
** Most common usage** :
88
93
``` php
89
94
<?php
90
- if ( ($buf = filebin ('modules/filebin.so')) != null )
95
+ if ( ($buf = filebin ('modules/filebin.so')) != false )
91
96
echo "$buf\n";
92
97
?>
93
98
@@ -98,7 +103,7 @@ ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, Buil
98
103
** Execute with custom MAGIC file** :
99
104
``` php
100
105
<?php
101
- if ( ($buf = filebin ('modules/filebin.so', '/usr/share/misc/magic.mgc')) != null )
106
+ if ( ($buf = filebin ('modules/filebin.so', '/usr/share/misc/magic.mgc')) != false )
102
107
echo "$buf\n";
103
108
?>
104
109
@@ -108,7 +113,7 @@ ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, Buil
108
113
109
114
** Get only file mime type** :
110
115
``` php
111
- if ( ($buf = filebin ('modules/filebin.so', MAGIC_MIME_ENCODING)) != null )
116
+ if ( ($buf = filebin ('modules/filebin.so', MAGIC_MIME_ENCODING)) != false )
112
117
echo "$buf\n";
113
118
?>
114
119
@@ -118,7 +123,7 @@ binary
118
123
119
124
** Get only file mime type with custom MAGIC file** :
120
125
``` php
121
- if ( ($buf = filebin ('modules/filebin.so', MAGIC_MIME, '/usr/share/misc/magic.mgc')) != null )
126
+ if ( ($buf = filebin ('modules/filebin.so', MAGIC_MIME, '/usr/share/misc/magic.mgc')) != false )
122
127
echo "$buf\n";
123
128
?>
124
129
@@ -128,7 +133,7 @@ application/x-sharedlib; charset=binary
128
133
129
134
** Can enable to swap 2th and 3th argument each other** :
130
135
``` php
131
- if ( ($buf = filebin ('modules/filebin.so', MAGIC_MIME, '/usr/share/misc/magic.mgc')) != null )
136
+ if ( ($buf = filebin ('modules/filebin.so', MAGIC_MIME, '/usr/share/misc/magic.mgc')) != false )
132
137
echo "$buf\n";
133
138
?>
134
139
0 commit comments