PHP code example of battye / php-array-parser

1. Go to this page and download the library: Download battye/php-array-parser 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/ */

    

battye / php-array-parser example snippets


use battye\array_parser\parser;
use battye\array_parser\tokens;

$value = "array(0 => array('one' => 1, 'two' => 'two'));";
$result = parser::parse_simple($value);

$regex = '/\$lang\s+=\s+array_merge\(\$lang, array\((.*?)\)\);/s';
$file = __DIR__ . '/files/test_lang.php';
$result = parser::parse_regex($regex, $file);