PHP code example of ayesh / case-insensitive-array

1. Go to this page and download the library: Download ayesh/case-insensitive-array 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/ */

    

ayesh / case-insensitive-array example snippets


$array = new Ayesh\CaseInsensitiveArray\Strict();
$array['x-frame-options'] = 'DENY';
$array['X-FRAME-options'] = 'SAMEORIGIN';
echo $array['X-Frame-Options']; // 'SAMEORIGIN'

$source = [
  'x-frame-options' => 'Deny',
  'X-FRAME-OPTIONS' => 'SAMEORIGIN'
];

$array = new Ayesh\CaseInsensitiveArray\Strict($source);
// Your initial array is now indexed. That was optional. You can now set/get values freely, as you would do with a regular array.
echo $array['X-Frame-OPTIONS']; // 'SAMEORIGIN'
echo $array['X-FRAME-opTIONS']; // 'SAMEORIGIN'
unset($array['x-frame-options']);
var_dump(isset($array['X-Frame-Options'])); // false

$array = new Ayesh\CaseInsensitiveArray\Strict($source);
$array['x-frame-options'] = 'SameOrigin';
$array['X-Frame-Options'] = 'Deny'; // Notice the Came Case here.
$array['Strict-Transport-Security'] = 'max-age=31536000; ains; preload