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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:29:01+00:00 2026-06-03T14:29:01+00:00

My code: $string=655:47 Text: 0 n\some more text here\t\2\r\3\tl\0\f0\\f1\\f2\\a0\0\a1\0\a2\255; $a=explode(\\,$string); var_dump($a); While the output

  • 0

My code:

$string="655:47 Text: 0 n\some more text here\t\2\r\3\tl\0\f0\\f1\\f2\\a0\0\a1\0\a2\255";
$a=explode("\\",$string);
var_dump($a);

While the output i get is:

array(7) {
  [0]=>
  string(33) "655:47 Text: 0 n"
  [1]=>
  stringl20) "some more text
0"
  [2]=>
  string(2) "f1"
  [3]=>
  string(2) "f2"
  [4]=>
  string(3) "a0"
  [5]=>
  string(3) "a1"
  [6]=>
  string(3) "a2­"
}

I want to split the string on every ‘\’ chat found ( and yet retain all the values)
While I would like to have the function explode and to work correctly.
How can I solve this ?

  • 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-03T14:29:03+00:00Added an answer on June 3, 2026 at 2:29 pm

    Use single-quotes instead of double quotes,

    $string='655:47 Text: 0 n\some more text here\t\2\r\3\tl\0\f0\\f1\\f2\\a0\0\a1\0\a2\255';
    $a=explode('\',$string);
    var_dump($a);
    

    In php, if you use single quotes then special characters like ‘/t’ etc loose their meanings and behave as plain strings.

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

Sidebar

Related Questions

here is my code: string line; ifstream toOpen; toOpen.open(allfiles.txt, ios::in); int fileCounter=0; if(toOpen.is_open()){ while(!toOpen.eof()){
Here's some c# code string webPageStr = @<html><body><div id=content>good content</div><div id=badcontent>bad content</div></body></html>; XmlDocument webPage
Here's the code: string name = myName; int id = (int)_myDB.ThingTable.Where(thing => thing.ThingName ==
Here is the code: string str; cin>>str; cout<<first input:<<str<<endl; getline(cin, str); cout<<line input:<<str<<endl; The
Suppose I have this code: String encoding = UTF-16; String text = [Hello StackOverflow];
my code: String [] temp; temp = {one,two,three}; I get this error: Illegal start
I am trying following code String s1 = ß.cfg; System.out.println (s.toUpperCase()); output I am
here is code String[] month=new String[12]{January,February,March,April,May,June,July,August,September,Octomber,November,December}; int day = DateTime.Now.Day; int mon= DateTime.Now.Month; mon
Code: String dir = //Path to the directory File saveDir = new File(dir); //Here
Here is my code: string[] inputs = new[] {1:2,5:90,7:12,1:70,29:60}; //Declare Dictionary var results =

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.