original_string: private function asVcard($name)
      {
          $name = preg_replace('/\s\s+/i', '', $name); //remove extra white spaces
          $name = preg_replace('/[^A-Za-z0-9\x{002D}\x{002E}\x{00C0}-\x{00FF} -]/', '', $name); //remove special chars
          $name = trim($name); // trim
          $nm_expl = explode(' ', $name);
          $head = '';
          if (in_array($nm_expl[0], array('Prof.', 'Professor', 'Dr.', 'Doutor' ))) {
              $head = array_shift($nm_expl);
          }
          $lastnm = array_pop($nm_expl);
          $n = $lastnm.';'.implode(' ', $nm_expl).';'.$head.';';
          return "BEGIN:VCARD\nVERSION:4.0\nN:$n\nFN:$name\nEND:VCARD";
      }
code: private function asVcard($name)
      {
          $name = preg_replace('/\s\s+/i', '', $name); //remove extra white spaces
          $name = preg_replace('/[^A-Za-z0-9\x{002D}\x{002E}\x{00C0}-\x{00FF} -]/', '', $name); //remove special chars
          $name = trim($name); // trim
          $nm_expl = explode(' ', $name);
          $head = '';
          if (in_array($nm_expl[0], array('Prof.', 'Professor', 'Dr.', 'Doutor' ))) {
              $head = array_shift($nm_expl);
          }
          $lastnm = array_pop($nm_expl);
          $n = $lastnm.';'.implode(' ', $nm_expl).';'.$head.';';
          return "BEGIN:VCARD\nVERSION:4.0\nN:$n\nFN:$name\nEND:VCARD";
      }
code_tokens: private function asVcard ( $ name ) { $ name = preg_replace ( '/\s\s+/i' , '' , $ name ) ; //remove extra white spaces $ name = preg_replace ( '/[^A-Za-z0-9\x{002D}\x{002E}\x{00C0}-\x{00FF} -]/' , '' , $ name ) ; //remove special chars $ name = trim ( $ name ) ; // trim $ nm_expl = explode ( ' ' , $ name ) ; $ head = '' ; if ( in_array ( $ nm_expl [ 0 ] , array ( 'Prof.' , 'Professor' , 'Dr.' , 'Doutor' ) ) ) { $ head = array_shift ( $ nm_expl ) ; } $ lastnm = array_pop ( $ nm_expl ) ; $ n = $ lastnm . ';' . implode ( ' ' , $ nm_expl ) . ';' . $ head . ';' ; return "BEGIN:VCARD\nVERSION:4.0\nN:$n\nFN:$name\nEND:VCARD" ; }
docstring: turns the elements into a string formatted for VCard
docstring_tokens: turns the elements into a string formatted for VCard