lfirth1959
asked on
Concatenation a string
I am new to PHP and am used to ASP, what would work on ASP dousn't seem to in PHP
I am developing an application that produces a pdf invoice. I am trying to concatenate a string with the result of a recordset field like so:
$phone = 'PH '.phoneNum($row_rsBusiness ['Phone']) ;
The function phoneNum just adds spaces to a 10 digit number to make it more readable.
function phoneNum($string) {
$pattern = '/(\d{2})(\d{4})(\d{4})/';
$repl = '$1 $2 $3';
echo preg_replace($pattern, $repl, $string );
}
The problem is they don't concatenate, the phone number just prints to the screen.
I am developing an application that produces a pdf invoice. I am trying to concatenate a string with the result of a recordset field like so:
$phone = 'PH '.phoneNum($row_rsBusiness
The function phoneNum just adds spaces to a 10 digit number to make it more readable.
function phoneNum($string) {
$pattern = '/(\d{2})(\d{4})(\d{4})/';
$repl = '$1 $2 $3';
echo preg_replace($pattern, $repl, $string );
}
The problem is they don't concatenate, the phone number just prints to the screen.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.