I executed this example and object comparison returned true on clone call.<br>But it returned false when I request another reference from same layer from getLayer.<br>Should not it return true ?<br><br><br>#/* 09/04/2010 test for mapserver object comparison on PHP.<br>
# If I clone a layer object from a map instance and compare the cloned with ref, do they are the same ?<br># Answer: yes.<br># PHP state: Two object instances are equal if they have the same attributes and values, and are instances of the same class<br>
#require_once dirname( __FILE__ ).&#39;/class/mapfile/Mapfile.php&#39;;<br>#Mapfile::checkLibrary();<br><br>$map = ms_newMapObj( &#39;&#39; );<br>var_dump( $map-&gt;numlayers );<br>$l = ms_newlayerobj( $map );<br>var_dump( $map-&gt;numlayers );<br>
print( nl2br( &quot;\n&quot; ) );<br>$l-&gt;set( &#39;type&#39;, MS_LAYER_POLYGON );<br>#var_dump( $l-&gt;type );<br>$lClone = clone $l;<br>var_dump( __LINE__, ( $l == $lClone ) );<br>var_dump( __LINE__, ( $l == $map-&gt;getLayer( 0 ) ) );<br>
$lRef = $map-&gt;getLayer( 0 );<br>var_dump( __LINE__, ( $l == $lRef ), $l-&gt;type, $lRef-&gt;type );<br><br>#repeated test but now with $l from the reference from getLayer<br>print( nl2br( &quot;\n&quot; ) );<br>$l = $map-&gt;getLayer( 0 );<br>
$lClone = clone $l;<br>var_dump( __LINE__, ( $l == $lClone ) );<br>var_dump( __LINE__, ( $l == $map-&gt;getLayer( 0 ) ) );<br>$lRef = $map-&gt;getLayer( 0 );<br>var_dump( __LINE__, ( $l == $lRef ), $l-&gt;type, $lRef-&gt;type );<br>
<br>exit;<br>