Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. # Call PHP Function dynamically (usable for some TYPO3 Extbase projects)
  2.  
  3. # old and eval way
  4. public function anything($record, $field) {
  5.     // call e.g. $record->getTitle();
  6.     eval('$arr[] = $record->get' . ucfirst($field) . '();');
  7. }
  8.  
  9. # nice way with PHP5
  10. public function anything($record, $field) {
  11.     // call e.g. $record->getTitle();
  12.     $arr[] = $record->{'get' . ucfirst($field)}();
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement