开发者

XDebug and VIM. Browsing array values

Is there any way to browse the data inside an array?

Currently I can only see $data[0] = (array) with no way knowing what's inside the array.

I can the values inside normal variables fine.

Is there a way to see inside the arrays? Maybe a command I'm not aware of?

Edit:

I found out I can use the command keys ,e to evaluate an array or object.

After I type ,e an /*{{{1*/ => eval: prompt shows up then I can type /*{{{1*/ => eval: $data[0] to see the values.

Except I get it in the following output format:

/*{{{1*/ => eval: $data[0]

$command = 'eval';开发者_C百科

EVAL_RESULT = (array) ;

EVAL_RESULT = (string) 'stringfromdata0-1' ;

EVAL_RESULT = (string) 'stringfromdata0-2' ;

EVAL_RESULT = (array) 'stringfromdata0-3' ;

This only does half of what I want it to do. Is there any way to output the keys of the array? It only shows me the values, but the keys are shown as "EVAL_RESULT" instead of the their perspective key names of the array.


Edit debugger.vim file (~/.vim/plugin/debugger.vim) and find a line similar to

let g:debuggerMaxDepth = 1

increase the depth varibale to a reasonable amount (5 should be enough) save and restart vim.


Also, you can wrap your expression in var_export(<expr>, true), and it will show you the full object.


You can enter the vim command ,e in a xdebug session.

From there you can evaluate any php line you want; for example

print_r($data);

and submit it with Enter

Note: This will output to your php-cli stdout, or possibly output buffer if you are inside a ob_start block; Or if you are accessing from a browser, it may not output until the entire php request is completed. You may be able to flush a partial output buffer to a browser, but you'll have to Google that one for yourself.


I Posted this as an answer even though its posted in the OP's question because I don't read the OP's question if I'm looking for an answer and I want to make sure people can find it! If the OP posts his answer as an answer and ping's me I'd be happy to delete this one.


Never got it the way I wanted it to work. Instead I found something way better.

Using Vundle I installed the VIM debugger for xdebug below:

https://github.com/joonty/vdebug

I'll post a screenshot whenever I get a chance.

Works like a charm though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜