Re: Re: scanf function

By Crys, 6 Years ago (2012-11-22 02:32:23), written in PHP, viewed 461 times. This paste is a reply to Re: scanf function by xxxy
URL https://paste.godclan.hu/view/RQJHfxYu Embed
Download Paste or View RawExpand paste to full width of browser
  1. <?php
  2. function scanf($format) {
  3.     $trace = debug_backtrace();
  4.     $args = $trace[0]['args'];
  5.     $argc = func_num_args();
  6.     $inputs = fscanf(STDIN, $format);
  7.     $n = count($inputs);
  8.     if($argc <= $n)
  9.         $n = $argc - 1;
  10.     for($i=0;$i<$n;$i++)
  11.         $args[$i+1] = $inputs[$i];
  12.     return $n;
  13. }
  14.  
  15. scanf("%d", &$number);
  16.  
  17. echo $number;
  18. ?>

Reply to "Re: Re: scanf function"

Here you can reply to the paste above