0
    foreach($this->galleryPhotoDBInitialArray as $initialArrayElement) {
        $photoExists = false;
         foreach($this->galleryPhotoDBFinalArray as $finalArrayElement) {
            if($initialArrayElement == $finalArrayElement) {
              $photoExists = true;
                echo $initialArrayElement;
            }
        }
        if(!$photoExists){
            echo 'delete............................................';
            echo $initialArrayElement;
        }
    }

I have the above code. I know the arrays have data as I can print_r() it and see the data. the Array data looks like this:

enter image description here

What do I need to do so I can access the $initialArrayElement value - I need to process this further but I get the PHP error 'array to string conversion error'...

thankyou very much :)

3
  • 3
    Seems like you're trying to echo an array, which gives that warning. Use print_r() or var_dump() instead.
    – Ja͢ck
    Commented Nov 19, 2013 at 4:41
  • you mean I have an array of arrays... ok
    – Adam
    Commented Nov 19, 2013 at 4:42
  • ok I understand now... array of arrays - got it working... thanks for you comment above - it helped me understand... just learning... cheers
    – Adam
    Commented Nov 19, 2013 at 4:46

2 Answers 2

1
echo $initialArrayElement;

use print_r on this and check if this is still an array.. because at what i observe this was still an array..

0

Please use

print_r($initialArrayElement); insted of echo $initialArrayElement;

that will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.