title: How to use explode and get first element in one line in PHP?
body: <pre><code>$beforeDot = explode(".", $string)[0];
  </code></pre>
  
  <p>This is what I'm attempting to do, except that it returns syntax error. If there is a workaround for a one liner, please let me know. If this is not possible, please explain.</p>