M
M
Max Ba2017-04-06 13:55:11
PHP
Max Ba, 2017-04-06 13:55:11

How to make a key for a TIN?

Guys, what type of field to use to store the TIN, given that the length is 10 or 12. There may be a leading zero. Did char(12). But isn't varchar better?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
doublench21, 2018-03-15
@1Frosty

<?php
$re = '/<p class="number">(.+)<\/p>/';
$str = '<div class="winning_numbers cleared">
  <ul>
              <li class="girl1 number4  ">
        <p class="number">4</p>
      </li>
          <li class="girl2 number7  ">
        <p class="number">7</p>
      </li>
          <li class="girl3 number5  ">
        <p class="number">5</p>
      </li>
          <li class="girl4 number8  ">
        <p class="number">8</p>
      </li>
          <li class="girl5 number26  ">
        <p class="number">26</p>
      </li>
              <li class="girl6 number3">
        <div class="hider">
          <p class="number">3</p>
        </div>
      </li>
          </ul>
</div>';

preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);

// Print the entire match result
var_dump($matches);

A
Andreo, 2018-03-15
@chupacabramiamor

$mcount = preg_match_all('~\<p class=\"number\"\>([0-9]+)\<\/p~is', $str, $matches);
if (count($mcount) > 0)) {
  print_r($matches[1]);
}

Z
Zlatoslav Desyatnikov, 2017-04-06
@phpcoder81

From the documentation:
> Values ​​of the CHAR type are padded on the right with spaces to the specified length during storage.
That is, you will create problems for yourself with the processing of the TIN in the future.
So, it's better to do VARCHAR(12) and everything will be ok.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question