我想從一些字符串中提取號碼,並將其封裝成......這件事情是這樣的:PHP - 提取號碼,並將其封裝成<span>
$string1 = "Up to 3 bedrooms";
$string2 = "With 2 and 3 (wathever)";
echo myMagicFunction($string1); // Up to <span>3</span> bedrooms.
echo myMagicFunction($string2); // With <span>2</span> and <span>3</span> (wathever).
我想我可以使用的preg_replace,但我不知道如何...
韓國社交協會...
整數? – 2014-11-05 19:55:34