如何在jquery零件代码中格式化多个数组(php)的一个元素

When i Login this part of the code is executed:

 $_SESSION['user'] = array('user_id' => $user[0]['user_id'], 'IP' => $_SERVER['REMOTE_ADDR']);

now on the upfollowing php page this code has to read the user_id

 $.tablesorter.setFilters( table, ['', '<?=$_SESSION["favcolor"];?>'  ], true);

where 'favcolor' is, needs the 'user_id' be...

but how do i format that?

i thought it was like so: (i got that idea from this site, i thougth it was a Multi array http://www.w3schools.com/php/php_arrays_multi.asp )

 '<?=$_SESSION[0][1];?>'

but that does not work..

so how should it be formated then?

pls help

almost there, only the word 'ARRAY' is now in the column

$.tablesorter.setFilters( table, ['', '<?=$_SESSION["user"];?>'  ], true);

You can use $_SESSION['user']['user_id'] to access user_id from the $_SESSION array.

In this :

$.tablesorter.setFilters( table, ['', '<?=$_SESSION["user"];?>'  ], true);

You are getting ARRAY because $_SESSION["user"] is really an array containing user_id and IP. You need to specify the index user_id for retrieving the value of user_id from that.