Skip to main content
Removed "s" and added some instructions
Source Link

PHP, 89 8686 85 bytes

<?=($a=$argv[1])==859?_:@json_decode(file("https"http://xkcd.com/$a/info.0.json")[0])->alt;

Returns null for 404 and 859

Save as xkcd.php and run with the comic number...

$ php xkcd.php 386

PHP, 89 86 bytes

<?=($a=$argv[1])==859?_:@json_decode(file("https://xkcd.com/$a/info.0.json")[0])->alt;

Returns null for 404 and 859

PHP, 89 86 85 bytes

<?=($a=$argv[1])==859?_:@json_decode(file("http://xkcd.com/$a/info.0.json")[0])->alt;

Returns null for 404 and 859

Save as xkcd.php and run with the comic number...

$ php xkcd.php 386
added 7 characters in body
Source Link

PHP, 8989 86 bytes

<?=($a=$argv[1])==859?null_:@json_decode(file("https://xkcd.com/$a/info.0.json")[0])->alt;

Returns null for 404 and 859

PHP, 89 bytes

<?=($a=$argv[1])==859?null:@json_decode(file("https://xkcd.com/$a/info.0.json")[0])->alt;

Returns null for 404 and 859

PHP, 89 86 bytes

<?=($a=$argv[1])==859?_:@json_decode(file("https://xkcd.com/$a/info.0.json")[0])->alt;

Returns null for 404 and 859

Source Link

PHP, 89 bytes

<?=($a=$argv[1])==859?null:@json_decode(file("https://xkcd.com/$a/info.0.json")[0])->alt;

Returns null for 404 and 859