Jump to content
  • Hello visitors, welcome to the Hacker World Forum!

    Red Team 1949  (formerly CHT Attack and Defense Team) In this rapidly changing Internet era, we maintain our original intention and create the best community to jointly exchange network technologies. You can obtain hacker attack and defense skills and knowledge in the forum, or you can join our Telegram communication group to discuss and communicate in real time. All kinds of advertisements are prohibited in the forum. Please register as a registered user to check our usage and privacy policy. Thank you for your cooperation.

    TheHackerWorld Official

Recommended Posts

判断是否为空

if (!$cart_num || !$cart_info) return [];

 

数组循环

$compute_arr = ['coupon_price', 'integral_price', 'postage_price', 'use_integral', 'one_brokerage', 'two_brokerage', 'sum_true_price'];
foreach ($compute_arr as $field) {
    if (!isset($cart_info[$field]) || !$cart_info[$field] || $is_gift) {
        $new_cart_info[$field] = 0;
        continue;
    }
    $scale = 2;
    if ($field == 'use_integral') $scale = 0;

    if (!$i) {//拆出
        $new_cart_info[$field] = bcmul((string)$cart_num, bcdiv((string)$cart_info[$field], (string)$cart_info['cart_num'], 4), $scale);
    } else {
        $field_number = bcmul((string)bcsub((string)$cart_info['cart_num'], (string)$cart_num, 0), bcdiv((string)$cart_info[$field], (string)$cart_info['cart_num'], 4), $scale);
        $new_cart_info[$field] = bcsub((string)$cart_info[$field], (string)$field_number, $scale);
    }
}

 

数组长度

$data['uid'].count()

 

不等于

if($count !==$data['uid'].count()) {

}

 

字符串已逗号分隔为数组

explode(',', $data['uid'])

 

判断变量是否为数组

is_array($env)

 

Link to post
Link to comment
Share on other sites

 Share

discussion group

discussion group

    You don't have permission to chat.
    • Recently Browsing   0 members

      • No registered users viewing this page.
    ×
    ×
    • Create New...