How to check whether the two strings' contents are the same? [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
For example str1 = "hello world",str2 = "hello wordl",they have the same length,but are not same

You can use levenshtein.
If (levenshtein($str1,$str2)===0){ // identical}

Yes It is possible. you can use strcmp for string comparison.

Related

Match string format with regex [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I know there are tons of questions about regex string format, but I am very new to this and I haven't been able to do it myself. How can I use regex to match a string with the following format?
xx_x_a.zip
where x is a number and a is a letter. Example:
33_2_f.zip
It must not match:
33_2_f_abc.zip
The format must always be like 2digits+_+1digit+_+1letter+.zip
Simplest way:
/^[0-9]{2}_[0-9]_[a-z]\.zip$/

How to remove double quotes from json {"x":"y"} to {x:y} in php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How to remove double quotes from json {"x":"y"} to {x:y} in PHP
If you just need to remove " from a string you can use the str_replace method.
$new_str = str_replace("\"", "", json);
I hope I was helpful.

To write a Query to sort in Uppercase in php my admin. [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
How to execute a query to convert a column in UPPERCASE in php myadmin?
use
mysql Upper() function
For reference: http://www.w3resource.com/mysql/string-functions/mysql-upper-function.php

In PHP If XML Element Contains Certain Text [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
In PHP is it possible to search an XML document for certain text in an element? I've looked but I can't find something that satisfies my needs.
Sure you can do that using strpos function
http://php.net/manual/en/function.strpos.php
if(strpos($xml_str, "string_to_search_for")){
echo "Found";
}

How to trim last 10 letters from each string element stored in an array in php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Please any one help me. As I am a noobe in PHP coding. Is there any built in function to trim letters in PHP??
Lookup substr()
http://us2.php.net/substr
Should do the trick
$var = 'teststring1234567890';
substr($var, 0, -10);
returns 'teststring'

Categories