title: PHP Leftmost digit
body: <p>let's say I have a variable containing an integer or a float (since integers might overflow into a float in PHP).</p>
  
  <p>I want to run some operation to get the leftmost digit and the rest of the remaining digits.</p>
  
  <p>To explain better:</p>
  
  <pre><code>&lt;?php
  
  $x   = NULL;  //this will hold first digit
  $num = 12345; //int
  
  /// run operation
  
  
  //outputs
  //$x   = 1;
  //$num = 2345;
  var_dump($x, $num);
  
  ?&gt;
  </code></pre>
  
  <p>Now, I know there's multitudes of ways to do this if you represent the number as a string, but I'm trying to avoid type casting it into a string.</p>
  
  <p>I'm probably looking for a solution which includes bitwise operations, but I'm pretty weak in that topic so I'm hoping someone who usually works low-level might be able to answer this!</p>
  
  <p>Thanks a bunch.</p>