Function __global->similar_text

Definitions

sources_custom/phpstub.php

  • Calculate the similarity between two strings.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$first string No No required parameter N/A N/A First string
$second string No No required parameter N/A N/A Second string
&$percent ?float Yes No Null N/A N/A Returns the percentage of similarity (null: do not get)

Returns

  • The number of matching characters
  • Type: integer
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Calculate the similarity between two strings.
 *
 * @param  string $first First string
 * @param  string $second Second string
 * @param  ?float $percent Returns the percentage of similarity (null: do not get)
 * @return integer The number of matching characters
 */

function similar_text(string $first, string $second, ?float &$percent = null) : int