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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:09:39+00:00 2026-06-11T19:09:39+00:00

I need to use a function in PHP that detect a delimiter of a

  • 0

I need to use a function in PHP that detect a delimiter of a file using 2 parameters:

the file handle and an array of the expected header values.

Can someone please help me in writing the function or using a similar existing function that use the header of the file and match it with the expected header values to detect the file delimiter without using an array of potential delimiters.

Thank you

  • 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-11T19:09:40+00:00Added an answer on June 11, 2026 at 7:09 pm
    <?php
    
        $col1 = 'name';
        $enc = '"';
        $line = '"name";"company";"email"';
    
        $delimiter = substr($line, (substr($line, 0, 1) == $enc ? (strlen($col1)+2) : strlen($col1)), 1);
        echo $delimiter;
    
    ?>
    

    Output

    ;
    

    This first checks if the 1st character in $line is ". If there is no ", it substrings 1 character with a starting position of the length of $col1. If there are ", it substrings 1 character with a starting position of the length of $col1 +2 (for each of the ")

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

Sidebar

Related Questions

when you need to use a function you include a header file but wheres
I need to use fwrite function in php for storing a file at a
i'm a beginner to php. i need to use php function which process some
I want to use the function gmp_random() by GNU MP in PHP. I need
I need to use a function on a vector that does not take a
For personal use I am currently writing a recursive PHP function that should process
I am using a PHP function that will return 2 arrays. Below is my
I have a PHP function that I use regularly for working with images (resizing,
The Notes section in the function documentation of ignore_user_abort() suggest that PHP cannot detect
I am creating a PHP function that will take some values, one of which

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.