[PHP] Re: interface problem in PHP5

2004-09-05 Thread Torsten Roehr
Erik franzén [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 If you want to delete an object, when you have other references to it,
 you must use the  operator, otherwise the object will not be killed for
 all references.

 I tested without the -operator, but that did not work

 The -operator is still important in PHP5. Look at the folling example

 ?
 $a = new stdclass;
 $b = $a;
 $c = $a;
 ?

 unsetting a will only kill a, b and c will still be alive.
 setting a to null will kill c but not b

 /Erik

OK, but what about your interface problem? Could you solve it with this?:


I think you have to also define the arguments you want to use for item() in
your interface:
function item($a_iIndex);


Regards, Torsten Roehr

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: interface problem in PHP5

2004-09-04 Thread Torsten Roehr
Erik franzén [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Can anuyone describe this error?

 Compile Error: E:\Source\CMAES\src\include\dom.inc.php line 67 -
 Declaration of CMAES_DOM_Node_List::item() must be compatible with that
 of CMAES_DOM_Node_List_Interface::item()


 // {{{ interface CMAES_DOM_Node_List
 /**
   *
   * @access public
   */
   interface CMAES_DOM_Node_List_Interface
   {
   function item();


I think you have to also define the arguments you want to use for item() in
your interface:

function item($a_iIndex);


   function search();
   function addItem();
   function removeItem();
   }
 // }}}
 /**
   * CMAES_DOM_Node
   *
   */
 class CMAES_DOM_Node_List implements CMAES_DOM_Node_List_Interface
 {
  // {{{ properties
  /**
  * Number of elements in node list
  * @var integer
  */
  public $iLength = 0;

  /**
  * Nodes in list
  * @var array
  */
  private $_aNodes = array();
  // }}}

  // {{{ item
   /**
   *  Returns the nth index given in item.
   *
   * @param inte $a_iIndex - index in list
   * @return mixed node object or null if item was not found
   * @access public
   */
  function item($a_iIndex)


Are you sure you need '' here? Shouldn't PHP5 pass all variables by
reference on default?

Regards, Torsten Roehr

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: interface problem in PHP5

2004-09-04 Thread Erik Franzén
If you want to delete an object, when you have other references to it, 
you must use the  operator, otherwise the object will not be killed for 
all references.

I tested without the -operator, but that did not work
The -operator is still important in PHP5. Look at the folling example
?
$a = new stdclass;
$b = $a;
$c = $a;
?
unsetting a will only kill a, b and c will still be alive.
setting a to null will kill c but not b
/Erik
Torsten Roehr wrote:
Erik franzén [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Can anuyone describe this error?
Compile Error: E:\Source\CMAES\src\include\dom.inc.php line 67 -
Declaration of CMAES_DOM_Node_List::item() must be compatible with that
of CMAES_DOM_Node_List_Interface::item()
// {{{ interface CMAES_DOM_Node_List
/**
 *
 * @access public
 */
 interface CMAES_DOM_Node_List_Interface
 {
 function item();

I think you have to also define the arguments you want to use for item() in
your interface:
function item($a_iIndex);

 function search();
 function addItem();
 function removeItem();
 }
// }}}
/**
 * CMAES_DOM_Node
 *
 */
class CMAES_DOM_Node_List implements CMAES_DOM_Node_List_Interface
{
// {{{ properties
/**
* Number of elements in node list
* @var integer
*/
public $iLength = 0;
/**
* Nodes in list
* @var array
*/
private $_aNodes = array();
// }}}
// {{{ item
 /**
 *  Returns the nth index given in item.
 *
 * @param inte $a_iIndex - index in list
 * @return mixed node object or null if item was not found
 * @access public
 */
function item($a_iIndex)

Are you sure you need '' here? Shouldn't PHP5 pass all variables by
reference on default?
Regards, Torsten Roehr
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: interface problem in PHP5

2004-09-04 Thread M. Sokolewicz
you could however always call:
$a-__destruct();
that would also kill $b and $c
Erik franzén wrote:
If you want to delete an object, when you have other references to it, 
you must use the  operator, otherwise the object will not be killed for 
all references.

I tested without the -operator, but that did not work
The -operator is still important in PHP5. Look at the folling example
?
$a = new stdclass;
$b = $a;
$c = $a;
?
unsetting a will only kill a, b and c will still be alive.
setting a to null will kill c but not b
/Erik
Torsten Roehr wrote:
Erik franzén [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Can anuyone describe this error?
Compile Error: E:\Source\CMAES\src\include\dom.inc.php line 67 -
Declaration of CMAES_DOM_Node_List::item() must be compatible with that
of CMAES_DOM_Node_List_Interface::item()
// {{{ interface CMAES_DOM_Node_List
/**
 *
 * @access public
 */
 interface CMAES_DOM_Node_List_Interface
 {
 function item();


I think you have to also define the arguments you want to use for 
item() in
your interface:

function item($a_iIndex);

 function search();
 function addItem();
 function removeItem();
 }
// }}}
/**
 * CMAES_DOM_Node
 *
 */
class CMAES_DOM_Node_List implements CMAES_DOM_Node_List_Interface
{
// {{{ properties
/**
* Number of elements in node list
* @var integer
*/
public $iLength = 0;
/**
* Nodes in list
* @var array
*/
private $_aNodes = array();
// }}}
// {{{ item
 /**
 *  Returns the nth index given in item.
 *
 * @param inte $a_iIndex - index in list
 * @return mixed node object or null if item was not found
 * @access public
 */
function item($a_iIndex)


Are you sure you need '' here? Shouldn't PHP5 pass all variables by
reference on default?
Regards, Torsten Roehr
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php