PHP code example of ddliu / requery

1. Go to this page and download the library: Download ddliu/requery library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ddliu / requery example snippets


use ddliu\requer\Context;

$q = new Context($content);
$q->find('#<table>.*</table>#Uis')
    ->then(function($table) {
        $table->findAll('#<th>(.*)</th>#Uis')
            ->each(function($th) {
                echo 'th: '.$th[1]."\n";
            });
    })
    ->then(function($table) {
        $table->find('#<tbody>.*</tbody>#Uis')->findAll('#<tr>.*</tr>#Uis')
            ->each(function($tr) {
                $tr->findAll('#<td>(.*)</td>#Uis')
                    ->each(function($td) {
                        echo 'td: '.$td[1]."\n";
                    });
            });
    });