What is the different between return ($row) and return $row in php

  • while ($stmt->fetch()) {
    $row[] = array('id'=>$id,'driver_id'=>$driver_id,'duty_date'=>$duty_date,'duty_timing_sec'=>$duty_timing_sec);

    	return ($row);
    	return "";

  • There is no different, Usually brackets used to grouping the calculation and get final value..

    Instead of,

    $amount = $price - $discount;
    return $amount;

    You can use,

    return ($price - $discount);

    But in your case, $row is an Array. Array is a single element, So no need brackets..

Log in to reply