如何在循环中添加值

时间:2018-01-07 21:40:45

标签: codeigniter-3

我有这个代码,假设总结来自特定的计数 功能,但我得到的是不同的

打印值假设为8但是得到4 4 4 4  我试过任何可能的方法让它工作,但对我来说很难,每一个建议,理想,推荐是非常需要的。 ,请问我该怎么办?或者我在做什么  这是代码

public function upgrade_admin_to_prime(){
            //get the admins
            $admin_users    =$this->get_admin_user();
            foreach($admin_users as $row){
                $admin_username     =$row['username'];
                //check if my downline that is my ingress downline is upto 2
                $downline_count =$this->count_if_downline_is_complete($admin_username);
                if($downline_count == 2){
                    //get my downline user
                    $downline_users =$this->list_my_downline($admin_username);
                    foreach($downline_users as $row){
                        $downline_username  =$row['downline_username'];
                        //check if user downline count is 4 
                        //$downline_count2  ='';
                        $downline_count2    =$this->count_if_downline_is_complete($downline_username);
                        $downline_count2    =$downline_count2+$downline_count2;
                        if($downline_count2 == 4){
                $downline_users3    == // array of 4 users 'favor','kane','samson','fish'
                            foreach($downline_users3 as $row){
                                $downline_username3     =$row['downline_username'];
                                $downline_count3    =2;
                                echo $downline_count3    =$downline_count3+$downline_count3;
                                if($downline_count3 == 8){
                                    echo "Yess oo";
                                }else{
                                    echo "nope";
                                }
                            }
                        }else{
                            echo '2nd Generation Downline user count is not complete yet'.br();
                        }
                    }
                }else{
                    echo 'your count is not complete yet'.br();
                }
            }
        }

我想这里的代码输出8给我,但它给了我4 4 4 4

$downline_count3   =2;
                                echo $downline_count3    =$downline_count3+$downline_count3;
                                if($downline_count3 == 8){
                                    echo "Yes oo";
                                }else{
                                    echo "nope";
                                }

0 个答案:

没有答案