PHP string quotemeta() function4 Sept 2024 | 2 min read The quotemeta() is an in-built function of PHP, which is used to add a backslash before some meta characters in the string. It returns the string by adding the backslash before every meta characters. It avoids SQL injections attacks of our database. The quotemeta() is a binary-safe function, means that type of function which can be executed on a binary file without modifying its content. The predefined meta character are:
Note: This function can be used to escape the character with special meaning.SyntaxThe syntax for the quotemeta() function is given below, which has only one string parameter: ParameterString (required) - This function has a single parameter, which is string. We provide string parameter in this function to quote backslash before every meta character which is listed above in the tutorial. Return ValuesThe quotemeta() function returns the string by adding the backslash (\) before every meta character which is listed above or return FALSE if the given string is empty. ExampleTo understand the practical implementation of the quotemeta() function, see the examples which are given below: Example 1 Output: Let's check the below output to see that backslash is added in front of every meta character. Hello user! Welcome to javaTpoint\. Would you like to learn PHP\? Example 2 Output: Let's check the below example that backslash (\) is added before every meta character. Dollar symbol \$ is used to declare variable in PHP\. Matrix is represented by square \[\ ] brackets\. Example 3 Output: equation1 =/(m - n/) /^o /* p Next TopicPHP String Functions |
PHP Function PHP function is used to convert string value of ASSCII characters to hexadecimal value. Syntax: string bin2hex ( string $str ) Parameter Description Required/Optional string The string to be converted Required Example 1 <?php $str ="Hello World!"; echo "Your ASCII character is: ".$str; echo "<br>"."By using '' Method your hexadecimal value is: ".bin2hex($str); ?> Output: Your ASCII...
1 min read
PHP String function The function is an in-built function of PHP. It is a case-sensitive function which finds the first occurrence of a string. The is mainly used to search the first occurrence of a string inside another string and displays some part of...
3 min read
PHP String function The is one of the most popular functions of PHP, which is widely used to convert the string into uppercase. It takes a string as a parameter and converts all lowercase English character of that string to uppercase. Other characters such as...
2 min read
PHP String Function The is a built-in function of PHP. It counts the number of times a substring occurs in the given string. The is a case-sensitive function, which means it treats uppercase and lowercase alphabets differently. For example - A substring "cha" is not...
3 min read
PHP Function The is predefine function of PHP. It is used to find the position of the first occurrence of a string inside another string. Note: This function is case-insensitive and binary safe. Syntax: stripos(string,find,start); Parameter Description Required/Optional string Specify the string to search. Required. find Specify he string to find. Required. start Specify where to begin the search. Optional. Example...
1 min read
PHP String function The is one of the most popular functions of PHP, which is widely used to convert the string into lowercase. It takes a string as a parameter and converts all uppercase English character of that string to lowercase. Other characters such as...
2 min read
PHP Function PHP function is used to return a quote string with slashes. It works with some characters: Single quote (') Double quote(") Blackslash(|) NUL (the NUL byte) Syntax: string addslashes ( string $str ); Parameter Description Required/Optional string String to be escaped Required Example 1 <?php $str = 'What does "WHO" mean?'; echo "Your string is :".$str; echo "<br>"."By using...
1 min read
PHP Function PHP function is used to splits a string into smaller parts or chunks. The function does not alter the original string. Syntax: chunk_split(string,length,end) Parameter Description Required/Optional string String to split Required Length Specify the length of the chunks. Default is 76 Optional end Specify what to place at the end each chunk. Optional Example 1 <?php $str = "Hello...
1 min read
PHP string Function The is in-built function of PHP. It is used to return information about words used in a string or counts the number of words in a string. Syntax: str_word_count(string,return,char) Parameter Description Required/Optional string Specify the string to check. Required. return Specify the return value of the function. Values: 0 : It is by default...
1 min read
PHP string Function PHP string function predefined functions. It is used to output a formatted string. We can pass the arg1, arg2, arg++ parameters at percent (%) signs in the main string. Syntax: printf(format,arg1,arg2,arg++); Parameter Description Required/Optional format Specify the string. Following are the possible format values: %% - Returns a percent sign %b...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India