phplaravelechoddvar-dump

Printing in a loop with echo or var_dump gives three values, but dd() only gives the first value


I have one matching row in my query.

echo $result gives 100

dd($result) gives 1

var_dump($result) gives int(1) int(0) int(0)

What's going on here?

Relevant code:

$results= DB::table('answers')->where('qid', $question->id)->where('answer', 'yes')->count();

Solution

  • Turns out I'm an idiot, it's within a foreach statement and iterating 3 times.