Welcome Guest, Not a member yet? Register   Sign In
Missing argument 1 for Enumerator::__construct(), called in system/libraries/Loader.php on line 928 and defined
#1

[eluser]johnmerlino[/eluser]
Hey all,

Code:
//autoload.php

$autoload['libraries'] = array('enumerator');

//libraries/enumerator.php

<?php
class Enumerator {
    public $arr;

    public function __construct($array) {
        $this->arr = $array;
    }

    public function each($lambda) {
        array_walk($this->arr, $lambda);
    }
//views/partials/_contact.php
        $elements = new Enumerator(array('email','fax','phone','postal mail'));
        echo $elements->each(function($l){ form_checkbox("checked[]",$l) });

It throws this error:

Code:
Missing argument 1 for Enumerator::__construct(), called in system/libraries/Loader.php on line 928 and defined


thanks for response
#2

[eluser]johnmerlino[/eluser]
adding a default argument to constructor made error go away




Theme © iAndrew 2016 - Forum software by © MyBB