mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Type casting can be used.
This commit is contained in:
parent
dcb828d983
commit
1f44ed29aa
2 changed files with 4 additions and 4 deletions
|
@ -121,8 +121,8 @@ function sort_multi_array($sort_array, $key, $sort_order, $pre_string_sort = 0)
|
|||
// do checks based on key
|
||||
$switch = false;
|
||||
if (!$string_sort) {
|
||||
if (($sort_order == 'DESC' && intval(@$sort_array[$j][$key]) < intval(@$sort_array[$j + 1][$key])) ||
|
||||
($sort_order == 'ASC' && intval(@$sort_array[$j][$key]) > intval(@$sort_array[$j + 1][$key]))) {
|
||||
if (($sort_order == 'DESC' && (int)(@$sort_array[$j][$key]) < (int)(@$sort_array[$j + 1][$key])) ||
|
||||
($sort_order == 'ASC' && (int)(@$sort_array[$j][$key]) > (int)(@$sort_array[$j + 1][$key]))) {
|
||||
$switch = true;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -703,7 +703,7 @@ function bdecode_r($str, &$pos)
|
|||
return null;
|
||||
} else {
|
||||
$pos++;
|
||||
return floatval(substr($str, $spos, $numlen));
|
||||
return (float)substr($str, $spos, $numlen);
|
||||
}
|
||||
} elseif ($str[$pos] == 'd') {
|
||||
$pos++;
|
||||
|
@ -757,7 +757,7 @@ function bdecode_r($str, &$pos)
|
|||
if (($pos >= $strlen) || ($str[$pos] != ':')) {
|
||||
return null;
|
||||
} else {
|
||||
$vallen = intval(substr($str, $spos, $numlen));
|
||||
$vallen = (int)substr($str, $spos, $numlen);
|
||||
$pos++;
|
||||
$val = substr($str, $pos, $vallen);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue