Welcome Guest, Not a member yet? Register   Sign In
declaring a list as a glabal array not working
#1

[eluser]jerry01[/eluser]
i'm trying to have a list i can use throughout my controller. i can't find a way of getting it to work with "var"

can anyone comment?

it seems that var does not really pass the full info.


Code:
class Controller extends CI_Controller
{

    var $field_list = array('f1','f2','f3','f4','f5','f6');
...

    function index()
    {
        foreach($this->field_list as $field):
            print("------&gt;" + $field + "<BR>");
        endforeach;

the outcome of that is just a bunch of zeroes..
#2

[eluser]John_Betong_002[/eluser]
Try this:
Code:
// http://th.php.net/manual/en/function.print.php
foreach($this->field_list as $field):
// print("------&gt;" + $x + $title ."<BR>");
print $field ."<br />";
endforeach;

echo '<pre>';
  print_r($this->field_list);
echo '</pre>';
&nbsp;
&nbsp;




Theme © iAndrew 2016 - Forum software by © MyBB