Skip to main content

php

Jump to function (12)

php/->#

(php/-> object call*)
(php/:: class call*)

Access to an object property or result of chained calls.

Example:

(php/-> date (format "Y-m-d"))

php/::#

(php/:: class (method-name expr*))
(php/:: class call*)

Calls a static method or property from a PHP class. Both method-name and property must be symbols and cannot be an evaluated value.

Example:

(php/:: DateTime (createFromFormat "Y-m-d" "2024-01-01"))

php/aget#

(php/aget arr index)

Equivalent to PHP's arr[index] ?? null.

Example:

(php/aget (php/array "a" "b" "c") 1) ; => "b"

php/aget-in#

(php/aget-in arr ks)

Equivalent to PHP's arr[k1][k2][k...] ?? null.

Example:

(php/aget-in nested-arr ["users" 0 "name"])

php/apush#

(php/apush arr value)

Equivalent to PHP's arr[] = value.

Example:

(php/apush arr "new-item")

php/apush-in#

(php/apush-in arr ks value)

Equivalent to PHP's arr[k1][k2][k...][] = value.

Example:

(php/apush-in arr ["users"] {:name "Bob"})

php/aset#

(php/aset arr index value)

Equivalent to PHP's arr[index] = value.

Example:

(php/aset arr 0 "new-value")

php/aset-in#

(php/aset-in arr ks value)

Equivalent to PHP's arr[k1][k2][k...] = value.

Example:

(php/aset-in arr ["users" 0 "name"] "Alice")

php/aunset#

(php/aunset arr index)

Equivalent to PHP's unset(arr[index]).

Example:

(php/aunset arr "key-to-remove")

php/aunset-in#

(php/aunset-in arr ks)

Equivalent to PHP's unset(arr[k1][k2][k...]).

Example:

(php/aunset-in arr ["users" 0])

php/new#

(php/new expr args*)

Evaluates expr and creates a new PHP class using the arguments. The instance of the class is returned.

Example:

(php/new DateTime "2024-01-01")

php/oset#

(php/oset (php/-> object property) value)
(php/oset (php/:: class property) value)

Use php/oset to set a value to a class/object property.

Example:

(php/oset (php/-> obj name) "Alice")