Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $mystring = "/var/www/html";
- $test = preg_match("/^/[.]/", $mystring);
- if ($test == 1)
- {
- echo "ret = 1";
- }
- else
- {
- echo "ret = 0";
- }
- <?php
- $mystring = "/var/www/html";
- $test = preg_match("/^//", $mystring);
- if ($test == 1)
- {
- echo "ret = 1";
- }
- else
- {
- echo "ret = 0";
- }
- <?php
- $mystring = "/var/www/html";
- if(strpos($mystring,"/") === 0){
- echo "ret = 1";
- }else{
- echo "ret = 0";
- }
- ?>
- if (substr($mystring, 0, 1) == "/") {
- echo "ret= 1";
- }
- echo $mystring[0] == "/" ? "ret 1" : "ret 0";
- $mystring = "/var/www/html";
- $test = preg_match("/^//", $mystring);
- if ($test == 1)
- {
- echo "ret = 1";
- }
- else
- {
- echo "ret = 0";
- }
Add Comment
Please, Sign In to add comment