Having trouble with pattern and replacement. How can I make the replacement echo a final product such as
INSERT INTO `table` (`person`, `file`) VALUES
('test','test'),
('test2','test2'),
('test3','test3');
I am trying to insert the string into SQL but I need to format the current string below to do so, and I need to have the last part of the string test3:test3 or whatever the text may be to close the SQL pattern ('test3','test3');
<?php
$string = 'test:test test2:test2 test3:test3';
$pattern = '';
$replacement = '';
echo preg_replace($pattern, $replacement, $string);
?>
Also, can it also have a string such as this? '[email protected]:test test2:test2'
whereas the email will be before the colon at ALL times.