PHP/Network/getprotobyname
Using getprotobyname()
<?php
$proto = "smp";
$proto_num = getprotobyname($proto);
if($proto_num == -1) {
die("Could not find protocol "$proto"\n");
} else {
echo "The "$proto" protocol has an ID of $proto_num\n";
}
?>