Recommend this page to a friend! |
Classes of Moamen Eltouny | PHP Dot Notation Array Access | README.md | Download |
|
Download <p align="center"><a href="https://pharaonic.io" target="_blank"><img src="https://raw.githubusercontent.com/Pharaonic/logos/main/php/dot-array.jpg" width="470"></a></p> <p align="center"> <a href="https://github.com/Pharaonic/php-dot-array" target="_blank"><img src="http://img.shields.io/badge/source-pharaonic/php--dot--array-blue.svg?style=flat-square" alt="Source"></a> <a href="https://packagist.org/packages/pharaonic/php-dot-array" target="_blank"><img src="https://img.shields.io/packagist/v/pharaonic/php-dot-array?style=flat-square" alt="Packagist Version"></a><br> <img src="https://img.shields.io/packagist/dt/pharaonic/php-dot-array?style=flat-square" alt="Packagist Downloads"> <img src="http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square" alt="Source"> </p> [PHP] DotArray - Accessing arrays using dot notation and asterisk.
ExamplesTraditional way
DotArray way (with DotArray Object)
InstallInstall the latest version using Composer:
UsageCreate a new DotArray object:
OR You can use a helper function to create the object:
MethodsDotArray has the following methods: <a name="set"></a> set()Sets a given key / value pair:
<a name="get"></a> get()Returns the value of a given key:
Returns a given default value, if the given key doesn't exist:
<a name="tojson"></a> toJson()Returns the value of a given key (like get() method) as JSON:
Returns all the stored items (like get() method) as JSON:
<a name="all"></a> all()Returns all the stored items as an array:
<a name="delete"></a> delete()Deletes the given key:
<a name="clear"></a> clear()Deletes all the stored items:
<a name="has"></a> has()Checks if a given key exists (returns boolean):
<a name="count"></a> count()Returns the number of the root Items:
Returns the number of items in a given key:
<a name="isempty"></a> isEmpty()Checks if a given key is empty (returns boolean):
Checks the whole DotArray object:
<a name="setarray"></a> setArray()Replaces all items in DotArray object with a given array:
<a name="setreference"></a> setReference()Replaces all items in Dot object with a given array as a reference:
License |