fork(1) download
  1. <?php
  2.  
  3. function convData($i){
  4. $i = str_replace('/','-',$i);
  5. return str_replace('-','/',strlen(end(explode('-',$i))) == 4 ?
  6. date("Y-m-d", strtotime($i)) : date("d-m-Y", strtotime($i)));
  7. }
  8.  
  9.  
  10. echo convData('21/04/2017');
  11. echo '-----';
  12. echo convData('2017/04/21');
Success #stdin #stdout #stderr 0.01s 83904KB
stdin
Standard input is empty
stdout
2017/04/21-----21/04/2017
stderr
PHP Notice:  Only variables should be passed by reference in /home/VTibjw/prog.php on line 5
PHP Notice:  Only variables should be passed by reference in /home/VTibjw/prog.php on line 5