Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,104 questions

40,777 answers

573 users

How to get the data type of a variable in PHP

9 Answers

0 votes
$n = 10000;

var_dump($n);

 
/*
run:

int(10000) 
 
*/

 





answered Oct 20, 2015 by avibootz
0 votes
$n = 3.14;

var_dump($n);

 
/*
run:

float(3.14) 
 
*/

 





answered Oct 20, 2015 by avibootz
0 votes
$n = "abc";

var_dump($n);

 
/*
run:

string(3) "abc" 
 
*/

 





answered Oct 20, 2015 by avibootz
0 votes
$n = "a";

var_dump($n);

 
/*
run:

string(1) "a" 
 
*/

 





answered Oct 20, 2015 by avibootz
0 votes
$n = 'b';

var_dump($n);

 
/*
run:

string(1) "b" 
 
*/

 





answered Oct 20, 2015 by avibootz
0 votes
$n = null;

var_dump($n);

 
/*
run:

NULL 
 
*/

 





answered Oct 20, 2015 by avibootz
0 votes
$a = true;
var_dump($a);

echo "<br />";

$b = false;
var_dump($b);

 
/*
run:

bool(true)
bool(false) 
 
*/

 





answered Oct 20, 2015 by avibootz
0 votes
$arr = array("C", "Assembler", "PC-MAC");

var_dump($arr);
 
/*
run:

array(3) { [0]=> string(1) "C" [1]=> string(9) "Assembler" [2]=> string(6) "PC-MAC" } 

*/

 





answered Oct 20, 2015 by avibootz
0 votes
class Test 
{
    function F() 
    {
        echo "class Test";
    }
}

$o = new Test();

var_dump($o);
 
/*
run:

object(Test)#1 (0) { } 

*/

 





answered Oct 20, 2015 by avibootz

Related questions

1 answer 96 views
1 answer 61 views
61 views asked Aug 24, 2020 by avibootz
1 answer 86 views
2 answers 109 views
...