Jaguar Posted June 11, 2007 Share Posted June 11, 2007 I noticed $_POST[name] and $_POST['name'] both work. However, I see most people write $_POST['name']. What is the reason for this? Link to comment https://forums.phpfreaks.com/topic/55116-solved-quotes-and-predfined-variables/ Share on other sites More sharing options...
akitchin Posted June 11, 2007 Share Posted June 11, 2007 if you specify $_POST[name], PHP thinks it's a constant index and will have to spend the time looking for the proper index. if you use single quotes to delimit the index, you tell PHP that it's a string index and PHP has an easier (and faster) time locating the array item you're referring to. it's just a matter of "correctness." Link to comment https://forums.phpfreaks.com/topic/55116-solved-quotes-and-predfined-variables/#findComment-272464 Share on other sites More sharing options...
smc Posted June 11, 2007 Share Posted June 11, 2007 And for us OCD people we must have our quotes Link to comment https://forums.phpfreaks.com/topic/55116-solved-quotes-and-predfined-variables/#findComment-272465 Share on other sites More sharing options...
akitchin Posted June 11, 2007 Share Posted June 11, 2007 And for us OCD people we must have our quotes yes. yes, we do. Link to comment https://forums.phpfreaks.com/topic/55116-solved-quotes-and-predfined-variables/#findComment-272466 Share on other sites More sharing options...
Jaguar Posted June 11, 2007 Author Share Posted June 11, 2007 So, it's faster with quotes. Thank you, that's exactly what I was looking for Link to comment https://forums.phpfreaks.com/topic/55116-solved-quotes-and-predfined-variables/#findComment-272467 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.