Hello everyone, there is a line like 53763badd6f05.
It is necessary to drive through php that would be the line 53763-badd-6f05. THOSE. With a dash.
How it's done?
Hello everyone, there is a line like 53763badd6f05.
It is necessary to drive through php that would be the line 53763-badd-6f05. THOSE. With a dash.
How it's done?
$a = "53763badd6f05"; $a = substr($a, 0, 5)."-".substr($a, 5, 4)."-".substr($a, 9, 4); echo $a;
or so:
$a = "53763badd6f05"; $a = substr_replace($a, "-", 5, 0); $a = substr_replace($a, "-", 10, 0); echo $a;
well, or even so (this is a question about the condition):
$a = "53763badd6f05"; $a = preg_replace("/badd/", "-$0-", $a); echo $a;
Source: https://ru.stackoverflow.com/questions/320634/
All Articles