CSI: PHP

"Looking at your tweets I cannot even fathom what your job is. CSI:PHP?" — @grmpyprogrammer

I Think I'm Going to Be Ill . . .

| Comments

Yup, I just threw up in my mouth a little.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php

foreach ($this->models as $model) {
    $_file = '../' . $this->app . 'Models/' . $model . 'Model.php';
    $_class = $model . 'Model';

    if (file_exists($_file)) {
        require_once $_file;
        $this->{ucfirst($model)} = new $_class(null, dbConfig::$default);
    } else {
        $class = 'class ' . $_class . ' extends Model { }';
        eval($class);
        $this->{ucfirst($model)} = new $_class(null, dbConfig::$default);
    }
}

Source

Comments