PHP code example of ilyaplot / containers

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

    

ilyaplot / containers example snippets


$container = new \ilyaplot\Container(['value' => 100]);
$container->value1 = 200;

echo $container->value; // 100
echo $container->value1; // 200
echo $container['value1']; // 200

foreach ($container as $key=>$value) {
  echo $key . ':' . $value; // value:100 and value1:200
}

echo count($container); // 2

echo (string) $container; // {"value":100, "value2":200}


 
  return ['hostname' => '127.0.0.1', 'username' => 'guest'];


// Example config.php:

$config = new \ilyaplot\Config('config.php', ['password' => 'qwe123', 'username' => 'admin']);

echo $config->hostname; // 127.0.0.1
echo $config->password; // qwe123
echo $config->username; // guest

echo count($config); // 3


$config = new \ilyaplot\Config('config.php', [], ['

php composer.phar