I
I
Iossarian2018-12-03 13:55:26
1C-Bitrix
Iossarian, 2018-12-03 13:55:26

How to display all elements starting with a certain letter?

5c050b4833c9d116745264.jpeg
There is such a pointer. Below it is a list of all factories. It is necessary to make such functionality that when clicking on a letter, all factories whose names begin with this letter are displayed from the list.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-12-03
@idruweb

1) first select all the elements to find out which letters make links and which do not.
2) When clicking on a letter, select elements by the filter "%NAME" => 'letter'

M
Mikhail Solovyov, 2018-12-03
@Mihairu

<?php
$arr = array("mike", "kate", "john", "michele", "paul", "samanta", "stella");

$res = array_filter($arr, function($d) {
    return mb_substr($d, 0, 1) == 'j';
});

var_dump($res);

will display
array(1) { [2]=> string(4) "john" }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question