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
---
Examples:
Basic Usage: (Not in array)
Examples: (Not in array)
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}
Using by operator is in
{if 'value2' is in $myarray}value2 is in myarray{/if}
{if !in_array('value2', $myarray)} value2 is in myarray{/if}
Using by operator is not in
{if 'value2' is not in $myarray}value2 is not in myarray{/if}
Leave a Comment