kwestalot

Untitled

Jul 15th, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2. // $columns is built-in. It's an associative array. We're getting the value of the "name" column.
  3. $full_name = $columns['name']['value'];
  4.  
  5. // Let's break it apart so we can separate the first and last name
  6. $full_name = explode(' ', $full_name);
  7.  
  8. // This logic can be improved. Right now, it simply assumes that the last name is the last element in the $full_name array
  9. // E.g. $full_name = array('Billy', 'Bob', 'Thornton');
  10. // $first_name is $full_name[2], aka "Thornton".
  11. $first_name = $full_name[count($full_name) - 2];
  12.  
  13. // Pass that back into the $columns array for the "first_name" column
  14. $columns['first_name']['value'] = $first_name;
Advertisement
Add Comment
Please, Sign In to add comment