Jump to content


Photo

Using ereg_replace with parenthesis


  • Please log in to reply
3 replies to this topic

#1 jmichael68

jmichael68
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 24 October 2006 - 08:53 PM

I'm having some trouble replacing a parenthesis in my string.  Here is one variation of what I've already tried.


$text = ')FOOTBALL';
$numer12 = '';
$text = ereg_replace('/)/';, $numer12, $text);

Does anyone have a quick fix for my problem?

Thanks




#2 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 24 October 2006 - 09:01 PM



<?php

  $string = ')Football';
  $numer12 = '';
  
  $new = str_replace(")",$numer12,$string);
  
  echo"$new";

?>

PHP Ninja

#3 jmichael68

jmichael68
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 24 October 2006 - 09:47 PM

I get this message

Parse error: syntax error, unexpected T_STRING in /webroot/s/u/supfr001/ssl/functions.php on line 895

also $string is part of an array.




#4 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 25 October 2006 - 02:41 AM

That code definitely works (one I showed you). I would have to see a bigger sample of your code from the file that's yielding the parse error.
PHP Ninja




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users