<?php $str = 'filesystem-2.4.0-1 comps-extras-11.1-1.1 gnome-mime-data-2.4.2-3.1 glibc-2.5-12 atk-1.12.2-1.fc6 libICE-1.0.1-2.1 db4-4.3.29-9.fc6 elfutils-libelf-0.125-3.el5 ncurses-5.5-24.20060715 libsepol-1.15.2-1.el5 libcap-1.10-26 sqlite-3.3.6-2 pcre-6.6-1.1 gdbm-1.8.0-26.2.1 libsepol-1.15.2-1.el5 libXdmcp-1.0.1-2.1 db4-4.3.29-9.fc6 iptables-1.3.5-1.2.1 libXrender-0.9.1-3.1 libXi-1.0.1-3.1 xorg-x11-font-utils-7.1-2 slang-2.0.6-4.el'; $array = explode(PHP_EOL, $str); $rpmlink = 'http://www.rpm-find.net/linux/rpm2html/search.php?query='; array_walk($array, function(&$value, $key) use ($rpmlink) { $value = sprintf('<a href="%s%s">%s</a>', $rpmlink, $value, $value); }); print_r($array);
You have javascript disabled. You will not be able to edit any code.