How to Recognize Dot Characters in PHP

The PHP "strrpos" function lets you determine if the period character is located in a string. You use the strrpos function to identify if a properly formatted domain name or email address was entered into your Web form after the user clicks the submit button. The strrpos function returns the numerical location of the dot character in the string. If the dot is not found, the function returns "false."

Instructions

    • 1

      Right-click the PHP file you want to edit. Click "Open With." In the pop-up window, click your PHP editor program.

    • 2

      Locate the string you want to analyze in the PHP code. If you do not already have a string defined, the following code creates a string with a dot character:

      $email = "myemail@domain.com";

    • 3

      Identify the location of the dot character. The following code returns the location of the dot in the string defined in Step 2:

      $loc = strrpos($email, '.');

Related Searches:

References

Comments

Related Ads

Featured