sh0wtym3 Posted December 23, 2009 Share Posted December 23, 2009 I want to be able to do this $results = substr_count("This is a test sentence","test"); $_SESSION("results") = "$results"; But when I try to I get the following error "Fatal error: Can't use function return value in write context" Quote Link to comment https://forums.phpfreaks.com/topic/186179-how-do-you-store-the-return-value-for-substr_count-in-a-session/ Share on other sites More sharing options...
premiso Posted December 23, 2009 Share Posted December 23, 2009 session_start(); // needs to be before any output $results = substr_count("This is a test sentence","test"); $_SESSION["results"] = $results; Should work. You were just using ( ) instead of [ ] . Quote Link to comment https://forums.phpfreaks.com/topic/186179-how-do-you-store-the-return-value-for-substr_count-in-a-session/#findComment-983275 Share on other sites More sharing options...
sh0wtym3 Posted December 23, 2009 Author Share Posted December 23, 2009 Ugh, im such a noob. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/186179-how-do-you-store-the-return-value-for-substr_count-in-a-session/#findComment-983277 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.