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

  • SEARCH
  • Home
  • 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 8884517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:04:44+00:00 2026-06-14T21:04:44+00:00

this is a PHP Question i have a function function myfn () { where

  • 0

this is a PHP Question

i have a function

function myfn () {

where i get some data here and add result to an array

$matches = array();

preg_match_all('????????????', $searched, $matches);

print_r($matches[1]);

}

i need to halt or exit this function if the array contain no elements and send an email to xyz@mail.com

Appreciate your help

Thanks

  • 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-06-14T21:04:46+00:00Added an answer on June 14, 2026 at 9:04 pm

    if you want to exit function just do return;. But I’d just add some conditional blocks backed with if(). And to check if $matches array is empty do count(). So it could all look like this:

    function myfn () {
    
       // where i get some data here and add result to an array
       $matches = array();
       preg_match_all('????????????', $searched, $matches);
    
       if( count($matches) > 0 ) {
         // there's something
    
         print_r($matches[1]);
    
       } else {
    
         // empty
         // send an email to xyz@mail.com
    
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a quick question about this PHP function here. What is the am
Not really a question but kind of a challenge.. I have this PHP function
I have a question about PHP's fopen() function (using php://output). Server A uses this
I have this php function inside a class the returns json data function getPhotoDetails(
I am a PHP developer and I wouldn't have posted this question here if
Possible Duplicate: Check if a variable is empty Simple PHP question: I have this
i have this PHP code, and a DataBase with Question, answer1, answer2, Question_id well,
I have just a question... I'm seeing this coding style in various php scripts
This question is regarding getopt function in php. I need to pass two parameter
This question has two parts: #1 I have a functions.php that is filled with

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.