"Sputnik" help  
Sputnik Help
Class(<value>)

Description

Converts the specified value into a class (StdClass). If the value is already a class, it returns it as is. If the value is an associative array, it creates a new class (StdClass) with variables initialized from the array keys and values.

Parameters

<value> The value to be converted into a class.

Return Value

Success: Returns the class representation of the specified value.
Failure: Returns null if the value cannot be converted to a class within the scope of this function.

Remarks

The Class function is used to explicitly convert a value into a class (StdClass). If the provided value is already a class, it is returned without modification. If the value is an associative array, it creates a new class with variables initialized from the array keys and values.

Related

Casting, IsVarClass, ClassOf

Example

Example of usage:

my $a = array("cat" => "meow");
my $b = Class($a);
printr $b;

// PRINTS
// stdclass Class
// (
//     [cat] => meow
// )

Casting:

my $a = array("cat" => "meow");
my $b = (Class)$a;
printr $b;

// PRINTS
// stdclass Class
// (
//     [cat] => meow
// )

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org