[PHP] help using ereg_replace()

2002-01-14 Thread Erik Price
Hello everyone, I am trying to learn how to use ereg_replace(), but I don't seem to be doing it correctly. $phone is a 10-digit string. I want to perform the following: $phone = ereg_replace(.{10}, [part where I am confused], $phone); I would like the output to be $phone = (555) 555-;

Re: [PHP] help using ereg_replace()

2002-01-14 Thread Jimmy
Hi Erik, $phone is a 10-digit string. I would like the output to be $phone = (555) 555-; you don't need regex to do that. just insert add ( to the beginning of $phone, add ) to the 4th position, and - to the 4th position from behind, using substr_replace() function. anyway if you