Check if a string exists javascript
<script type=”text/javascript”>
if(window.location.href.indexOf(“https:”) > -1) {
alert(“its a secure URL”);
}
</script>
<script type=”text/javascript”>
if(window.location.href.indexOf(“https:”) > -1) {
alert(“its a secure URL”);
}
</script>
<script type=”text/javascript”>
var string=”PHPCode”;
string=string.replace(“Code”,”Codez”);
alert(string);
</script>
We can find out the position using the function strpos() that will return the position of a character
Example
<?php
$string=”phpcodez.com”;
echo strpos($string,”.”) // 8
?>
<?php
$testArray = array("value1", "value2", "value3", "value4");
$testRand = array_rand($testArray, 2);
echo $testArray[$testRand[0]];
?>
<?php
$testArray = array("p", "c", "z", "a");
rsort($testArray);
print_r($testArray);
//Array ( [0] => z [1] => p [2] => c [3] => a )
?>
<?php
$testArray = array("p", "c", "z", "a");
sort($testArray);
print_r($testArray);
//Array ( [0] => a [1] => c [2] => p [3] => z )
?>