Sample code for 30+ languages & platforms
PHP Extension

SearchAllForContent

See more XML Examples

Demonstrates the SearchAllForContent method.

Chilkat PHP Extension Downloads

PHP Extension
<?php

include("chilkat.php");

$success = false;

$xml = new CkXml();

$success = $xml->LoadXmlFile('qa_data/xml/pigs.xml');
if ($success != true) {
    print $xml->lastErrorText() . "\n";
    exit;
}

// xBeginAfter is a CkXml
$xBeginAfter = $xml->GetSelf();
// xFound is a CkXml
$xFound = $xml->SearchAllForContent($xBeginAfter,'*pig*');
$searchForMore = true;
while (($searchForMore == true)) {

    print $xFound->tag() . "\n";
    print $xFound->content() . "\n";
    print '--' . "\n";

    // xBeginAfter is a CkXml
    $xBeginAfter = $xFound;
    // xFound is a CkXml
    $xFound = $xml->SearchAllForContent($xBeginAfter,'*pig*');

    $searchForMore = $xml->get_LastMethodSuccess();
}


?>