richanderson Posted February 18, 2013 Share Posted February 18, 2013 (edited) Hi Guys, So first time beginner coder and I have been doing a lot of tutorials. I tend to be the kinda person to Google stuff before I post and I really couldnt find help with my issue. So first, my code (Please disregard the comments in the code as its for my own use later so I know what I did) session_start(); // Deals with login sections $path = dirname(__FILE__); // Is the entire path up on this script include("{$path}/register.inc.php"); include("{$path}/login.inc.php"); mysql_connect ("localhost","root",""); mysql_select_db ("coding"); //Scrint name is path from root directory. anything after .com of a site Explode function takes a character and it breaks up a string to decide where space is. - 4 means it takes off .php to give you init.inc for logging in $page_name = substr(end(explode("/", $_SERVER['SCRIPT_NAME'])), 0, -4); So when I run the above, on my page I get Strict Standards: Only variables should be passed by reference in C:\xampp\htdocs\coding\inc\init.inc.php on line 24 I am following this tutorialand it happens around 13:10 in the video. Really appreciate any help here as its driving me up the walls. Thanks in advance Edited February 18, 2013 by richanderson Quote Link to comment https://forums.phpfreaks.com/topic/274610-strict-standards/ Share on other sites More sharing options...
Jessica Posted February 18, 2013 Share Posted February 18, 2013 (edited) http://www.php.net/manual/en/function.end.php See how end expects a variable passed by reference? I personally haven't encountered this but I wonder if doing it this way will resolve the error: $arr = explode("/", $_SERVER['SCRIPT_NAME']); $page_name = substr(end($arr), 0, -4); Edit: Actually I'm 99% sure that would fix it. "The array. This array is passed by reference because it is modified by the function. This means you must pass it a real variable and not a function returning an array because only actual variables may be passed by reference." From the manual. Edited February 18, 2013 by Jessica Quote Link to comment https://forums.phpfreaks.com/topic/274610-strict-standards/#findComment-1413045 Share on other sites More sharing options...
richanderson Posted February 18, 2013 Author Share Posted February 18, 2013 Hi Jess, Thanks for that. Cleared up the issue I was having in a heartbeat. Saved this convo so I dont experience it in future. Cheers, Rich Quote Link to comment https://forums.phpfreaks.com/topic/274610-strict-standards/#findComment-1413046 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.