const arr = [1, 2, 3, 4, 5];
const rec = (theArr) => {
const [first, ...rest] = theArr;
if (!first) return;
setTimeout(() => {
/* do some parsing, example: */
if ([3, 4].includes(first)) alert('found it!');
return rec(rest);
}, 0);
};
rec(arr);
function parse(txt = '') {
return Promise.resolve(txt.match(/a/gi))
}
texts = ['astajf;lj3', 'AAjfjia33r', '4jlj;lajaaa', 'afdj df jas fjsa ja33a']
await Promise.all(texts.map(parse))
// (4) [Array(2), Array(3), Array(4), Array(5)]
$a = [ 'Глава 1', 'Глава 10', 'Глава 2', 'Глава 20' ];
sort($a);
print_r($a);
$a = [ 'Глава 1', 'Глава 10', 'Глава 2', 'Глава 20' ];
natsort($a);
print_r($a);
https://www.php.net/manual/ru/function.natsort.php <?php
require 'rb.php';
R::setup();
//for version 5.3 and higher
//optional but recommended
R::useFeatureSet( 'novice/latest' );
$post = R::dispense( 'post' );
$post->text = 'Hello World';
//create or update
$id = R::store( $post );
//retrieve
$post = R::load( 'post', $id );
//delete
R::trash( $post );