3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr=array("ip","icmp","ggp","tcp", "egp","pup","udp","hmp","xns-idp", "rdp","rvd" ); //Reads the names of protocols into an array.. for($i=0;$i<11;$i++) { $proname=$arr[$i]; echo $proname .":", getprotobyname ($proname)."<br />\n"; } $format = "%6s %s\n<br />"; for ($number = 0; $number < 255; $number++) { if (getprotobynumber ($number)) printf ($format, " $number-->", getprotobynumber ($number)); }
Output for 4.3.0 - 7.1.0
ip:<br /> icmp:1<br /> ggp:3<br /> tcp:6<br /> egp:8<br /> pup:12<br /> udp:17<br /> hmp:20<br /> xns-idp:22<br /> rdp:27<br /> rvd:66<br /> 0--> hopopt <br /> 1--> icmp <br /> 2--> igmp <br /> 3--> ggp <br /> 4--> ipv4 <br /> 5--> st <br /> 6--> tcp <br /> 7--> cbt <br /> 8--> egp <br /> 9--> igp <br /> 10--> bbn-rcc-mon <br /> 11--> nvp-ii <br /> 12--> pup <br /> 14--> emcon <br /> 15--> xnet <br /> 16--> chaos <br /> 17--> udp <br /> 18--> mux <br /> 19--> dcn-meas <br /> 20--> hmp <br /> 21--> prm <br /> 22--> xns-idp <br /> 23--> trunk-1 <br /> 24--> trunk-2 <br /> 25--> leaf-1 <br /> 26--> leaf-2 <br /> 27--> rdp <br /> 28--> irtp <br /> 29--> iso-tp4 <br /> 30--> netblt <br /> 31--> mfe-nsp <br /> 32--> merit-inp <br /> 33--> dccp <br /> 34--> 3pc <br /> 35--> idpr <br /> 36--> xtp <br /> 37--> ddp <br /> 38--> idpr-cmtp <br /> 39--> tp++ <br /> 40--> il <br /> 41--> ipv6 <br /> 42--> sdrp <br /> 43--> ipv6-route <br /> 44--> ipv6-frag <br /> 45--> idrp <br /> 46--> rsvp <br /> 47--> gre <br /> 48--> dsr <br /> 49--> bna <br /> 50--> esp <br /> 51--> ah <br /> 52--> i-nlsp <br /> 54--> narp <br /> 55--> mobile <br /> 56--> tlsp <br /> 57--> skip <br /> 58--> ipv6-icmp <br /> 59--> ipv6-nonxt <br /> 60--> ipv6-opts <br /> 62--> cftp <br /> 64--> sat-expak <br /> 65--> kryptolan <br /> 66--> rvd <br /> 67--> ippc <br /> 69--> sat-mon <br /> 70--> visa <br /> 71--> ipcv <br /> 72--> cpnx <br /> 73--> cphb <br /> 74--> wsn <br /> 75--> pvp <br /> 76--> br-sat-mon <br /> 77--> sun-nd <br /> 78--> wb-mon <br /> 79--> wb-expak <br /> 80--> iso-ip <br /> 81--> vmtp <br /> 82--> secure-vmtp <br /> 83--> vines <br /> 84--> ttp <br /> 85--> nsfnet-igp <br /> 86--> dgp <br /> 87--> tcf <br /> 88--> eigrp <br /> 89--> ospfigp <br /> 90--> sprite-rpc <br /> 91--> larp <br /> 92--> mtp <br /> 93--> ax.25 <br /> 94--> ipip <br /> 96--> scc-sp <br /> 97--> etherip <br /> 98--> encap <br /> 100--> gmtp <br /> 101--> ifmp <br /> 102--> pnni <br /> 103--> pim <br /> 104--> aris <br /> 105--> scps <br /> 106--> qnx <br /> 107--> a/n <br /> 108--> ipcomp <br /> 109--> snp <br /> 110--> compaq-peer <br /> 111--> ipx-in-ip <br /> 112--> vrrp <br /> 113--> pgm <br /> 115--> l2tp <br /> 116--> ddx <br /> 117--> iatp <br /> 118--> stp <br /> 119--> srp <br /> 120--> uti <br /> 121--> smp <br /> 123--> ptp <br /> 125--> fire <br /> 126--> crtp <br /> 127--> crudp <br /> 128--> sscopmce <br /> 129--> iplt <br /> 130--> sps <br /> 131--> pipe <br /> 132--> sctp <br /> 133--> fc <br /> 134--> rsvp-e2e-ignore <br /> 136--> udplite <br /> 137--> mpls-in-ip <br /> 138--> manet <br /> 139--> hip <br /> 140--> shim6 <br /> 141--> wesp <br /> 142--> rohc <br />