[ create a new paste ] login | about

Link: http://codepad.org/Z7TWS4Lm    [ raw code | output | fork ]

PHP, pasted on Jul 16:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

  function str_hex_dump ($str) {
    for ($i = 0, $l = strlen($str); $i < $l; $i++) {
      echo str_pad(dechex(ord($str[$i])), 2, '0', STR_PAD_LEFT).($i + 1 < $l ? ' ' : '');
    }
  }

  $textFromHTML = '<b>Padding You were not able to complete this job. Please try again at a later date. Do not hit your back button. Padding</b>';
  $textToFind = 'You were not able to complete this job. Please try again at a later date. Do not hit your back button.';
  $shorterText = 'You were not able';

  $pos = strpos($textFromHTML, $shorterText);
  str_hex_dump(substr($textFromHTML, $pos, strlen($textToFind)));
  echo "\n";
  str_hex_dump($textToFind);


Output:
1
2
59 6f 75 20 77 65 72 65 20 6e 6f 74 20 61 62 6c 65 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 74 68 69 73 20 6a 6f 62 2e 20 50 6c 65 61 73 65 20 74 72 79 20 61 67 61 69 6e 20 61 74 20 61 20 6c 61 74 65 72 20 64 61 74 65 2e 20 44 6f 20 6e 6f 74 20 68 69 74 20 79 6f 75 72 20 62 61 63 6b 20 62 75 74 74 6f 6e 2e
59 6f 75 20 77 65 72 65 20 6e 6f 74 20 61 62 6c 65 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 74 68 69 73 20 6a 6f 62 2e 20 50 6c 65 61 73 65 20 74 72 79 20 61 67 61 69 6e 20 61 74 20 61 20 6c 61 74 65 72 20 64 61 74 65 2e 20 44 6f 20 6e 6f 74 20 68 69 74 20 79 6f 75 72 20 62 61 63 6b 20 62 75 74 74 6f 6e 2e


Create a new paste based on this one


Comments: