Subversion Repositories php-qbpwcf

Rev

Rev 3 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
#!/usr/bin/php
2
<?php
3
 
4
/*
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
226 liveuser 6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
3 liveuser 7
 
8
    This file is part of QBPWCF.
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
12
    the Free Software Foundation, either version 3 of the License, or
13
    (at your option) any later version.
14
 
15
    QBPWCF is distributed in the hope that it will be useful,
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
19
 
20
    You should have received a copy of the GNU General Public License
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
226 liveuser 22
 
3 liveuser 23
*/
24
 
25
/*
226 liveuser 26
轉換數值,從16進位到10進位.
3 liveuser 27
*/
28
 
29
#如果不存在要轉換成16進位的數值
30
if(!isset($_SERVER['argv'][1]))
31
{
32
	#show help
33
	help();
34
 
35
	#停止執行
36
	exit;
37
}
38
 
39
#印出 16 進位的數值
40
$output=sprintf('%X',$_SERVER['argv'][1]);
41
 
42
if($output==="0" & $_SERVER['argv'][1]!=="0")
43
{
44
	#show help
45
	help();
226 liveuser 46
 
3 liveuser 47
	#停止執行
48
	exit;
49
}
50
 
51
#印出結果
52
echo $output.PHP_EOL;
53
 
54
#help function
55
function help()
56
{
57
	echo $_SERVER['argv'][0]." 10進位數值".PHP_EOL;
58
}
59
 
60
?>