8

Please help, how can i find the constant like PHP_EOL for tabulation My code wrote file which has a lot of generated tabulations and new lines new lines wrote correctly, but i have a lot of "\t\t" see example:

common.app \t/loader \t/growl \t\t/error \t/form
Andrzej Moroz
  • 548
  • 1
  • 7
  • 19
  • There isn't a predefined tabulation constant; but you can always define your own if you feel that it is necessary – Mark Baker Sep 19 '16 at 10:14
  • I define it in the code in string type But it wrote incorrectly as in example – Andrzej Moroz Sep 19 '16 at 10:19
  • At first I failed to see how a bunch of `char(9)` calls were better than `\t` in your code, until I realized that it was the output file that contained the literal `\t`. So with that in mind there has to be something wrong with the code that generates this text, so please edit your answer and post the PHP code as well. – ChristianF Sep 19 '16 at 11:05

3 Answers3

12

Ok I found solution

chr(9) wrote tabulation to output file

Thanks!

Nicolas
  • 8,077
  • 4
  • 21
  • 51
Andrzej Moroz
  • 548
  • 1
  • 7
  • 19
5

PHP_EOL is a Constant from Core PHP. You could simply define your own Constants and use them. For example:

<?php

    defined("TAB1") or define("TAB1", "\t");
    defined("TAB2") or define("TAB2", "\t\t");
    defined("TAB3") or define("TAB3", "\t\t\t");
    defined("TAB4") or define("TAB4", "\t\t\t\t");
    defined("TAB5") or define("TAB5", "\t\t\t\t\t");


    $string = "common.app"     . TAB1 . "/loader" . TAB1 . "/growl" . 
               TAB2 . "/error" . TAB1 . "/form";
Poiz
  • 7,611
  • 2
  • 15
  • 17
-6

I solved using css

<style>
.MyCSS{
    border:1px solid #FFF; 
    width:10em; 
    float:left; 
    font-weight:bold;
    }
</style>
<?php 
// here the selection query
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { ?>
<div>
<div class="MyCSS">
<?php stripslashes($row['Country']);?>
</div>
<?php echo stripslashes($row['CountryDescription'])."<br>";?> 
</div>
<div style="clear:both;"></div>
<?php } ?>