PHP Classes

File: helper/arrayToJson.php

Recommend this page to a friend!
  Classes of Alexey Starikov   PHP Helper Class   helper/arrayToJson.php   Download  
File: helper/arrayToJson.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Helper Class
Call helper functions that are loaded dynamically
Author: By
Last change: Add Example
Date: 5 years ago
Size: 1,135 bytes
 

Contents

Class file image Download
<?php
/*
  * arrayToJson
  * pear config-get php_dir
  * pear install XML_Serializer

     ??? ????????? UTF-8 ????? ????? ? ????? XML/Util.php:876 ?????????? ??????? isValidName
    ?????? 879
        if (!preg_match('/^[[:alpha:]_]\\z/u', mb_substr($string,0,1))) {
        # ???????? ??????????? u ? ????? ??????? ??????? ? UTF mb_substr($string,0,1) ?????? string{0}
    ?????? 887
        $match = preg_match(
            '/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?'
            . '[[:alpha:]_]([[:alnum:]\_\-\.]+)?\\z/u',# ???????? ??????????? u
            $string
        );

    To support UTF-8 tags, you need to modify the isValidName function in the XML / Util.php file: 876
    line 879
        if (!preg_match('/^[[:alpha:]_]\\z/u', mb_substr($string,0,1))) {
        # add u modifier and select first character in UTF mb_substr($string,0,1) instead of string{0}
    line 887
        $match = preg_match(
            '/^([[:alpha:]_]([[:alnum:]\-\.]*)?:)?'
            . '[[:alpha:]_]([[:alnum:]\_\-\.]+)?\\z/u',# Add u modifier
            $string
        );
 */
return function($array){
    return
json_encode($array);
}
?>