Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Possible to search variables array key/value?
Possible to search variables array key/value? [message #93924] Thu, 19 February 2009 06:53 Go to next message
matthew is currently offline matthewFriend
Messages: 14
Registered: July 2009
Junior Member
Sometimes I need to look for specific key or value in some very large
array. Is it possible to search?
Re: Possible to search variables array key/value? [message #93957 is a reply to message #93924] Thu, 19 February 2009 09:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mnm.criion.net

PHP is one of the best documented languages.

http://www.php.net/manual/en/ref.array.php
Re: Possible to search variables array key/value? [message #93971 is a reply to message #93957] Thu, 19 February 2009 10:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mnm.criion.net

Search for value, reutns key:
http://www.php.net/manual/en/function.array-search.php

Search for key, returns true:
http://www.php.net/manual/en/function.array-key-exists.php
Re: Possible to search variables array key/value? [message #94294 is a reply to message #93971] Fri, 20 February 2009 04:10 Go to previous messageGo to next message
matthew is currently offline matthewFriend
Messages: 14
Registered: July 2009
Junior Member
Oh no. I'm sorry I didn't make it clear. I don't mean how to search
using PHP. I mean while degugging, I want to look some specific key
or value of a large array dispalyed in debugger's variable view.

On Thu, 19 Feb 2009 11:03:09 +0100, "Michael N. Madsen"
<mnm@criion.net> wrote:

>Search for value, reutns key:
>http://www.php.net/manual/en/function.array-search.php
>
>Search for key, returns true:
>http://www.php.net/manual/en/function.array-key-exists.php
Re: Possible to search variables array key/value? [message #94303 is a reply to message #94294] Fri, 20 February 2009 08:48 Go to previous messageGo to next message
D Kelsey is currently offline D KelseyFriend
Messages: 232
Registered: July 2009
Senior Member
If you are using xdebug you need to expand all the elements in the variables view of the array, then
you can RMB to get the popup menu and select find.

You need to expand the array to request the data from xdebug. The whole array information including
the keys are not downloaded in one large chunk, but requested when you expand the elements so it
would not be possible to search for the information until all the keys are retrieved from xdebug.

Alternatively if you know the key value, you can create a watch expression to display just that value.

Dave Kelsey

Matthew Young wrote:
> Oh no. I'm sorry I didn't make it clear. I don't mean how to search
> using PHP. I mean while degugging, I want to look some specific key
> or value of a large array dispalyed in debugger's variable view.
>
> On Thu, 19 Feb 2009 11:03:09 +0100, "Michael N. Madsen"
> <mnm@criion.net> wrote:
>
>> Search for value, reutns key:
>> http://www.php.net/manual/en/function.array-search.php
>>
>> Search for key, returns true:
>> http://www.php.net/manual/en/function.array-key-exists.php
Re: Possible to search variables array key/value? [message #94351 is a reply to message #94294] Fri, 20 February 2009 21:16 Go to previous messageGo to next message
Shawn Clark is currently offline Shawn ClarkFriend
Messages: 70
Registered: July 2009
Member
Matthew,

To expand on Dave's comment towards the end of his post. Watch
Expressions are a very powerful part of debugging. Unfortunately when
you first go into PHP Debugging mode that view is not present. If you go
to the menu for Window -> Show View -> Expressions you will get a new
tab available. Within this view you can create expressions that you want
to evaluate wherever you are in your code. You could then setup an
expression to do an array search for the key / value you want and as you
step through the code the expression would continue to be re-evaluated.
It provides a lot of power over the Variables view as that is just a
full dump of all the variables.

--
Shawn Clark

Matthew Young wrote:
> Oh no. I'm sorry I didn't make it clear. I don't mean how to search
> using PHP. I mean while degugging, I want to look some specific key
> or value of a large array dispalyed in debugger's variable view.
>
> On Thu, 19 Feb 2009 11:03:09 +0100, "Michael N. Madsen"
> <mnm@criion.net> wrote:
>
>> Search for value, reutns key:
>> http://www.php.net/manual/en/function.array-search.php
>>
>> Search for key, returns true:
>> http://www.php.net/manual/en/function.array-key-exists.php
Re: Possible to search variables array key/value? [message #94364 is a reply to message #94351] Sat, 21 February 2009 07:03 Go to previous message
matthew is currently offline matthewFriend
Messages: 14
Registered: July 2009
Junior Member
This is awesome! Thank you.
Previous Topic:Template Contexts
Next Topic:No autocompletion - even with simple code
Goto Forum:
  


Current Time: Mon Dec 04 03:52:13 GMT 2023

Powered by FUDForum. Page generated in 0.02485 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top