Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 761491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:50:39+00:00 2026-05-14T15:50:39+00:00

I got a question when I was doing some Array in PHP. I don’t

  • 0

I got a question when I was doing some Array in PHP.
I don’t know how to write the code for the following case:

$arrs = array("a@c", "cr", "exd", "hello", "gg%j", "hwa", "@", "8");

foreach ($arrs as $arr){
// if $arr does not belong to any characters from a to z, 
// then there must be some special character in it.
// Say for example, "a@c" will still be regarded as fine string, 
// since it contains normal characters a and c.
// another example, "gg%j" will also be fine, since it contains g and j.
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:50:40+00:00Added an answer on May 14, 2026 at 3:50 pm

    You could use a regex, and the [preg_match][1] function :

    $arrs = array("abc", "cr", "exd", "hello", "gj", "hwa", "@", "8");
    foreach ($arrs as $arr){
        // if $arr does not belong to any characters from a to z, 
        // then there must be some special character in it.
        if (!preg_match('/^[a-z]*$/', $arr)) {
            var_dump($arr);
        }
    }
    

    Which would get you the following output :

    string '@' (length=1)
    string '8' (length=1)
    

    Here, the regex is matching :

    • beginning of string : ^
    • any number of characters between a and z : [a-z]*
    • end of string : $

    So, if the string contains anything that’s not between a and z, it will not match ; and var_dump the string.
    [1]: https://www.php.net/preg_match

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 513k
  • Answers 513k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You're misunderstanding the Multiline option: Use multiline mode, where ^… May 16, 2026 at 5:55 pm
  • Editorial Team
    Editorial Team added an answer I've done this sort of thing with PowerShell. It is… May 16, 2026 at 5:55 pm
  • Editorial Team
    Editorial Team added an answer This may or may not be the answer, but if… May 16, 2026 at 5:54 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I got a contact form, I need to filter some words. I'm doing it
I've got a file, on which I'm doing some Regex. The file uses ASCII
I've got some threads doing heavy work while my main thread handles the UI
I've got a little problem overriding the Magento core class: Core/Rule/Model/Rule.php. I think I'm
I am have some problem in updating my qotwVote1a table's Vote1a field through PHP.
Just getting into PHP web development. I've got an HTML form where a user
I got a question regarding C++ Object & Javascript Object life cycle mis-synchronization and
I've got a site that requires manual creation of the database tables on install.
I use a encoded string as a key in array, and also uses the
I'm trying to set some conditional statements for nested embedRelation() instances, and can't find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.