Web Hosting Talk







View Full Version : Print item from an array


raulgonzalez
06-04-2008, 08:11 PM
Hello, I have the following array that gets displayed from an LDAP expample. How can I make the broswer print the items by themselves instead of the array. for example to print:

Emai: raul.gonzalez@email.com

bool(true)
Array
(
[count] => 1
[0] => Array
(
[telephonenumber] => Array
(
[count] => 1
[0] => 956-555-5555)

[0] => telephonenumber
[displayname] => Array
(
[count] => 1
[0] => Raul Gonzalez
)

[1] => displayname
[memberof] => Array
(
[count] => 9
[0] => CN=Employees,OU=Distribution & Security Groups,DC=LCCNET,DC=EDU
[1] => CN=Wellness Program,OU=Distribution & Security Groups,DC=LCCNET,DC=EDU
[2] => CN=Administrative Professional-Technical,OU=Distribution & Security Groups,DC=LCCNET,DC=EDU
[3] => CN=Physical Plant,OU=Distribution & Security Groups,DC=LCCNET,DC=EDU
[4] => CN=IT Support,OU=Distribution & Security Groups,DC=LCCNET,DC=EDU
[5] => CN=Server Operators,CN=Builtin,DC=LCCNET,DC=EDU
[6] => CN=Administrators,CN=Builtin,DC=LCCNET,DC=EDU
[7] => CN=Domain Admins,CN=Users,DC=LCCNET,DC=EDU
[8] => CN=Domain Users,CN=Users,DC=LCCNET,DC=EDU
)

[2] => memberof
[department] => Array
(
[count] => 1
[0] => Information Technology
)

[3] => department
[primarygroupid] => Array
(
[count] => 1
[0] => 513
)

[4] => primarygroupid
[samaccountname] => Array
(
[count] => 1
[0] => raul.gonzalez
)

[5] => samaccountname
[mail] => Array
(
[count] => 1
[0] => raul.gonzalez@email.com)

[6] => mail
[count] => 7
[dn] => CN=Raul Gonzalez,OU=Physical Plant Dept,DC=LCCNET,DC=EDU
)

)

andren
06-04-2008, 10:42 PM
print "Email: $arrayname[5][0]";

raulgonzalez
06-05-2008, 10:09 AM
Hello, thank you.

For some reason it didn't work with the example you gave me, but this did the trick.

echo "Email: " . $result[0][mail][0] . "<br>\n";

Thank you again.