[ create a new paste ] login | about

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

PHP, pasted on Mar 19:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
$s = <<<END
{"created_at":"Mon, 19 Mar 2012 01:34:41 +0000","entities":{"hashtags":[{"text":"stanford","indices":[23,32]}],"urls":[{"url":"http:\/\/t.co\/Of4z6jKG","expanded_url":"http:\/\/360.io\/5sZc2T","display_url":"360.io\/5sZc2T","indices":[33,53]}],"user_mentions":[]},"from_user":"rayfk","from_user_id":335143881,"from_user_id_str":"335143881","from_user_name":"Raymond Kennedy","geo":{"coordinates":[37.4227,-122.1753],"type":"Point"},"id":181554251733020673,"id_str":"181554251733020673","iso_language_code":"en","metadata":{"result_type":"recent"},"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1468102095\/image_normal.jpg","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1468102095\/image_normal.jpg","source":"&lt;a href=&quot;http:\/\/www.occipital.com\/360\/app&quot; rel=&quot;nofollow&quot;&gt;360 Panorama&lt;\/a&gt;","text":"View from mid lake log #stanford http:\/\/t.co\/Of4z6jKG","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null}
END;
$s = trim( $s );
$a = json_decode( $s );
$s2 = json_encode( $a );
var_dump( $s == $s2, strlen($s), strlen( $s2) );
echo $s."\n";
echo $s2."\n";
$dif = 999999;
for($i=0;$i<strlen($s);$i++){
  if( $s[$i]!==$s2[$i] ){ $dif = $i; break; }
}

echo $dif."\n";
echo substr($s ,$dif-20,60)."\n";
echo substr($s2,$dif-20,60)."\n";
echo phpversion()."\n";


Output:
1
2
3
4
5
6
7
8
9
bool(false)
int(999)
int(999)
{"created_at":"Mon, 19 Mar 2012 01:34:41 +0000","entities":{"hashtags":[{"text":"stanford","indices":[23,32]}],"urls":[{"url":"http:\/\/t.co\/Of4z6jKG","expanded_url":"http:\/\/360.io\/5sZc2T","display_url":"360.io\/5sZc2T","indices":[33,53]}],"user_mentions":[]},"from_user":"rayfk","from_user_id":335143881,"from_user_id_str":"335143881","from_user_name":"Raymond Kennedy","geo":{"coordinates":[37.4227,-122.1753],"type":"Point"},"id":181554251733020673,"id_str":"181554251733020673","iso_language_code":"en","metadata":{"result_type":"recent"},"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1468102095\/image_normal.jpg","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1468102095\/image_normal.jpg","source":"&lt;a href=&quot;http:\/\/www.occipital.com\/360\/app&quot; rel=&quot;nofollow&quot;&gt;360 Panorama&lt;\/a&gt;","text":"View from mid lake log #stanford http:\/\/t.co\/Of4z6jKG","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null}
{"created_at":"Mon, 19 Mar 2012 01:34:41 +0000","entities":{"hashtags":[{"text":"stanford","indices":[23,32]}],"urls":[{"url":"http:\/\/t.co\/Of4z6jKG","expanded_url":"http:\/\/360.io\/5sZc2T","display_url":"360.io\/5sZc2T","indices":[33,53]}],"user_mentions":[]},"from_user":"rayfk","from_user_id":335143881,"from_user_id_str":"335143881","from_user_name":"Raymond Kennedy","geo":{"coordinates":[37.4227,-122.1753],"type":"Point"},"id":181554251733020000,"id_str":"181554251733020673","iso_language_code":"en","metadata":{"result_type":"recent"},"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1468102095\/image_normal.jpg","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1468102095\/image_normal.jpg","source":"&lt;a href=&quot;http:\/\/www.occipital.com\/360\/app&quot; rel=&quot;nofollow&quot;&gt;360 Panorama&lt;\/a&gt;","text":"View from mid lake log #stanford http:\/\/t.co\/Of4z6jKG","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null}
452
"id":181554251733020673,"id_str":"181554251733020673","iso_l
"id":181554251733020000,"id_str":"181554251733020673","iso_l
5.2.5


Create a new paste based on this one


Comments: