• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

PHP

PHP Function strncasecmp() – Binary safe case-insensitive string comparison of the first n characters

by admin

The strncasecmp() function is used to compare a case-sensitive string of the first ‘n’ character. This function was introduced in PHP4. The comparison is case-insensitive—that is, “Alphabet” and “alphabet” are considered equal. This function is a case-insensitive version of strcmp(). If either string is shorter than length characters, the length of that string determines how […]

Filed Under: PHP

PHP function strlen() – Get string length

by admin

The strlen() function is used to return the length of a specific string. This function was introduced in PHP3. The strlen() function takes just one parameter (the string) and returns the number of characters in it. Syntax: strlen(string $string): int Behind the scenes, strlen() actually counts the number of bytes in your string, as opposed […]

Filed Under: PHP

PHP function stripslashes() – Un-quotes a quoted string

by admin

The stripslashes() function is used to unquote a string that is quoted by using the addslashes() function. This function was introduced in PHP3. The stripslashes() function is the opposite of addslashes(): it removes one set of \-escapes from a string. Syntax: stripslashes(string $string): string To remove backslashes and convert C-style escape sequences to their literal […]

Filed Under: PHP

PHP function stripcslashes() – Un-quote string quoted with addcslashes()

by admin

stripcslashes() converts C-style escape sequences (\, \a, \b, \f, \n, \r, \t, \v, and \x hh hex and \ ooo octal character escape sequences) to their literal equivalents. Additionally, it strips the backslash from escape sequences that it doesn’t recognize. You can specify ranges of characters by separating them by two periods; for example, to […]

Filed Under: PHP

PHP function strcmp() – Binary safe string comparison

by admin

The strcmp() function is used to compare two case-sensitive strings. This function was introduced in PHP3. The function basically compares two strings; returns a number less than 0 if one is less than two, 0 if the two strings are equal, and a number greater than 0 if one is greater than two. The comparison […]

Filed Under: PHP

PHP Function strchr() – Alias of strstr()

by admin

The strchr() function is used to find the first appearance of a string inside another string. It is the pseudonym of the strstr() function. This function was introduced in PHP3. Syntax: strchr(string $haystack, string $needle, bool $before_needle = false): string|false For instance: $record = “Fred,Flintstone,35,Wilma”; $rest = strchr($record, “,”); // $rest is “,Flintstone,35,Wilma” The variations […]

Filed Under: PHP

PHP function strcasecmp() – Binary safe case-insensitive string comparison

by admin

The strcasecmp() function is used to compare two case-sensitive strings. This is a case-insensitive version of the strcmp(). This function was introduced in PHP3. The function returns a number less than 0 if one is less than two, 0 if the two strings are equal, and a number greater than 0 if one is greater […]

Filed Under: PHP

PHP Function str_word_count() – Return information about words used in a string

by admin

The str_word_count() function is used to count the number of words in a string. This function was introduced in PHP4. The value of format dictates the returned value: value returned value 0 (default) The number of words found in string 1 An array of all words found in string 2 An associative array, with keys […]

Filed Under: PHP

PHP Function str_split() – Convert a string to an array

by admin

The str_split() function is used to split a string into an array. This function was introduced in PHP5. The function splits the string into an array of characters, each containing length characters; if the length is not specified, it defaults to 1. Syntax: str_split(string $string, int $length = 1): array Parameters Parameter Description string The […]

Filed Under: PHP

PHP function str_replace() – Replace all occurrences of the search string with the replacement string

by admin

The str_replace() function is used to replace some case-sensitive characters in a string. This function was introduced in PHP3. The str_replace() function replaces parts of a string with new parts you specify and takes a minimum of three parameters: what to look for, what to replace it with, and the string to work with. If […]

Filed Under: PHP

Next Page »

Primary Sidebar

Recent Posts

  • ncat Command Examples in Linux
  • ncat: command not found
  • nautilus Command Examples in Linux
  • namei: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright