Page 1 of 1

Troublesome callbackfunction

Posted: Wed Jul 21, 2004 11:29 am
by tores
Hi

Can someone tell me why $serie is unset in the callback-function hentSerie?

Code: Select all

<?php
  /* Other function */
  $serie = "A";
  $Aserie = array_filter($identifikatorer, "hentSerie");

/* Callback function */
function hentSerie($element){
  global $serie;
  return ($serie == $element{0});
}

?>

Posted: Wed Jul 21, 2004 3:00 pm
by Buddha443556
Seems to work for me.

Code: Select all

$identifikatorer:
array(3) &#123;
  &#1111;0]=>
  string(5) "A car"
  &#1111;1]=>
  string(4) "boat"
  &#1111;2]=>
  string(7) "A house"
&#125;

$Aserie:
array(2) &#123;
  &#1111;0]=>
  string(5) "A car"
  &#1111;2]=>
  string(7) "A house"
&#125;