..


Sponsored Links

Pod course and its use to JSON with PHP

Article written by Claudio Garau
Page 1 of 5

JSON stands for JavaScript Object Notation, is a technology, but it would be better to call it a "format", designed for the 'exchange of data within a client-server applications, such as those made ​​in Ajax and PHP, but is widely used in combination with programming languages ​​such as Java, C, C # and Perl.

JSON is JavaScript based on the Standard ECMA-262 3rd in the version released in December 1999, although it was developed independently from its source.

The spread of this format is due, probably, to its extreme ease of use, it also supports a wide variety of data types, as can be seen through the following list, are then integrated into the same general typesystems of most programming languages ​​and scripting:

  • NULL: no value given;
  • BOOLEAN: values ​​that can be either true (TRUE or "1") or false ("0" or FALSE);
  • INTEGER: Numeric integer;
  • REAL and FLOAT: real or floating point values;
  • STRING: Series (also devoid of elements) of Unicode characters delimited by double quotes;
  • ARRAY: Series consist of ordered values ​​separated by commas and delimited by square brackets;
  • Associative Arrays: ordered set consisting of key-value pairs separated by commas and surrounded by curly braces;
  • OBJECTS: unordered set of name-value pairs separated by commas and delimited by curly braces.

While the similarities are immediately observable, the other is important to note that there are also some differences between the types of JSON data and those of many languages, the most attention will surely have noticed such as type STRING of this size is practically identical to that used in Java or C, however, keep in mind that the situation is different for numeric types where JSON does not support the octal or decimal.

JSON allows the exchange of data through a stream (or "stream input / output"), it can be parsed, and then read through an interpreter ("engine") thanks to a simple JavaScript call to a specific function JS called eval ().
Throughout this guide we will see how we can use this function in Javascript and PHP-based scripts, but first you must make some reference to the minimum requirements for development, it requires JSON:

  • At least in PHP version 5.2 or higher;
  • a browser can provide native support for the format, then, for example, you can not use a version of Internet Explorer earlier than 8.
Still on the browser, it should be noted that not all browsers support the data exchange with JSON, and especially his way of manipulating the element XMLHttpRequest, the same way. Much, in fact, depends on the "quality" of the JavaScript engine integrated you, then, to note some small differences in the behavior of your application if you use Firefox instead of Opera. etc.. In principle we can say that the most recent version is installed in the system, better support for JSON.

In the same category ...
E-Learning
Linux (Course) Linux (Course)
Complete guide to open-source system. From 49 €.
MySQL (Course) MySQL (Course)
Management of open-source database. From 39 €.
PHP (Course) PHP (Course)
Full course for creating dynamic Web sites. From 49 €.
Sponsored Links