1--TEST-- 2Test function getservbyname() 3--CREDITS-- 4Italian PHP TestFest 2009 Cesena 19-20-21 june 5Fabio Fabbrucci (fabbrucci@grupporetina.com) 6Michele Orselli (mo@ideato.it) 7Simone Gentili (sensorario@gmail.com) 8--SKIPIF-- 9<?php 10 if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){ 11 if (!file_exists("/etc/services")) die("skip reason: missing /etc/services"); 12 } 13?> 14--FILE-- 15<?php 16 17 $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', 'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www'); 18 19 foreach ($services as $service) { 20 $port = getservbyname($service, 'tcp'); 21 var_dump($port); 22 } 23 24 25?> 26--EXPECTF-- 27int(%d) 28int(%d) 29int(%d) 30int(%d) 31int(%d) 32int(%d) 33int(%d) 34int(%d) 35int(%d) 36int(%d) 37int(%d) 38