find out array values posted to each element...???

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alfiecrosby
    New Member
    • Apr 2008
    • 1

    find out array values posted to each element...???

    Hi...

    this is my first time ti post here...
    I have a question regarding my PHP study...

    How do I find out if an array has values posted to each of its elements? I need to know that EVERY element has been filled out.

    thanks for any reply.....
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Originally posted by alfiecrosby
    Hi...

    this is my first time ti post here...
    I have a question regarding my PHP study...

    How do I find out if an array has values posted to each of its elements? I need to know that EVERY element has been filled out.

    thanks for any reply.....
    Ok, have a look at this:

    [php]
    $_myArr = array("string", "another string", "");
    /*
    | notice the last index is empty
    */
    foreach($_myArr as $_key => $_val)
    {
    if(trim($_val) == "")
    {
    echo "$_key was empty";
    break;
    }
    }
    [/php]

    Regards :)

    Comment

    Working...