Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Jayanthkumar's avatar

how to get array count

i am passing the array from one view to another, there i am retriving data also but i need the array count how to get that count

 public function pass_device_array(Request $request,$id, $enqid){
       
       $man=explode(',', $id);
       
        $row = DB::table('device')->whereIn('id',$man)->pluck('id');
        $row1 = DB::table('Enquiry')->where('id',$enqid)->first();
        
        return view('pages.newinvoice', ['row' => $row, 'row1' => $row1]);

    }

$man is having the list of array....

i need one more variable to hold the count of $id

how to do this

0 likes
10 replies
Snapey's avatar

3 year old thread

BASIC PHP SKILLS REQUIRED

1 like
aurelianspodarec's avatar

@Snapey Nothing to do with basic PHP. I was thinking that there would be a special Laravel function to get the count instead. Which of course there is but not in all instances. I suppose sometimes there's just different mindset to some challenges.

SanderEB's avatar

@Snapey If you don't have words, don't respond..... Not like you are adding anything useful anyway.

1 like
Snapey's avatar

@SanderEB And your point is? Can you see how hypocritical your reply is?

1 like

Please or to participate in this conversation.