Let's say I have the following function:
public function normalize($string) { $substrings = explode(",", $string); return implode(",", $substrings); }
Will it ($string == normalize($string))always be true? Is there any special case that I should consider?
($string == normalize($string))
If $ string is a string, yes.
Otherwise, a type conversion may occur:
implode(",", explode(",", 0))
This will result in "0" in this way $string !== normalize($string), but $string == normalize($string)is still persistent.
$string !== normalize($string)
$string == normalize($string)
Source: https://habr.com/ru/post/1692062/More articles:Python Replace integer values in Dataframe strings and not substrings - pythonSeparating Webpack code for asynchronously loading reaction components in a library - reactjsПочему последний блок * иногда * не выполняется в ThreadAbortException, если он содержит ожидание? - c#Why is the empty matrix 208 bytes? - rVectorized two-dimensional moving window in numpy including edges - pythonRead X lines at a time from a text file using Java streams? - javaAngular 5 FormGroup reset does not execute reset validators - angularChanging the elements of an array C - cNode.JS + socket.io + IIS = ECONNRESET - node.jsReturns false if any of the values on the map is an empty string or just spaces in java8 - javaAll Articles