i want to use implode function for exploded veriables. i am using this function but i want to use in my class. public function array_implode($arrays, &$target = array()) { foreach ($arrays as $item) { if (is_array($item)) { $this->array_implode($item, $target); } else { $target[] = $item; } } return $target; } PHP: using: $return = implode('|', $this->array_implode($sonuc2)); PHP: this error Warning: Invalid argument supplied for foreach() in C:\AppServ\www\disavurv2\classes\arkadas.class.php on line 7 PHP: Function's line 7 foreach ($arrays as $item) { PHP: Help me
Run a print_r on the original array before passing it to the method. What does it show? Also, I would replace array_implode($arrays, &$target = array()) with array_implode($arrays, $target = array()) Pass by reference is depreciated in php 5.3+