Jump to content

karmacrow

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by karmacrow

  1. Hi, this should be an easy one but still somehow im not getting it. I want to validate a zip code (a german one) which is made up of exactly 5 numbers. So i use the following code function fValidate_Postcode($postcode) { if( ereg("[0-9]{5}", $postcode)===false ) { return false; } return true; } but for some reason it returns true when the postcode is longer than 5 numbers. Why? I thought the {5} should make the regular expression only match if there are exactly 5 numbers? Thanks for your help!
  2. Hi everyone I am trying to replace some specific characters in a file but I am not being able to do this. It is a type of apostrophe... For example in the following text excerpt <td class="card" align='left'> Night’s Whisper </td> I would like to replace the ’ in the word Night. However when putting the file contents into a string (via fopen and co) and the using $contents = str_replace("’","'",$contents); nothing happens, and nothing is replaced. How can I replace this type of characters. I have very little idea about text encoding and the likes so any help will be heavily appreciated. Thanks a lot
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.