c-design / array-to-string
PHP Class to convert array to string
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/c-design/array-to-string
Requires
- php: >=5.4
This package is auto-updated.
Last update: 2025-10-06 10:02:16 UTC
README
Why is it needed
To save your array data to file!
Situation
You have an array:
<?php $arrayVar = [ 'a' => 1, 'b' => [ 'var1', 'var2' ] ];
You need a data file config.php with:
<?php return [ 'a' => 1, 'b' => [ 'var1', 'var2' ] ];
Solution:
$str = CDesign\ArrayToString\Converter($arrayVar); file_put_contents('config.php', "<?php return $str;");
Additional arguments:
indent - tab symbol or space (default Tab symbol)
inline - place data at one line (default false)
shortSyntax - use `[` and `]` instead `array(` and `)` (default true)