PHP Classes
elePHPant
Icontem

File: example/fields_example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Shannon Wynter  >  preg_magic  >  example/fields_example.php  >  Download  
File: example/fields_example.php
Role: Example script
Content type: text/plain
Description: An example fields layout
Class: preg_magic
Extract data from text using regular expressions
Author: By
Last change:
Date: 7 years ago
Size: 691 bytes
 

Contents

Class file image Download
<?php
$HistoryFields
= array(
   
'cardnumber' => 'card number:<\/span>\s*((?:\d{4}\s*){3}\d{4})',
   
'balance' => 'Card balance:<\/td>\s*<td>\s*(\$\d+\.\d+)',
   
'history' => array(
       
'@table' => true,
       
'@table_start' => 'class="results_table">.+?<\/tr>\s*',
       
'@table_end' => '\s*<\/table>',
       
'@table_fields' => array(
           
'stamp' => '\s*<tr class="(?:odd|even)">\s*'
                             
. '<td>(\d+-\w+-\d+\s*\d+:\d+\s*\w+)<\/td>',
           
'type' => '<td.*?>\s*([^<]*?)\s*<\/td>',
           
'location' => '<td.*?>\s*([^<]*?)\s*<\/td>',
           
'amount' => '<td.*?>\s*([^<]*?)\s*<\/td>',
           
'gst' => '<td.*?>\s*([^<]*?)\s*<\/td>\s*<\/tr>\s*'
       
)
    )
);