3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = <<< XML <?xml version="1.0" encoding="utf-8"?> <books> <book>Patterns of Enterprise Application Architecture</book> <book></book> <book>Design Patterns: Elements of Reusable Software Design</book> <book>Clean Code</book> </books> XML; $dom = new DOMDocument; $dom->loadXML($xml); $books = $dom->getElementsByTagName('book'); $length = $books->length; $break = FALSE; foreach ($books as $k => $book) { if($break){ if($k == ($length-1)) { echo "last iteration: " . $book->nodeValue; } else { contiune; } } if(empty($book->nodeValue)) { $break = TRUE; contiune; } echo $book->nodeValue, PHP_EOL; }
based on ZGY1d
Output for 7.2.0
Patterns of Enterprise Application Architecture Warning: Use of undefined constant contiune - assumed 'contiune' (this will throw an Error in a future version of PHP) in /in/9ba49 on line 32 Warning: Use of undefined constant contiune - assumed 'contiune' (this will throw an Error in a future version of PHP) in /in/9ba49 on line 25 Design Patterns: Elements of Reusable Software Design last iteration: Clean CodeClean Code
Output for 5.3.19 - 7.1.10
Patterns of Enterprise Application Architecture Notice: Use of undefined constant contiune - assumed 'contiune' in /in/9ba49 on line 32 Notice: Use of undefined constant contiune - assumed 'contiune' in /in/9ba49 on line 25 Design Patterns: Elements of Reusable Software Design last iteration: Clean CodeClean Code