Jump to content
php.lv forumi

Neievieto bildi pie noteiktā lietotāja ID.


iall

Recommended Posts

  • Replies 39
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

is_numeric() laidīs cauri arī daļskaitļus:

 

Finds whether the given variable is numeric. Numeric strings consist of optional sign, any number of digits, optional decimal part and optional exponential part. Thus +0123.45e6 is a valid numeric value. Hexadecimal notation (0xFF) is allowed too but only without sign, decimal and exponential part.

 

Bet vispār gan es parasti aprobežojos ar is_numeric() + vēl vērtību ar (int) nokāstoju (piespiežu būt) par int tipa mainīgo.

 

if (is_numeric($id)) {
$id = (int) $id;
}

 

Protams, tā nav ideāla pārbaude.

Link to comment
Share on other sites


×
×
  • Create New...