Jump to content

vinpkl

Members
  • Posts

    448
  • Joined

  • Last visited

Everything posted by vinpkl

  1. hi andy thanks. it works great. vineet
  2. hi Andy i saw the link you gave but they have no where explained how to separate the two numeric values that we get. what they are checking is about numeric and alpha numeric values. that i have already done. vineet
  3. hi all i have a string like "123 abc 45". i am using the below code to extract numeric from string. The result i get for numeric value is "12345". How can i get the result as "123" and "45" as separate two keywords. <?php $string = "123 abc 45"; $chars = ''; $nums = ''; for ($index=0;$index<strlen($string);$index++) { if(isNumber($string[$index])) $nums .= $string[$index]; else $chars .= $string[$index]; } echo "Chars: $chars<br>Nums: $nums"; function isNumber($c) { return preg_match('/[0-9]/', $c); } ?> vineet
×
×
  • 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.