Copied!

Various useful functions for manipulating text

CloneableInstantiable
Methods
public static arrayToJS(array $array, string $stringQuote = '', string $newLine = '') : string
 

Converts a PHP array to a JavaScript array that can be used directly as JavaScript (not JSON)

  • param array<string,mixed> $array of php values
    • PHP scalars (except strings) will be converted to the corresponding JavaScript type
    • strings must contain quoted strings to be represented as a string in JavaScript
    • Unquoted strings will resolve to raw JavaScript
  • param string $stringQuote optional quotes to use for string. Include actual quotes in your string if you need specify different quotes in different places.
  • param string $newLine Pass \n if you want human readable output, appends to , in output
public static capitalSplit(string $key) : string
 

Split a string into words based on capital letters. Successive capital letters are considered an abbreviation and grouped together.

public static htmlentities(?string $string) : string
 

Shorthand to encode a string in UTF-8

  • param ?string $string to encode
public static replace_unicode_escape_sequence(array $match) : string
 
  • param string[] $match
public static unhtmlentities(?string $string) : string
 

Decode hmtl entities

  • param ?string $string to decode
public static unicode_decode(string $str) : string
Methods
public static arrayToJS(array $array, string $stringQuote = '', string $newLine = '') : string
 

Converts a PHP array to a JavaScript array that can be used directly as JavaScript (not JSON)

  • param array<string,mixed> $array of php values
    • PHP scalars (except strings) will be converted to the corresponding JavaScript type
    • strings must contain quoted strings to be represented as a string in JavaScript
    • Unquoted strings will resolve to raw JavaScript
  • param string $stringQuote optional quotes to use for string. Include actual quotes in your string if you need specify different quotes in different places.
  • param string $newLine Pass \n if you want human readable output, appends to , in output
public static capitalSplit(string $key) : string
 

Split a string into words based on capital letters. Successive capital letters are considered an abbreviation and grouped together.

public static htmlentities(?string $string) : string
 

Shorthand to encode a string in UTF-8

  • param ?string $string to encode
public static replace_unicode_escape_sequence(array $match) : string
 
  • param string[] $match
public static unhtmlentities(?string $string) : string
 

Decode hmtl entities

  • param ?string $string to decode
public static unicode_decode(string $str) : string
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration