Type Definition ext_php_rs::types::Zval [−][src]
pub type Zval = zval;
Expand description
A zend value. This is the primary storage container used throughout the Zend engine.
A zval can be thought of as a Rust enum, a type that can contain different values such as integers, strings, objects etc.
Implementations
Returns the value of the zval if it is a string.
If the zval does not contain a string, the function will check if it
contains a double or a long, and if so it will convert the value to
a String
and return it. Don’t rely on this logic, as there is
potential for this to change to match the output of the str()
function.
Returns the value of the zval if it is a string and can be unpacked into
a vector of a given type. Similar to the unpack
in PHP, except you can only unpack one type.
Safety
There is no way to tell if the data stored in the string is actually of
the given type. The results of this function can also differ from
platform-to-platform due to the different representation of some
types on different platforms. Consult the pack
function
documentation for more details.
Returns the value of the zval if it is a resource.
Returns an immutable reference to the underlying zval hashtable if the zval contains an array.
Returns a mutable reference to the underlying zval hashtable if the zval contains an array.
Returns the value of the zval if it is an object.
Returns a mutable reference to the object contained in the Zval
, if
any.
Returns a mutable reference to the underlying zval if it is a reference.
Returns the value of the zval if it is callable.
Returns the value of the zval if it is a pointer.
Safety
The caller must ensure that the pointer contained in the zval is in fact
a pointer to an instance of T
, as the zval has no way of defining
the type of pointer.
Attempts to call the zval as a callable with a list of arguments to pass to the function. Note that a thrown exception inside the callable is not detectable, therefore you should check if the return value is valid rather than unwrapping. Returns a result containing the return value of the function, or an error.
You should not call this function directly, rather through the
call_user_func
macro.
Parameters
params
- A list of parameters to call the function with.
Returns true if the zval is a resource, false otherwise.
Returns true if the zval is a reference, false otherwise.
Returns true if the zval is callable, false otherwise.
Sets the value of the zval as a string. Returns nothing in a result when successful.
Parameters
val
- The value to set the zval as.persistent
- Whether the string should persist between requests.
Sets the value of the zval as a binary string, which is represented in Rust as a vector.
Parameters
val
- The value to set the zval as.
Sets the value of the zval as a interned string. Returns nothing in a result when successful.
Parameters
val
- The value to set the zval as.persistent
- Whether the string should persist between requests.
Sets the value of the zval as a reference to an object.
Parameters
val
- The value to set the zval as.
Sets the value of the zval as an array. Returns nothing in a result on success.
Parameters
val
- The value to set the zval as.
Sets the value of the zval as an array. Returns nothing in a result on success.
Parameters
val
- The value to set the zval as.
Trait Implementations
Sets the content of a pre-existing zval. Returns a result containing nothing if setting the content was successful. Read more