1. Go to this page and download the library: Download jameslevi/objectify library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
echo $data->get("x"); // Will echo the value of x.
echo $data->x; // Will echo the value of x.
$data->set("x", 100); // Set the new value of x.
$data->x = 200; // Set the new value of x.
$data->add("pi", 3.14);
$data->has("x") // Returns true.
$data->remove("z"); // This will remove z from the data object.
$data->keys(); // This will return all data object keys.
$data->toArray(); // This will return all the data from the data object in array.
$data->toJson(); // This will return json formatted string.
use Graphite\Component\Objectify\Objectify;
class Car extends Objectify
{
public function setDriver($name)
{
$this->driver = "Mr. " . ucwords($name);
}
}
echo $car->driver; // Result will be "Mr. James Crisostomo".
$data = new Objectify(["x" => 0], true);
$data->set("y", 1); // Updating value is disabled.
$data->add("y", 1); // Adding new data is disabled.
$data->remove("x"); // Removing data is disabled.
$new_data = $data->clone(); // This will create an exact copy of the data object.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.