SORU
8 Mayıs 2010, CUMARTESİ


Nasıl Dize Boolean Dönüştürmek

Bir dize dönüştürmek istiyorum hangi boolean bir değişken var

$res = true;

Ayrıca biçimi "true" "false" "0" "1" dönüştürülmüş değer ihtiyacım var

$converted_res = "true";
$converted_res = "false";

Denedim:

$converted_res = string($res);
$converted_res = String($res);

ama string String fonksiyonlar tanınmaz söylüyor. Nasıl biçimde bir dize "doğru" veya "yanlış" php mi? bu boolean dönüştürebilirim

CEVAP
8 Mayıs 2010, CUMARTESİ


$converted_res = ($res) ? 'true' : 'false';

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • DetroitBORG

    DetroitBORG

    29 Temmuz 2008
  • SRI International

    SRI Internat

    30 NİSAN 2008
  • The Computer Chronicles

    The Computer

    7 Kasım 2012