title: jquery or php or something else. Show full phone number only when user clicks on link
body: <p>Have php <code>$phone_number=1234567;</code></p>
  
  <p>On page load like </p>
  
  <pre><code>&lt;span id="span_phone_number"&gt;
  &lt;?php echo htmlspecialchars( substr_replace( $phone_number, "...", -3 ), ENT_QUOTES, "UTF-8");?&gt;
  &lt;/span&gt;
  &lt;span id="show_phone_number"&gt;Show&lt;/span&gt;
  </code></pre>
  
  <p>First idea to use jquery</p>
  
  <pre><code>$(document).on('click', '#show_phone_number', function(){
  $("#span_phone_number").html( '&lt;?php echo htmlspecialchars( $phone_number, ENT_QUOTES, "UTF-8"); ?&gt;' );
  });
  </code></pre>
  
  <p>But i can see full phone number in View source.</p>
  
  <p><code>$phone_number</code> i get from mysql.</p>
  
  <p>Next idea is with <code>$.post</code> send <code>id</code> to external <code>php</code> file, in that file connect to mysql and get full phone number. But it is waste of resources.</p>
  
  <p>Is it possible in less resource consuming way at page load hide full phone number in view source and show full phone number only on click?</p>
  
  <p>Next idea:</p>
  
  <ol>
  <li>Create some number (?random)</li>
  <li>To ajax send the created number and phone number without 3 last digits</li>
  <li>In external php based on created number and part of phone number create correct phone number
  But how? What would be idea how to get 3 necessary digits based on some random number?</li>
  </ol>
  
  <p>Or may be exists something simpler?</p>
  
  <p>May aim is to prevent parse phone numbers by bots from html source.</p>
  
  <p>Found this <a href="http://forums.phpfreaks.com/topic/85597-converting-a-number-to-another-number-encrypt-decrypt/?p=436824" rel="nofollow">http://forums.phpfreaks.com/topic/85597-converting-a-number-to-another-number-encrypt-decrypt/?p=436824</a></p>
  
  <pre><code>$original = 123;
  $secure = rand(100,999).base64_encode($original);
  $unsecure = substr($secure,3);
  $unsecure = base64_decode($unsecure);
  echo $unsecure; // will display 123
  </code></pre>
  
  <p>Seems it works. But at the moment do not understand how and why it works...</p>