Re: ob_start callback preg_replace

From: Date: Wed, 02 Jun 2004 22:27:06 +0000
Subject: Re: ob_start callback preg_replace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-187495@lists.php.net to get a copy of this message
John Kaspar wrote:
Can someone help me with preg_replace? I want to convert all numbers either 8 or 9 digits in length, into a link. Such that when it sees: John Doe, 456890123, is a new employee. It converts it to: John Doe, <a href='employee.html?id=456890123'>456890123</a>, is a new employee. function callback($buffer) { // create id links return ???????; } ob_start("callback"); Thanks much, John
return preg_replace('/([0-9]{8,9})/',
      '<a href="employee.html?id=$1">$1</a>', $buffer);


« previous php.general (#187495) next »