public static function toPHPString($config, $prefix = ""){
        $r = [];

        foreach ($config as $key=>$value){
            if (is_int($key)){
                $line = $prefix . self::$tabContent;
            } else {
                $key = addslashes($key);
                $line = $prefix . self::$tabContent . "\"$key\" => ";
            }
            if (is_string($value)){
                $value = addslashes($value);
                $line .= "\"$value\"";
                $r[] = $line;
                continue;
            } elseif (is_bool($value)){
                $line .= ($value?"true":"false");
                $r[] = $line;
                continue;
            } elseif (is_int($value)){
                $line .= "$value";
                $r[] = $line;
                continue;
            }
            $line .= "[\n" .
                implode(",\n", self::toPHPString($value, $prefix.self::$tabContent))
                . "\n$prefix".self::$tabContent."]";
            $r[] = $line;
        }

        return $r;
    }
public static function toPHPString($config, $prefix = ""){
        $r = [];

        foreach ($config as $key=>$value){
            if (is_int($key)){
                $line = $prefix . self::$tabContent;
            } else {
                $key = addslashes($key);
                $line = $prefix . self::$tabContent . "\"$key\" => ";
            }
            if (is_string($value)){
                $value = addslashes($value);
                $line .= "\"$value\"";
                $r[] = $line;
                continue;
            } elseif (is_bool($value)){
                $line .= ($value?"true":"false");
                $r[] = $line;
                continue;
            } elseif (is_int($value)){
                $line .= "$value";
                $r[] = $line;
                continue;
            }
            $line .= "[\n" .
                implode(",\n", self::toPHPString($value, $prefix.self::$tabContent))
                . "\n$prefix".self::$tabContent."]";
            $r[] = $line;
        }

        return $r;
    }
public static function toPHPString ( $ config , $ prefix = "" ) { $ r = [ ] ; foreach ( $ config as $ key => $ value ) { if ( is_int ( $ key ) ) { $ line = $ prefix . self :: $ tabContent ; } else { $ key = addslashes ( $ key ) ; $ line = $ prefix . self :: $ tabContent . "\"$key\" => " ; } if ( is_string ( $ value ) ) { $ value = addslashes ( $ value ) ; $ line .= "\"$value\"" ; $ r [ ] = $ line ; continue ; } elseif ( is_bool ( $ value ) ) { $ line .= ( $ value ? "true" : "false" ) ; $ r [ ] = $ line ; continue ; } elseif ( is_int ( $ value ) ) { $ line .= "$value" ; $ r [ ] = $ line ; continue ; } $ line .= "[\n" . implode ( ",\n" , self :: toPHPString ( $ value , $ prefix . self :: $ tabContent ) ) . "\n$prefix" . self :: $ tabContent . "]" ; $ r [ ] = $ line ; } return $ r ; }
Returns php code for array
@param array $config
@param string $prefix
@return string[]
Returns php code for array