Skip to content

Instantly share code, notes, and snippets.

@stefanpejcic
Created June 1, 2020 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanpejcic/3ae2db26dabff2f8875204b9948d625e to your computer and use it in GitHub Desktop.
Save stefanpejcic/3ae2db26dabff2f8875204b9948d625e to your computer and use it in GitHub Desktop.
// Set array element
if ( ! function_exists( 'piqes_storage_set_array' ) ) {
function piqes_storage_set_array( $var_name, $key, $value ) {
global $PIQES_STORAGE;
if ( ! isset( $PIQES_STORAGE[ $var_name ] ) ) {
$PIQES_STORAGE[ $var_name ] = array();
}
if ( '' === $key ) {
$PIQES_STORAGE[ $var_name ][] = $value;
} else {
$PIQES_STORAGE[ $var_name ][ $key ] = $value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment