Re: [PHP] array of java-objects

From: Helke SchröDer (hschroeder_at_dr-t.de)
Date: 10/23/03


To: php-general@lists.php.net
Date: Thu, 23 Oct 2003 17:15:06 +0200

Hi,

thanks for the replay

the var_dump on the array of java-objects looks interesting:

the first, which is ok:

array(8) { [0]=> &object(java)(1) { [0]=> int(3) } [1]=> &object(java)(1)
 [0]=> int(4) } [2]=> &object(java)(1) { [0]=> int(5) } [3]=>
&object(java)(1) { [0]=> int(6) } [4]=> &object(java)(1) { [0]=> int(7) }
[5]=> &object(java)(1) { [0]=> int(8) } [6]=> &object(java)(1) { [0]=>
int(9) } [7]=> &object(java)(1) { [0]=> int(10) } }

but the second is strange:

array(8) { [0]=> int(20) [1]=> &object(java)(1) { [0]=> int(21) } [2]=>
&object(java)(1286082128) { } [3]=> &object(java)(1) { [0]=> int(23) } [4]=>
&object(java)(1) { [0]=> int(24) } [5]=> &object(java)(1) { [0]=> int(25) }
[6]=> &object(java)(1) { [0]=> int(26) } [7]=> &object(java)(1) { [0]=>
int(27) } }

Why is that? The first element of that array is not a java-object.

The same with the third one:

array(9) { [0]=> int(37) [1]=> &object(java)(1) { [0]=> int(38) } [2]=>
&object(java)(1) { [0]=> int(39) } [3]=> &object(java)(1) { [0]=> int(40) }
[4]=> &object(java)(1) { [0]=> int(41) } [5]=> &object(java)(1) { [0]=>
int(42) } [6]=> &object(java)(1) { [0]=> int(43) } [7]=> &object(java)(1)
 [0]=> int(44) } [8]=> &object(java)(1) { [0]=> int(45) } }

thanks in advance, Helke

here is the code:

<?php

error_reporting(E_ALL);

echo("<html><head><title>test ldx per php</title></head><body>");

$ldaphost="195.180.92.49";

$such_art="inh";

$filter="cn=*";

$base="dc=schule,dc=de";

$LdxInf=null;

$LdxInf=new Java("ldxUtil.LdxInterface");

$ObjectDNs=null;

$ObjectDNs=$LdxInf->FindObjects($ldaphost, "", "", $filter, $base);

echo("<hr>");

array_walk($ObjectDNs, "traverse_array");

echo("<hr>");

echo("<table>");

foreach ($ObjectDNs as $item)

{

$LdxAttributes=null;

echo("<tr><td bgcolor=\"#FF8000\">");

var_dump($LdxInf);

echo("</td></tr>");

echo("<tr><td bgcolor=\"#00FFFF\">".$item."</td>");

$LdxAttributes=array();

$LdxAttributes=$LdxInf->InheritanceReader($ldaphost, "","", $item);

$c=null;

$c=count($LdxAttributes);

echo("<td>".$c."</td></tr>");

reset($LdxAttributes);

echo("<tr><td bgcolor=\"#C0C0C0\">");

var_dump($LdxAttributes);

echo("</td></tr>");

$sa=null;

$sa=new Java('ldxUtil.LdxAttribute');

reset($LdxAttributes);

$sa=$LdxAttributes[0];

echo("<tr><td bgcolor=\"#FFFF80\">");

var_dump($sa); /*the first object comes as java-object, the both following
as int(20) and int(37)*/

echo("</td></tr>");

$s=null;

/*$s=$sa->getAttribute();

echo("<tr><td bgcolor=\"#80FF80\">");

var_dump($s);

echo("</td></tr>");

echo("<tr><td>".$s."</td></tr>");*/

unset($s);

unset($sa);

reset($LdxAttributes);

for ($i=0;$i<$c;$i++)

{

echo("<tr><td>some text</td></tr>");

$a=null;

$a=new Java('ldxUtil.LdxAttribute');

/*echo("<tr><td>".$LdxAttributes[$i]->getAttribute()."</td></tr>");*/

unset($a);

}

unset($LdxAttributes);

unset($c);

}

function traverse_array($value) {

print $value."<br>";

}

unset($ObjectDNs);

unset($LdxInf);

unset($base);

unset($filter);

unset($such_art);

unset($ldaphost);

echo("</table></body></html>");

?>



Relevant Pages

  • Re: Array template parameters
    ... the out of class initialization is required. ... I agree that if if 'array' has type ... which is the case because it is extern const. ... Strange. ...
    (comp.lang.cpp)
  • Re: Defining the range of an array
    ... Although I am used to the zero start indexer, is in my opinion the way VB ... Dim ias integer are 11 integers in an array. ... It looks strange, however I hope this helps anyway something. ... Cor ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Transferring data to heterogeneous clients
    ... GenericTable(which is "Array of GenericTable"). ... John Saunders [MVP] ... I posted a replay on May 4th but I cannot see it so I will try to ... Public Col1 As String ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: read file contents to a variable
    ... > Is there a reason the filefunction makes an array? ... The readfile() ... > function is even more strange, it dumps the contents to the screen but ...
    (alt.php)
  • Re: Type Mismatch Problem in VB
    ... let me define the data array I am extracting from. ... > I am new to writing a VB script, and have encountered what I consider to ... > be a strange issue. ... > Ints as Variants and return the array of Variants, ...
    (microsoft.public.scripting.vbscript)