Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // $columns is built-in. It's an associative array. We're getting the value of the "name" column.
- $full_name = $columns['name']['value'];
- // Let's break it apart so we can separate the first and last name
- $full_name = explode(' ', $full_name);
- // This logic can be improved. Right now, it simply assumes that the last name is the last element in the $full_name array
- // E.g. $full_name = array('Billy', 'Bob', 'Thornton');
- // $first_name is $full_name[2], aka "Thornton".
- $first_name = $full_name[count($full_name) - 2];
- // Pass that back into the $columns array for the "first_name" column
- $columns['first_name']['value'] = $first_name;
Advertisement
Add Comment
Please, Sign In to add comment