0
foreach( $items as $item) { 
    if (strpos($item['class'],"owner") !== FALSE) { 
        $code = $item['code']; //contains the right strings   
        echo "does anything"; // this part is working fine
        foreach( $loops as $loop) {
            if (strpos($loop['text'], $code) !== FALSE) {
                echo "does anything"; // this part is only working if i use a string like "123" instead of $code
            } else {
                echo "does nothing";
                echo  $code; 
                echo "  - is included in  -  "; 
                echo $loop['text']; // e.g. shows following example '123 - is included in  - Downing street 123 doesn't exist 
            }  
        }
    }
}

I can't figure out why I am not allowed to use the variable $code here, since $code shows me the proper values with the echo command. My previous question was closed - sorry if I made something wrong

According to @Barmar I tried out using var_dump'var_dump($code)' then echo $code = 'object(SimpleXMLElement)#810 (1) { [0]=> string(3) "123" }' but I don't know how I can use this additional information for my code.

brombeer
  • 8,716
  • 5
  • 21
  • 27
Perry
  • 1
  • 1

0 Answers0