title: PHP - exit or return which is better?
body: <p>I would like to know in the following case which is a better option:</p>
  
  <p>In the PHP script, if the <code>$fileSize</code> variable is larger than 100, I stop the script;</p>
  
  <p>Case I:</p>
  
  <pre><code>&lt;?php
  if ( $fileSize &gt; 100 )
  {
     $results['msg'] = 'fileSize is too big!';
     echo json_encode( $results );
     exit();
  }
  </code></pre>
  
  <p>Case II:</p>
  
  <pre><code>&lt;?php
  if ( $fileSize &gt; 100 )
  {
     $results['msg'] = 'fileSize is too big!';
     exit( json_encode( $results ) );
  }
  </code></pre>
  
  <p>Case III:</p>
  
  <pre><code>&lt;?php
  if ( $fileSize &gt; 100 )
  {
     $results['msg'] = 'fileSize is too big!';
     return( json_encode( $results ) );
  }
  </code></pre>
  
  <p>Which of the three (3) options above is the best?</p>