Toolbox::strlen PHP Méthode

strlen() static public méthode

strlen function for utf8 string
static public strlen ( $str ) : length
$str string
Résultat length of the string
    static function strlen($str)
    {
        return mb_strlen($str, "UTF-8");
    }

Usage Example

Exemple #1
2
 /**
  * Generate the Vcard for the current Contact
  *
  *@return Nothing (display)
  **/
 function generateVcard()
 {
     if (!$this->can($this->fields['id'], READ)) {
         return false;
     }
     // build the Vcard
     $vcard = new VObject\Component\VCard(['N' => [$this->fields["name"], $this->fields["firstname"]], 'EMAIL' => $this->fields["email"], 'NOTE' => $this->fields["comment"]]);
     $vcard->add('TEL', $this->fields["phone"], ['type' => 'PREF;WORK;VOICE']);
     $vcard->add('TEL', $this->fields["phone2"], ['type' => 'HOME;VOICE']);
     $vcard->add('TEL', $this->fields["mobile"], ['type' => 'WORK;CELL']);
     $vcard->add('URL', $this->GetWebsite(), ['type' => 'WORK']);
     $addr = $this->GetAddress();
     if (is_array($addr)) {
         $addr_string = implode(";", array_filter($addr));
         $vcard->add('ADR', $addr_string, ['type' => 'WORK;POSTAL']);
     }
     // send the  VCard
     $output = $vcard->serialize();
     $filename = $this->fields["name"] . "_" . $this->fields["firstname"] . ".vcf";
     @Header("Content-Disposition: attachment; filename=\"{$filename}\"");
     @Header("Content-Length: " . Toolbox::strlen($output));
     @Header("Connection: close");
     @Header("content-type: text/x-vcard; charset=UTF-8");
     echo $output;
 }
All Usage Examples Of Toolbox::strlen