fork download
  1. <?php
  2.  
  3. $conta = "ABCDEFGHIJKLM";
  4.  
  5. echo strlen($conta) > 4 ? substr($conta, -1) : $conta, PHP_EOL;
  6.  
  7. echo strlen($conta) > 4 ? substr($conta, 0, 4) : $conta, PHP_EOL;
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
M
ABCD