M
M
Maxim2020-04-20 19:23:05
PHP
Maxim, 2020-04-20 19:23:05

How to output one of the elements of an array into a variable?

Good evening, as a result of parsing a string, I get an array. How can I output the zero iteration to a variable so that I can write the result to the database?

$str = mysqli_real_escape_string($link, $str);
$pattern = '/(\d+)a/';
$res = preg_match($pattern, $str, $a);
$b = $a[0];

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question