221116 atijan
This quick guide is not for professionals.
For copying, the in-line preview is formatted as <code>
List of links in this article:
- Arrays - practical examples
- Strings - illustrative overview of functions
Arrays -practical examples
Back to the list ...
array_multisort(array_column($this->Products, 'name'), SORT_ASC, $this->Products); // sort by selected field
array_search('nic', array_column($array, 'id_nic')); // search through a multi dimensional array
Strings - illustrative overview of functions
Back to the list ...
source: https://www.itnetwork.cz/php/funkce-od-a-do-z/vyhledavani-textovych-retezcu-v-php/
strcspn() : 6 == strcspn("Hello world!",'w');
number of characters to the end after the first search character (characters) / , <nPos>, <nLen>
strspn() : 5 == echo strspn(" Abc Z abc", " Abc");
the number of matching characters to the end if the strings begin to match (diacritics = 2 characters)/ , <nPos>, <nLen>
strstr() : "Abc Z" == strstr("xy Abc Z", "Abc"));
string to the end, matching the searched one