eyalrosen123rulezz Posted January 9, 2008 Share Posted January 9, 2008 Hello, I'm trying to create a define for array define("NAME", array("x", "y")); but it's outputs error. Is there away to do something like define to array? thanks! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 9, 2008 Share Posted January 9, 2008 Define is used for setting constants. You use <?php $NAME = array('x','y'); ?> to create an array. Ken Quote Link to comment Share on other sites More sharing options...
eyalrosen123rulezz Posted January 10, 2008 Author Share Posted January 10, 2008 I don't understand... Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 10, 2008 Share Posted January 10, 2008 Simple answer: no, you can't define arrays like that. Read: http://us3.php.net/manual/en/function.define.php Find where is says Parameters and read the value part. It tells you what is allowed. If you really want to define an array that badly, I think Ken did have a strategy in using serialize or var_export (not sure which one) and then you can try to define that variable as a string. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.