PHP Classes

File: examples/kernel/core/TObject/isPropertyModified.php

Recommend this page to a friend!
  Packages of Christos Drogidis   Ascoos OS   examples/kernel/core/TObject/isPropertyModified.php   Download  
File: examples/kernel/core/TObject/isPropertyModified.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Ascoos OS
A PHP Web 5.0 Kernel for decentralized web and IoT
Author: By
Last change: Update of examples/kernel/core/TObject/isPropertyModified.php
Date: 9 months ago
Size: 1,758 bytes
 

Contents

Class file image Download
<?php
/**
 * @ASCOOS-NAME : Ascoos OS
 * @ASCOOS-VERSION : 26.0.0
 * @ASCOOS-SUPPORT : support@ascoos.com
 * @ASCOOS-BUGS : https://issues.ascoos.com
 *
 * @desc <English> Demonstrates checking if a property has been modified using the isPropertyModified method.
 * @desc <Greek> ??????????? ??? ?????? ?? ??? ???????? ???? ???????????? ??????????????? ?? ?????? isPropertyModified.
 *
 * @since PHP 8.2.0
 */

use ASCOOS\OS\Kernel\Core\TObject;

// <English> Initialize properties array with configuration
// <Greek> ???????????? ?????? ????????? ?? ??????????
$properties = [
   
'name' => 'TestObject',
   
'version' => 260000
];

// <English> Create a new TObject instance
// <Greek> ?????????? ???? instance ??? TObject
$object = new TObject($properties);

// <English> Enable property change tracking
// <Greek> ???????????? ?????????????? ??????? ?????????
$object->trackPropertyChanges(true);

// <English> Update a property
// <Greek> ????????? ?????????
$object->setProperty('name', 'UpdatedObject');

// <English> Check if property was modified
// <Greek> ??????? ?? ? ???????? ?????????????
$isModified = $object->isPropertyModified('name');
// <English> Output result
// <Greek> ???????? ?????????????
echo $isModified ? "Property 'name' was modified\n" : "Property 'name' was not modified\n"; // Outputs: Property 'name' was modified

// <English> Free resources
// <Greek> ???????????? ?????
$object->Free($object);
?>