redarrow Posted March 25, 2006 Share Posted March 25, 2006 Please exsplain the meaning of the two statements in deatails please thank you.What the word print_r mean and do thank you.[code]print_r($whatever);[/code]What var_dump in words mean and do thank you.[code]var_dump($whatever);[/code]Currently working on all arrays statements and functions for my collage work need to understand the above clearly and in deatil thank you.As much info as possable in deth thank you. Quote Link to comment https://forums.phpfreaks.com/topic/5770-var_dump-and-print_r/ Share on other sites More sharing options...
Barand Posted March 25, 2006 Share Posted March 25, 2006 var_dump () output the contents of a variable and also gives its data type and size if it's a string[code]$a = '';$b = 42;$c = 3.141;var_dump($a); //--> string(0) ""var_dump($b); //--> int(42)var_dump($c); //--> float(3.141)[/code]print_r() is a recursive print function and is used view contents of arrays or objects. Use within <pre>..</pre> tags for more readable output[code]$var = array( 'abc' => array(1,2,3), 'def' => array(4,5,6));echo '<pre>',print_r($var, true), '</pre>';[/code]gives-->[code]Array( [abc] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [def] => Array ( [0] => 4 [1] => 5 [2] => 6 ))[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5770-var_dump-and-print_r/#findComment-20555 Share on other sites More sharing options...
redarrow Posted March 25, 2006 Author Share Posted March 25, 2006 barand thank you so much for your reply and time.[!--sizeo:5--][span style=\"font-size:18pt;line-height:100%\"][!--/sizeo--]solved[!--sizec--][/span][!--/sizec--] Quote Link to comment https://forums.phpfreaks.com/topic/5770-var_dump-and-print_r/#findComment-20559 Share on other sites More sharing options...
redarrow Posted March 25, 2006 Author Share Posted March 25, 2006 In genrall how does the var_dump get to echo the messege to the screen amazing.[code]var_dump($john,$lucky);[/code]Out put of var_dump($john)[code]string(8) "iam john" string(1) "1" [/code]Is it becouse var_dump() is a built in function that the php can process the ouput throw the designed files within the php.ini.Or does var mean varable and dump as dumping the varable to screen and dumps the string to screen with the built in file throw php.ini.Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/5770-var_dump-and-print_r/#findComment-20575 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.