php get array values as new variable for ldap


suppose I got an array like this:

array ([0] => array([0]=>dog [1]=>cat))

How am I able to get just only "dog" and "cat" to store them in variables? I would like to use them for a further search. Like okay I find one array animals with these values, take each value to find arrays which describes the dog and cat races.

my try failed:

echo '<pre>';
foreach($result as $animals){

$find = animals[i];
$filter = "(objectClass=*)";
$show = array("race","subrace");
$animalSearch = ldap_search($ds, $find, $filter, $show) or die "...";
$animalInfos = ldap_get_entries($ds,$animalSearch) or die"shit";



as waterloomatt said, accessing multi arrays are the key and i think i pretended his suggestions wrong. finally i got a solution:

$filter = "(description=just animals)";
$attr = array("name");
$search = ldap_search($ds, $dn, $filter, $attr) or die("not successfull");

$info = ldap_get_entries($ds, $search) or die ("no entries");

echo '<pre>';
foreach($info as $animals => $values){

          foreach($values as $newDn) {
              for ($i = 0; $i < count($newDn); $i++) {
                  echo $newDn[$i];
                  $RaceFilter = "(objectClass=*)";
                  $justthese = array("name", "color");
                  $raceSearch = ldap_search($ds, $newDn[$i], $RaceFilter, $justthese) or die("can't search");
                  $race = ldap_get_entries($ds, $raceSearch) or die ("no entries");



People are also looking for solutions to the problem: Passing value from HTML link to use in php if statement on next page


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.