Announcement

Collapse
No announcement yet.

Does -1 work in miva_array_delete to delete everything in it?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Does -1 work in miva_array_delete to delete everything in it?

    When I want to make sure an array gets emptied out of everything--I want to wipe it out, so the next time though a loop there aren't any leftover array elements in the array surprising me--
    so far I have just put a big huge number in for the number of items to delete. But that came back to bite me... Apparently my number wasn't big enough.

    my question is... instead of something like
    <mvt:assign name="g.return_value" value="miva_array_delete(l.myarray, 1 , 999)" />
    Since I know is many of the api functions a -1 effectively means "all" if there isn't a specific application for a -1 value...

    will the following work no matter how many elements are in the array to get rid of everything?
    <mvt:assign name="g.return_value" value="miva_array_delete(l.myarray, 1 , -1)" />



    #2
    You can just use
    Code:
    <mvt:assign name="g.MyArray" value="''" />
    to delete array elements or object members.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment


      #3
      Thank you Kent!

      Comment

      Working...
      X