ohmygod Posted March 7, 2005 Report Share Posted March 7, 2005 ir formas lauks, kuraa ievadaas skaits. eregi("[0-9]{1,2}",$sk) tjip paarbaudu saturu, driikst buut viens vai divi cipari. Nekas vairaak, bet - probleema sleepjas tur, ka var ievadiit vienu ciparu un vienu burtu. :/ baigi slikti - man tas neder. Kaa man pareizi uzrakstiit stringa paarbaudi, lai tajaa driiksteetu atrasties TIKAI cipari? viens vai divi... es jau, kaa dumsh buudams - sadomaaju, ka jaacheko str garums un tad atkariibaa no taa {} jaaliek konkreetais skaits... a mok taa ij dariit? tik liekas ka tas nebuut pareizi (: varbuut kaads vispaar var normaalaa valodaa apskaidrot, kaa shitie visi pareizi rakstaas... Link to comment Share on other sites More sharing options...
blackhalt Posted March 8, 2005 Report Share Posted March 8, 2005 <?php $sk='01'; if(eregi("^([0-9]){1,2}$",$sk)){ echo 'ir'; }else{ echo 'nav'; } ?> Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 8, 2005 Report Share Posted March 8, 2005 ja tev der kad ir arii viens cipars (teiksim 1 vai 9) tad paarveert stringu integeraa un paarbaudi vai nav lielaaks par 99 ;) burti pazudiis kaa nebijushi :) Jebkuraa gadijumaa 01==1 ;) (ja vien tas nav strings) Link to comment Share on other sites More sharing options...
Venom Posted March 8, 2005 Report Share Posted March 8, 2005 laikam parastākajā gadījumā strādāja $input*1!=0 Link to comment Share on other sites More sharing options...
hmnc Posted March 8, 2005 Report Share Posted March 8, 2005 varam arī taisīt <?php $input = '12'; // tjip strings $input = (int)$input; // $input buus integer ?> un tad jau operēt tālāk. nu tas ir, ja es pareizi sapratu ideju :) Link to comment Share on other sites More sharing options...
Venom Posted March 9, 2005 Report Share Posted March 9, 2005 te jāuzmanās The value is given by the initial portion of the string. If the string starts with valid numeric data, this will be the value used. Otherwise, the value will be 0 (zero). Valid numeric data is an optional sign, followed by one or more digits (optionally containing a decimal point), followed by an optional exponent. The exponent is an 'e' or 'E' followed by one or more digits. resp. (int)'2a'==2 Link to comment Share on other sites More sharing options...
Recommended Posts