PHP code example of xy2z / philer

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

    

xy2z / philer example snippets


use xy2z\Philer\Philer;

$philer = new Philer('list.txt');
$philer->write(3.14);
$philer->write(array('a', 'b', 'c'));
echo $philer->read();
/* Result:
3.14
Array
(
    [0] => a
    [1] => b
    [2] => c
)
*/


// Load a new file and change options
$philer->load('new-list.txt');
$philer->set_option('var_dump', true);
$philer->write(3.14);
$philer->write(array('a', 'b', 'c'));
/* Result in 'new-list.txt':
float(3.14)
array(3) {
  [0]=>
  string(1) "a"
  [1]=>
  string(1) "b"
  [2]=>
  string(1) "c"
}
*/