Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
<?php $DB['male'] = file('names_male.txt'); $DB['female'] = file('names_female.txt'); $DB['all'] = array_merge($DB['male'], $DB['female']); $gender = $_GET['gender']; if (empty($gender)) { $MorF = array('male', 'female'); $gender = $MorF[rand(0, 1)]; } $name = $DB[$gender][array_rand($DB[$gender])]; $rawPatronymic = $DB['male'][array_rand($DB['male'])]; $rawSurname = $DB['all'][array_rand($DB['all'])]; $q = urlencode("$rawPatronymic $rawSurname"); $pipe = unserialize(file_get_contents("http://pipes.yahoo.com/pipes/pipe.run?_id=dIZjkOl53hGbTES_U5Wufg&_render=php&gender=$gender&q=$q")); if ($pipe['count'] == '1') { $patronymic = $pipe['value']['items'][0]['patronymic']; $surname = $pipe['value']['items'][0]['surname']; $result = "$surname $name $patronymic"; } else $result = 'error'; echo $result;
This paste will be private.
From the Design Piracy series on my blog: