php generates column numbers in excel

WBOY
Release: 2016-07-25 08:55:22
Original
1697 people have browsed it
  1. /**

  2. * Use php code to generate serial numbers in excel or csv files
  3. */
  4. public function loop(){
  5. $loop = 0;
  6. $charnum = 65;

  7. for(; $loop < 150; $loop++){

  8. $quotient = intval($loop / 26);
  9. $remainder = $loop % 26;

  10. $f = $quotient>0? chr($charnum+$quotient-1) : '';

  11. $s = $remainder>=0? chr($charnum+$remainder) : '';
  12. echo $loop .' | '. $quotient .' | '. $remainder .' | '. $f . $s ."
    ";
  13. } // bbs.it-home.org
  14. }

复制代码


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!