PHP code example of undercoder / magenizer

1. Go to this page and download the library: Download undercoder/magenizer 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/ */

    

undercoder / magenizer example snippets


 $raw = <<<RAW
 STRANGE Document With Weird LAYOUT
 THIS document is ELECTRONIC
 ANDRES REYES
 N°3
 WORK AT: HEROICAL SERVICES FOR FREE,
 ADDRESS  :  666, Where The Braves Dies Street, Santiago, Chile.
 ...Some more of weird strings...
 RAW;
 $tokens = array(
   "name"        => array("from" => "ELECTRONIC",   "to" => "N\s*\°"),
   "doc-number"  => array("from" => "N\s*\°",       "to" => "WORK"),
   "job"         => array("from" => "K AT\:",       "to" => ",\nADDRESS"),
   "address"     => array("from" => "ADDRESS\s*\:", "to" => "\...Some")
 );

 $mage = new Magenizer($raw, $tokens);
 foreach ($m as $next) {
   echo "$next </br>";
 }

 //OUTPUT:
 //------
 //ANDRES REYES
 //3
 // HEROICAL SERVICES FOR FREE
 // 666, Where The Braves Dies Street, Santiago, Chile.