NameSilo

Why isn't it doing it

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Spacemail by SpaceshipSpacemail by Spaceship
Watch
Impact
19
hey
i am reading a PHP ebook and it tells me how to change the type of a string..and i m doing what the book says but it keeps saying that the string is A "STRING" rather then a DOUBLE

here is the code
PHP:
define(SPACE, "<br/>");
define (A, " ") ;
$number = 1;
$number2 = "3.14";

print gettype(number2). SPACE;
settype($number2, double);
print gettype(number2). SPACE;

here is wt it displayS:
string
string
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
bool settype ( mixed &var, string type )

Set the type of variable var to type.

Possibles values of type are:
"boolean" (or, since PHP 4.2.0, "bool")
"integer" (or, since PHP 4.2.0, "int")
"float" (only possible since PHP 4.2.0, for older versions use the deprecated variant "double")
"string"
"array"
"object"
"null" (since PHP 4.2.0)

Make it a float? I've never heard of double before.

It also needs quotes.

settype($number2, "float");

Also, I think you need to make it gettype($number2).. you don't have the $.
 
1
•••
Muhahaha
the problem was "$" :p
silly me
and double is a type..its the same as Float....
thanks :D

rep added :D
 
0
•••
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

Parking: find your domains by pasting a list
You can now paste a list of domain names into the search box at the top of the Parking menu. Put one name on each line. Your domain list...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back