Array list.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpmagesh
    New Member
    • Nov 2008
    • 119

    Array list.

    Hi,

    I have little bit idea about array, but this code i feel some what complicated for me. can any one help me in this please,

    Code:
    $total = number_format((float)strip_tags($order->totals[4][text]), 2,',','');
    Can anyone explain me how values will be present inside that totals[4][text]. actually $order->totals[4][text].what it mean here.

    Please can any one help me in this please.

    Regards
    magesh
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    $order->totals[4][text] accesses a property of a class of which $order is an instance. That property is a multidimensiona l array.

    If you would like to elaborate on your problem, then I could help more.

    Comment

    • phpmagesh
      New Member
      • Nov 2008
      • 119

      #3
      Originally posted by Markus
      $order->totals[4][text] accesses a property of a class of which $order is an instance. That property is a multidimensiona l array.

      If you would like to elaborate on your problem, then I could help more.
      Array table:
      Code:
       $totals_query = xtc_db_query("select title, text from " .TABLE_ORDERS_TOTAL . " where orders_id = '" . xtc_db_input($order_id) . "' order by sort_order");
       while ($totals = xtc_db_fetch_array($totals_query)) {
       $this->totals[] = array('title' => $totals['title'],'text' => $totals['text']);
      /****************************************/
      
      $total = number_format((float)strip_tags($order->totals[4][text]), 2,',','');
      for example title will show sub total, main total etc.. in text field it will show the amount like 1234,89 and 345,32 etc...,

      but i ma not getting the number format as i mentioned in the number format function it simply showing the value as say 1234.43 instead of 1234,43.

      what will be the problem, can anyone explain this please.


      Regards
      magesh

      Comment

      Working...