PHP Classes

translate documentation

Recommend this page to a friend!

      PHP JSON Maker  >  All threads  >  translate documentation  >  (Un) Subscribe thread alerts  
Subject:translate documentation
Summary:some strings are question marks
Messages:3
Author:Roland
Date:2017-09-21 01:19:48
 

  1. translate documentation   Reply   Report abuse  
Picture of Roland Roland - 2017-09-21 01:19:48
Hey Alexey,

Can you please translate some of the text in English?
I see:
--------------------
Create JSON easy
PHP ????? ??? ???????? ? ??????????? ????????? ?????? ? ??????? JSON
?????????
composer require alexsuperstar/jsonmaker
???????? JSON
--------------------
I can't read what the question marks mean.
Could you put this in English?

Thank you!

Roland

  2. Re: translate documentation   Reply   Report abuse  
Picture of Alexey Starikov Alexey Starikov - 2017-09-21 07:17:56 - In reply to message 1 from Roland
# jsonMaker
Create JSON easy

PHP class for creating and modifying a text string in JSON format
# Installation

composer require alexsuperstar / jsonmaker

# Creating JSON

Example:
$ a = new \ alexstar \ JsonMaker ();
$ cc = 'xyz';
$ a -> {$ cc} -> bbb-> cccc [0] -> xxx = 5;
$ a -> {$ cc} -> zz = 'qq';
$ a-> xyz-> zf = 'qq';
$ a-> xx-> zz = 'qq';
echo $ a;


Result

{"xyz": {"bbb": {"cccc": [{"xxx": 5}]}, "zz": "qq", "zf": "qq"}, "xx": {"zz ":" qq "}}
 
# Editing JSON
 
Original JSON
{
  "firstName": "Ivan",
  "lastName": "Ivanov",
  "address": {
    "streetAddress": "Moscow sh., 101, ap. 101,"
    "city": "Leningrad",
    "postalCode": 101101
  },
  "phoneNumbers": [
    "812 123-1234",
    "916 123-4567"
  ]
}

PHP code


<? php
$ loader = require_once __DIR__. '/vendor/autoload.php';
$ json = new \ alexstar \ JsonMaker ('{"firstName": "Ivan", "lastName": "Ivanov", "address": {"streetAddress": "Moscow, 101, ap. 101", "city ":" Leningrad "," postalCode ": 101101}," phoneNumbers ": [" 812 123-1234 "," 916 123-4567 "]} ');
$ json-> firstName = 'Alexey';
$ dom = 'home';
$ json-> address -> {$ dom} = 6;
$ json-> address-> code [] = '123';
$ json-> address-> code [] = '456';
$ json-> phoneNumbers [2] = '+ 7 (123) 1233-45-67';
unset ($ json-> address-> city, $ json-> phoneNumbers [0]);
echo $ json;

Result


{
  "firstName": "Alexey",
  "lastName": "Ivanov",
  "address": {
    "streetAddress": "Moscow sh., 101, ap. 101,"
    "postalCode": 101101,
    "House 6,
    "code": [
      "123",
      "456"
    ]
  },
  "phoneNumbers": {
    "1": "916 123-4567",
    "2": "+7 (123) 1233-45-67"
  }
}


PS: about the use of memory, I can not say anything, like everything is transmitted by links, but I'm not sure.

  3. Re: translate documentation   Reply   Report abuse  
Picture of Roland Roland - 2017-09-21 22:15:04 - In reply to message 2 from Alexey Starikov
Thank you Alexey!

Roland