php sprintf z tablicą
Mam tablicę, w której znajdują się symbole zastępcze ciągu znaków:
"some text %s another text %s extra text %s"
i tablica:
$array[0] match the first %s
$array[1] match the second %s
$array[2] match the third %s
Myślałem, że można to zrobić za pomocą funkcji sprintf w następujący sposób:
$content = sprintf("some text %s another text %s extra text %s", $array);
ale to zwraca zbyt mało błędów argumentów, próbowałem użyć implode:
$content = sprintf("some text %s another text %s extra text %s", implode(",",$array));
z góry dziękuję