TPLix

No results for ""

In Array

2 min read Jun 2, 2026
--- title: in_array and autoseo: enabled: true theme: learn2 child_type: default admin: children_display_order: collection visible: true ---

in_array — test if value is contained in an array or not in an array.

Basic Usage:
{if in_array('value2', $myarray)} value2 is in myarray{/if}
Examples:

Using by operator is in

{if 'value2' is in $myarray}value2 is in myarray{/if}
Basic Usage: (Not in array)
{if !in_array('value2', $myarray)} value2 is in myarray{/if}
Examples: (Not in array)

Using by operator is not in

{if 'value2' is not in $myarray}value2 is not in myarray{/if}

Leave a Comment

Not published. Used to notify you on approval.

Comments are moderated before appearing.