Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts

    why i could not print out the 2 elements from the array

    Hi;
    why i could not print out the 2 elements from the array of the final, it just print out the "Array"
    Could anyone help, thanks

    PHP Code:
    <?php 
    $string
    ="talking animails and get rid off talking about this facebook"
    $term="talking a"
    preg_match_all("/talking a[a-zA-Z]*/"$string,$final); 
    $i=0
    while(
    $i<2){ 
    echo 
    $final[$i]; 
    $i++; 

    ?>
    Last edited by Inigoesdr; 11-13-2011 at 04:38 AM.

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    If you properly examine the code which you have based that upon, you will see exactly where your problem is.

  • #3
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Sorry, i could not find out where my problem is

  • #4
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Thanks, i will convert it into one dimension array

  • #5
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    No need.

    Code:
    foreach ($final[0] as $val)
    {
        echo $val;
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •