How to dynamically truncate the part of the string "1|10,2|11,3|12" between | and, the number, including |?
How to use PHP, dynamically truncate the string "1|10,2|11,3|12" in the section between the | and, number, including |?
------Solution--------------------
Str_replace (",", "", Str_replace ("
------Solution--------------------
"," ", $val))
------Solution--------------------
$s = "1
------Solution--------------------
10,2
------Solution--------------------
11,3
------Solution--------------------
12 ";
echo preg_replace ('/\
------Solution--------------------
[^,]+,/', ', ', $s);
The
------Solution--------------------
12
------Solution--------------------
$content = ' 1
------Solution--------------------
10,2
------Solution--------------------
11,3
------Solution--------------------
12 ';
echo preg_replace (Array ('/\
------Solution--------------------
[^,]+,/','/\
------Solution--------------------
[^,]+$/'), Array (', ', '), $content);
The
------Solution--------------------
$s = "1
------Solution--------------------
10,2
------Solution--------------------
11,3
------Solution--------------------
12 ";
echo preg_replace ('/\
------Solution--------------------
[^,]+/', ', $s);
The
But this does not match:
cut it off.
------Solution--------------------
And, the part between the number