1

Keys, and values mysql.

$valores[$codigo] = "<img src=\"template/" . $template . "/smiles/" . $smile . "\" border=\"0\"/>";
$arrayKeys  =   array_keys($valores);
$arrayValues    =   array_values($valores);
return preg_replace($arrayKeys, $arrayValues, $coment);

error, Warning: preg_replace() [function.preg-replace]: No ending delimiter ':' found.

2
  • php.net/manual/en/regexp.reference.delimiters.php Commented Aug 2, 2012 at 10:39
  • What is $codigo? what is $coment? What do you want to do? I don't understand the question. Por los nombres de las variables supongo que hablas español. Creo que no se está entendiendo qué es lo que quieres hacer realmente. Creo que deberías reformular la pregunta explicando un poco más. Commented Aug 2, 2012 at 10:50

2 Answers 2

1

You may want to use str_replace() instead.

Edit :

You just need to replace preg_replace by str_replace :

return str_replace($arrayKeys, $arrayValues, $coment);

See the documentation here str_replace()

Sign up to request clarification or add additional context in comments.

Comments

0

preg_replace() - Perform a regular expression search and replace

If I understand correctly you want to replace :) with smiles images so you can do that like this:

<?php
    $search = array(":))",":)");
    $replace  = array("<img src=\"template/" . $template . "/smiles/laugh.jpg\" />","<img src=\"template/" . $template . "/smiles/smile.jpg\" />");
    str_replace($search, $replace, $comment);
?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.