Tutoriel PHP

ACCUEIL PHP Introduction PHP Installation PHP Syntaxe PHP Commentaires PHP Variables PHP Écho PHP / Impression Types de données PHP Chaînes PHP Numéros PHP Mathématiques PHP Constantes PHP Opérateurs PHP PHP Si... Sinon... Sinon Commutateur PHP Boucles PHP Fonctions PHP Tableaux PHP Superglobales PHP Expression régulière PHP

Formulaires PHP

Gestion des formulaires PHP Validation de formulaire PHP Formulaire PHP requis URL/courriel du formulaire PHP Formulaire PHP terminé

PHP Avancé

Date et heure PHP Inclure PHP Gestion des fichiers PHP Fichier PHP Ouvrir/Lire Création/écriture de fichier PHP Téléchargement de fichier PHP Cookies PHP Séances PHP Filtres PHP Filtres PHP avancés Fonctions de rappel PHP PHPJSON Exception PHP

POO PHP

PHP Qu'est-ce que la POO Classes/Objets PHP Constructeur PHP Destructeur PHP Modificateurs d'accès PHP Héritage PHP Constantes PHP Classes abstraites PHP Interface PHP Caractéristiques PHP Méthodes statiques PHP Propriétés statiques PHP Espaces de noms PHP Itérables PHP

Base de données MySQL

Base de données MySQL Connexion MySQL Créer une base de données MySQL Créer une table MySQL MySQL Insérer des données MySQL obtenir le dernier ID MySQL Insérer plusieurs MySQL préparé MySQL Sélectionner les données MySQL Où Trier MySQL par MySQL Supprimer les données Données de mise à jour MySQL Données de limite MySQL

XML PHP

Analyseurs PHP XML Analyseur PHP SimpleXML PHP SimpleXML - Obtenir Expatriation PHP XML PHP XML DOM

PHP -AJAX

Introduction à AJAX PHP AJAX Base de données AJAX XML AJAX Recherche en direct AJAX Sondage AJAX

Exemples PHP

Exemples PHP Compilateur PHP Questionnaire PHP Exercices PHP Certificat PHP

Référence PHP

Présentation de PHP Tableau PHP Calendrier PHP Date PHP Annuaire PHP Erreur PHP Exception PHP Système de fichiers PHP Filtre PHP FTP PHP PHPJSON Mots clés PHP PHP LibxmlComment Messagerie PHP Mathématiques PHP Divers PHP PHP MySQL Réseau PHP Contrôle de sortie PHP Expression régulière PHP PHP SimpleXML Flux PHP Chaîne PHP Gestion des variables PHP Analyseur PHP XML Code postal PHP Fuseaux horaires PHP

Fonctions PHP JSON


Présentation de PHP JSON

L'extension JSON implémente le format d'échange de données JavaScript Object Notation.

En PHP 5, le décodage est géré par un analyseur basé sur le JSON_checker de Douglas Crockford.

PHP 7 a un nouvel analyseur amélioré spécialement écrit pour PHP et sous licence PHP.


Installation

A partir de PHP 5.2.0, les fonctions JSON sont activées par défaut. Aucune installation n'est nécessaire pour utiliser ces fonctions.


Fonctions PHP JSON

Function Description
json_decode() Decodes a JSON string
json_encode() Encode a value to JSON format
json_last_error() Returns the last error occurred
json_last_error_msg() Returns the error string of the last json_encode() or json_decode() call

Constantes JSON prédéfinies PHP

Constant Type Description
JSON_ERROR_NONE Integer No error has occurred
JSON_ERROR_DEPTH Integer Maximum stack depth has been exceeded
JSON_ERROR_STATE_MISMATCH Integer Invalid/Malformed JSON
JSON_ERROR_CTRL_CHAR Integer Control character error
JSON_ERROR_SYNTAX Integer Syntax error
JSON_ERROR_UTF8 Integer Malformed UTF-8 characters. PHP 5.3
JSON_ERROR_RECURSION Integer Invalid recursive reference values. PHP 5.5
JSON_ERROR_INF_OR_NAN Integer Invalid NAN or INF values. PHP 5.5
JSON_ERROR_UNSUPPORTED_TYPE Integer Invalid type. PHP 5.5
JSON_ERROR_INVALID_PROPERTY_NAME Integer Invalid property name. PHP 7.0
JSON_ERROR_UTF16 Integer Malformed UTF-16 characters. PHP 7.0
JSON_BIGINT_AS_STRING Integer  
JSON_OBJECT_AS_ARRAY Integer  
JSON_HEX_TAG Integer  
JSON_HEX_AMP Integer  
JSON_HEX_APOS Integer  
JSON_HEX_QUOT Integer  
JSON_FORCE_OBJECT Integer  
JSON_NUMERIC_CHECK Integer  
JSON_PRETTY_PRINT Integer  
JSON_UNESCAPED_SLASHES Integer  
JSON_PARTIAL_OUTPUT_ON_ERROR Integer  
JSON_PRESERVE_ZERO_FRACTION Integer  
JSON_UNESCAPED_LINE_TERMINATORS Integer  
JSON_INVALID_UTF8_IGNORE Integer  
JSON_INVALID_UTF8_SUBSTITUTE Integer  
JSON_THROWN_ON_ERROR Integer