title: Do I have to rollBack() before exit()?
body: <p>I have code like this</p>
  
  <pre><code>try {
    $pdo-&gt;beginTransaction();
    $stmt = $pdo-&gt;prepare($query1);
    $stmt-&gt;execute($x);
  } catch (Exception $e) {
    $pdo-&gt;rollBack();
    throw-&gt;$e;
  }
  
  if (condition) {
    exit();
  }
  
  $x['column1'] = 'string1';
  $x['column2'] = 'string2';
  $x['column3'] = 'string3';
  
  try {
    $stmt = $pdo-&gt;prepare($query2);
    $stmt-&gt;execute($x);
    $pdo-&gt;commit();
  } catch (Exception $e) {
    $pdo-&gt;rollBack();
    throw-&gt;$e;
  }
  </code></pre>
  
  <p>If the <code>if condition</code> succeeded and the code did <code>exit()</code></p>
  
  <p>Is everything related to the <code>$pdo</code> is safe too or do I add before <code>exit()</code> a <code>$pdo-&gt;rollBack();</code>?</p>