-1

I want to align the value data to right in the array push table. I couldn't do it. Thank you in advance.

foreach ($reps as $rep) {
    array_push($reptList,
        array(
            'id' => $rep->id,
            'value' => 'Rs. '.number_format($rep->value, 2),

        )
    );
}
Zac Webb
  • 653
  • 6
  • 22
Shana
  • 19
  • 2

2 Answers2

0

add span tag to your number value in array

foreach ($reps as $rep) {
                array_push($reptList,
                    array(
                        'id' => $rep->id,
                        'value' => 'Rs. <span style="text-align:right">'.number_format($rep->value, 2).'</span>',

                    )
                );
            }
Amit Gaud
  • 756
  • 6
  • 15
0

You can't do it via PHP.

In your view file html table, apply css for right text align.

Please refer this answer given by Matt Howell.

Community
  • 1
  • 1
Ravi Hirani
  • 6,511
  • 1
  • 27
  • 42