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 135277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:45:52+00:00 2026-05-11T06:45:52+00:00

Could some one explain this to me i am not familiar with preg_match_all filters,

  • 0

Could some one explain this to me i am not familiar with preg_match_all filters, this code works fine except it does not return a negative value if one of the latitudes and longitudes is negative.

if ( preg_match_all( '#<td>\s+-?(\d+\.\d+)\s+</td>#', $output, $coords ) ) {     list( $lat, $long ) = $coords[1];     echo 'Latitude: $lat\nLongitude: $long\n'; } 

output: Latitude: 30.6963 Longitude: 71.6207 (longitude is missing a ‘-‘)

  • 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. 2026-05-11T06:45:52+00:00Added an answer on May 11, 2026 at 6:45 am

    The value of the coords variable depends on what is matched by the code inside the parentheses. Moving the optional minus sign (-?) inside the parentheses should do the trick:

    if ( preg_match_all( '#<td>\s+(-?\d+\.\d+)\s+</td>#', $output, $coords ) ) { 

    See the official documentation for details about preg in php and php.net/preg_match_all for the details of preg_match_all.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You can apply a dataformatstring in the gridview column to… May 11, 2026 at 11:31 am
  • added an answer Could you set an exclusion on the source folder under… May 11, 2026 at 11:31 am
  • added an answer I have had success with the following: [XmlArray('HasTypeSpecialisations')] [XmlArrayItem('TypeObject', typeof(TypeObject),… May 11, 2026 at 11:31 am

Related Questions

Could someone explain why this works in C#.NET 2.0: Nullable<DateTime> foo; if (true) foo
I was kind of shocked by this. Could someone explain why this works? A
I ran across this and was wondering if someone could explain why this works
I saw this tip in another question and was wondering if someone could explain
Could someone explain to me in simple terms the easiest way to change the
Could someone explain? I understand the basic concepts behind them but I often see
Could someone explain why both tests using the latest versions of Moq and Rhino.Mocks
I understand the differences between optimistic and pessimistic locking. Now, could someone explain to
Could someone please explain the best way to connect to an Interbase 7.1 database
Could someone simply explain the 3 phases in the Flash Event framework, please? By

Trending Tags

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

Top Members

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.