Rev 11 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11 | Rev 13 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | * @return array(0x12, 0x23) |
29 | * @return array(0x12, 0x23) |
30 | */ |
30 | */ |
31 | // Doesn't need to be public, but it is a nice handy function, especially in the testcases |
31 | // Doesn't need to be public, but it is a nice handy function, especially in the testcases |
32 | public static function hexStrToArray($str) { |
32 | public static function hexStrToArray($str) { |
33 | $out = array(); |
33 | $out = array(); |
34 | - | ||
35 | $str = str_replace('\x', ' ', $str); |
34 | $str = str_replace('\x', '', $str); |
36 | $str = trim($str); |
35 | $str = trim($str); |
37 | $ary = explode(' ', $str); |
36 | $str = str_replace(' ', '', $str); |
38 | - | ||
- | 37 | $ary = str_split($str, 2); |
|
39 | foreach ($ary as &$a) { |
38 | foreach ($ary as &$a) { |
40 | $out[] = hexdec($a); |
39 | $a = hexdec($a); |
41 | } |
40 | } |
42 | - | ||
43 | return $out; |
41 | return $ary; |
44 | } |
42 | } |
45 | 43 | ||
46 | /** |
44 | /** |
47 | * @return string|false Outputs .<oid> for an absolute OID and <oid> for a relative OID. |
45 | * @return string|false Outputs .<oid> for an absolute OID and <oid> for a relative OID. |
48 | */ |
46 | */ |