• 3

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

exit(); die(); return false; [duplicate]

die() and exit() are precisely identical; they halt the entire PHP program and return to the OS. They're two different names for the same function.

return, on the other hand, ends a function call and returns to the caller. At the end of a program, return sets the status value that is returned to the OS; the program is going to exit no matter what.

  • 37
Reply Report
    • Not correct. die() is same as exit() but not vice versa. You can pass a param for exit(): either exit(status code number) or exit(string status), which is passed out from PHP to OS or whatever.
    • Just "syntactic sugar". Perl has die(), and many other languages have exit(), so by having both, PHP tries to make it easier to transition between languages, I suppose.
    • @Brogrammer not quite. Not a significant reason at least. It can be some compatibility issue, a legacy issue, etc. Whatever reason it can be - it doesn't matter anyway.

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions