Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Php excel from Z to AA


I was looking for a simple method to construct excel like column identifiers e.g: A B .... AA AB AC etc, using chr() and modulo, but there is magic...
https://www.php.net/manual/en/language.operators.increment.php

So, this also works
<?php
$p = chr(65);      // or simply $p = 'A';
for ($i = 1; $i < 53; $i++){
    echo $p++ . " - ";
    if ($i % 10 == 0) echo '</br>';
}
?>

Gives
A - B - C - D - E - F - G - H - I - J -
K - L - M - N - O - P - Q - R - S - T -
U - V - W - X - Y - Z - AA - AB - AC - AD -
AE - AF - AG - AH - AI - AJ - AK - AL - AM - AN -
AO - AP - AQ - AR - AS - AT - AU - AV - AW - AX -
AY - AZ -
Comment

PREVIOUS NEXT
Code Example
Php :: [name] 
Php :: To show inline category 
Php :: mysqli_fetch_all() expects parameter 1 to be mysqli_result, boolean given in C:xampphtdocscomplete-blog-phpadminincludespost_functions.php on line 31 
Php :: cors laravel 
Php :: send parameter to function in php can null 
Php :: laravel gigapay get single employee 
Php :: flask like framework for php 
Php :: Yii2 Dynamic Relational Query 
Php :: show number 1 as 00001 laravel 
Php :: remove public from laravel 
Php :: how to add posts to php 
Php :: phpmailer valid cert 
Php :: testimonial custom post type and uses shortcode 
Php :: get data in two columns in div in loop php 
Php :: php pasar array por post 
Php :: laravel get user aget from request 
Php :: bootstrap autocomplete example ajax php mysql 
Php :: add header image to woocomerce shop page 
Php :: Convert backslash characters PHP 
Php :: vagrant no pg_hba.conf entry for host 
Php :: laravel many to many relationship with pivot table 
Php :: wordpresss loop through object 
Php :: apache/2.4.53 (win64) openssl/1.1.1n php/8.1.5 server at localhost port 80 
Php :: laravel post index method 
Php :: php if condition 
Php :: laravel collection median 
Php :: codeigniter query Profiling 
Php :: Laravel-permission update name 
Php :: Call to a member function delete() on null laravel 8 
Php :: carbon parse 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =