#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    114
    Rep Power
    15
    this works well enough when all the elements in $HTTP_POST_VARS are scalars, but it doesn't work so hot if one or more of them is an array:
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    while(list($key,$val)=each($HTTP_POST_VARS))
    {
    $$key=htmlspecialchars($val);
    }
    [/code]
    So what I need is an easy way to tell if "$val" is an Array so that I can do something similar to each of its elements in turn. Thanks in advance.
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,648
    Rep Power
    4493
    love those manuals...

    is_array
    (PHP3 <= 3.0.16, PHP4 )

    is_array -- Finds whether a variable is an array
    Description

    int is_array (mixed var)


    Returns true if var is an array, false otherwise.


    ---JH
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    114
    Rep Power
    15
    That's awesome, thanks.

Similar Threads

  1. Passing POST variables
    By rlorenzo in forum PHP Development
    Replies: 11
    Last Post: June 6th, 2004, 03:00 PM
  2. help with assigning variables, variable passing/ retrieval
    By pinkipodmini in forum PHP Development
    Replies: 0
    Last Post: February 13th, 2004, 10:40 PM
  3. Replies: 2
    Last Post: February 11th, 2004, 12:03 AM
  4. losing session variables
    By shawazi in forum PHP Development
    Replies: 1
    Last Post: January 27th, 2004, 01:02 PM
  5. cannot create a URL with two variables
    By terrymechan in forum PHP Development
    Replies: 5
    Last Post: November 6th, 2003, 11:19 AM

IMN logo majestic logo threadwatch logo seochat tools logo