Questions tagged [var-dump]

var_dump is a PHP function that dumps information about a variable.

var_dump is a PHP function that dumps information about a variable.

Examples

$a=array(1,2,3);
var_dump($a);
$b="hello so";
var_dump($b);

returns

array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }
string(8) "hello so"

References

332 questions
0
votes
1 answer

Var_Dump (Error 400 - Bad Request)

I am working on a little project for a programming course here on my university. It involves getting data from the google api (JSON) and providing some of that information to the user. function compare($city, $start, $destination) { // merge…
0
votes
5 answers

unreadable var_dump() output on Snow Leopard?

I have xdebug configured as shown below but the error-output is totally unreadable. Do you have an idea what's wrong with the setup? TIA & best regards Setup: Apache/2.2.13 (Unix) PHP/5.3.0 on Snow Leopard Server Config from…
Paul
  • 63
  • 7
0
votes
3 answers

indentation with var_dump array output

I am auto generating some code and using var_export to output an array in a parseable format. Any ideas as to how I might get it to indent so it matches the rest of the output protected function getCode(){ $rs = ' $this->add('; …
codebrent
  • 43
  • 1
  • 3
0
votes
5 answers

PHP var_dump is displaying NULL when using explode function

My var_dump displays NULL Below is my code: $dareas = rtrim($areas,","); $areasinarray = explode($dareas); var_dump($areasinarray); As far as the $dareas is concerned, it is a string which values are 15,12,14,19 What is wrong with this code?
Sarah
  • 117
  • 1
  • 9
0
votes
1 answer

codeigniter var_dump size output not ok

Someone can tell me why it output this : array(4) { [0]=> string(2) "52" [1]=> string(10) "Tofu ferme" [2]=> string(1) "1" [3]=> string(17) "paquet(s)" } The 17 ??
Choubidou
  • 351
  • 2
  • 4
  • 17
0
votes
2 answers

MySQL - select only one (random) image of many

I got stucked with one mysql query and i hope you guys can crack it... Ok, so my query selects all products witch are featured and active and displays them on front page... But problems appears when product has more then one image. This products are…
Valor_
  • 3,461
  • 9
  • 60
  • 109
0
votes
1 answer

var_dump for a function in a class return Fatal error: Call to undefined function

I tried to manipulate var dump with a function inside a class, but failed. I received the error for the 2nd var dump. 1st dump was correctly shows a json result with the array. here is the error: Fatal error: Call to undefined function…
ey dee ey em
  • 7,991
  • 14
  • 65
  • 121
0
votes
1 answer

Object of std:: class cannot be converted to string

Below is a sample json code that I want to access...This json is actually coming from an API. Whenever I copy and paste the entire json in json lint..It says valid json.. foreach ($movies as $movie) { echo "theaters…
user2779848
  • 39
  • 2
  • 9
0
votes
1 answer

Why does my php script not "notice" post requests?

I have been running a web service off of a php file. For no apparent reason (possibly some settings changes?), it now suddenly does not "notice" the posted request. When I echo var_dump($_POST), I get a 0-length array. If I post the same request…
Lugubrious
  • 380
  • 1
  • 3
  • 16
0
votes
0 answers

echo Spitting Out Extra Characters

Here's what's going on and the results of each (desired behavior): echo urlencode('q&a'); // q%26a echo str_replace('&', '%26', 'q%26a'); But when I try this with wordpress it breaks: $title = strtolower(str_replace(' ', '-',…
Jacksonkr
  • 31,583
  • 39
  • 180
  • 284
0
votes
2 answers

PHP: Get value from array

I am using the bukkit JSONAPI and php JSONAPI.php to get the list of players on my minecraft server to my website. To get the count, I do this: require('JSONAPI.php'); // get this file at: …
0
votes
1 answer

Pass Values into PHP variables from XML name space using SimpleXMLElement

I have XML content using SimpleXMLElement and var_dump results are appeared. Sample Code: $data = new SimpleXMLElement($xml); $data->registerXPathNamespace('ns','http://endpoint.websitecom/'); $part =…
Sathiska
  • 495
  • 1
  • 6
  • 22
0
votes
4 answers

Var_dump doesnt work

In this simple class i want for example var_dump the rule. But this doesnt work. Does anyone have an idea? Ok, i have made some changes. It gives back after a post true or false. It works. Is this code the good way of OOP? class…
Bas
  • 2,330
  • 4
  • 29
  • 68
0
votes
2 answers

Variable Blank until Dumped

Variable $now won't display unless it is dumped. It's populated. It doesn't display the "now is empty" string at all. It won't display what is inside $now unless it is var_dump or var_exported. $ipData = json_decode( $ttt, true); $now=""; if…
0
votes
2 answers

var_dump - how to get the particular value from dump PHP

I know there is alot of information available in regards to PHP - var_dump my question is if I need to pick the particular information from the dump I am receiving from the API which is returning different array object....for example the below dump…
Cortez Ninja
  • 97
  • 3
  • 16