Jump to content

required thingy


Hoppus

Recommended Posts

ok well, i'm slowly trying to learn the concept of required. i get it. but i guess i'm using the code wrong.

 

what i understand it's supposed to do, is if a required errors, then nothing after that executes. correct me if that's wrong.

 

the code i'm using is.

 

require('lol.php'); echo $cfock; 


echo $b.$b.$a.$b . "bub";

 

and this is the output

 

Notice: Undefined variable: cfock in H:\Program Files\EasyPHP 2.0b1\www\index.php on line 7


lol
bub

 

yeah

there is no cfock, so it's supposed to error. but i thought it wasn't supposed to execute the echos if that errors? ;s

 

Link to comment
https://forums.phpfreaks.com/topic/124232-required-thingy/
Share on other sites

Not according to many articles I've read.. include should throw a notice, but require should cause an error...

 

http://discomoose.org/2006/04/28/the-difference-between-require-and-include/

 

Just an example from one of the top results off google...

 

Adam

Link to comment
https://forums.phpfreaks.com/topic/124232-required-thingy/#findComment-641528
Share on other sites

Everyone makes mistakes in their code. Some are more serious, some are less.

 

Some make script unable to run properly. Some will only increase the chances of something going wrong.

 

That's why there are different levels of error reporting.

Here are different types of errors explained: http://www.php.net/manual/en/errorfunc.constants.php

Link to comment
https://forums.phpfreaks.com/topic/124232-required-thingy/#findComment-641767
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.