html - PhP pulling string from line and separating by ":" -
i trying pull string .txt file using php, have done using code:
$f_contents = file("accounts/00183.txt"); $line = $f_contents[array_rand($f_contents)]; $data = $line;
after random string pulled separated.
e.g strings in .txt in format "user:pass".
im trying make "$first" = content before ":" e.g "user". , "$last" = content after ":" e.g "pass".
i'v looked around on google 2 hours , found nothing works. hope can help!
use list
& explode
-
$str = "user:pass"; list($first, $last) = explode(':', $str);
Comments
Post a Comment