KillerBean Posted August 29, 2006 Report Share Posted August 29, 2006 Sveiki. Nezinu peec kaadas funkcijas mekleet... :( nepiecieshams ir paarbaudiit vai mainiigais $xx sastaav a)no cipariem... b)no cipariem un "." kjipa taa lai var izmest erroru ja false! Link to comment Share on other sites More sharing options...
Toms Posted August 29, 2006 Report Share Posted August 29, 2006 Sāc ar šo funkciju sarakstu: http://lv.php.net/manual/en/ref.var.php Link to comment Share on other sites More sharing options...
march Posted August 29, 2006 Report Share Posted August 29, 2006 if(preg_match("/[^0-9\.]/",$xx)) { echo "errors"; } else { print "viss ok"; } Ja gribi bez punkta, tad izņem ārā \. Link to comment Share on other sites More sharing options...
Analgiins Posted August 30, 2006 Report Share Posted August 30, 2006 if (ctype_digit($str) && strpos($str, ".") !== false){ // ir cipari un punkts (maybe vairāki punkti) } Link to comment Share on other sites More sharing options...
Delfins Posted August 30, 2006 Report Share Posted August 30, 2006 (edited) imho, kaut kā aptuveni šitā /([\d]+(\.[\d]+){0,1})/ Edited August 30, 2006 by Delfins Link to comment Share on other sites More sharing options...
bubu Posted August 30, 2006 Report Share Posted August 30, 2006 Analgīnis - nav pareizi. ctype_digit atgriezīs false, ja kaut viens čars nebūs cipars, piemēram tas būs punkts. Link to comment Share on other sites More sharing options...
Recommended Posts