Tag: codeigniter

How to Use array_walk in Codeigniter

The key thing to know is that you need give array_walk / array_walk_recursive an array

    function lets_walk() {
        $sweet = array('a' => 'apple', 'b' => 'banana');
        $fruits = array('sweet' => $sweet, 'sour' => 'lemon');
        array_walk_recursive($fruits, array($this, "walk_print"));
    }

    function walk_print($value, $key){
        print($value);
    }

Special Characters in Codeigniter Urls

When Codeigniter gets variables from the URL, it returns the variables in HTML friendly characters. I couldn’t figure out why my left and right brackets were acting up. So what you need to do is just use a simple php string replace function and replace the special characters you need.

$string = str_replace("(", "(", $string)
$string = str_replace(")", ")", $string);

This will just just switch back the left and right brackets into special characters agai


  • Sponsors

  • Twitter Feed

  • Comments

  • Copyright © 2009-2011 SK3TCHY. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress