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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:30:47+00:00 2026-05-23T02:30:47+00:00

$str = Test Artist Test – Test Title Test; $trackinfo = preg_split(‘/-/’, $str); exec(‘metamp3

  • 0
$str = "Test Artist Test - Test Title Test";  
$trackinfo = preg_split('/-/', $str);

exec('metamp3 --title '.$trackinfo[1].' --artist '.$trackinfo[0].' track.mp3');

This is a cut of the code I am using, basically I’m obviously doing something wrong (I’m quite new to PHP and don’t really understand some of the conventions used. When I run this line, from what I can see it would only put Test and Test for the title and artist (like it is only taking the first word from the string) but if I was to do something like

print_r $trackinfo;
print $trackinfo[1];
print $trackinfo[0];

I can clearly see that the split string is formatted correctly, I was wondering if someone could explain what exactly is going on here and how I would go about fixing it?

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-05-23T02:30:48+00:00Added an answer on May 23, 2026 at 2:30 am

    That’s not a PHP problem. You’re passing following string to exec:

    metamp3 --title Test Title Test --artist Test Artist Test track.mp3
    

    But metamp3 program will take only first word for each parameter. The command should look like metamp3 --title "Test Title Test" ... (parameter value in quotes).

    There is function in PHP to solve this problem: escapeshellarg. Here is how your code can look like:

    exec(
        'metamp3 --title '.escapeshellarg($trackinfo[1]).
        ' --artist '.escapeshellarg($trackinfo[0]).' track.mp3'
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

E,g class Test { public: void setVal(const std::string& str) { this.isVal = str; //This
function test() { this.str = hello; this.sayHello = function() { document.write(this.str); } this.init =
I'm trying this str = bla; /([^A-z]|[^0-9])/.test(str.charAt(0)); but it gives me true no matter
I have an xml file that contains its element like <ab:test>Str</ab:test> When I am
When compiling this: char *str = [[NSString stringWithFormat:@%i days and %i hours, days, hours]
Given: <script type=text/javascript> $(document).ready(function () { var str = 'Test'; //alert(str.toUpperCase()); $('#stringFinder').keyup(function (e) {
var str = 'test TEST'; How to get str = ' <span class=red>test</span> <span
var str = test's t\r and t\n; str = str.replace(/'/g, \'); str = str.replace(/\r/g,
If I have the following string: var str = Test.aspx?ID=11&clicked=false+5+3; str = str.replace(????????, 'true');
Suppose I create an instance of this Test class, which starts a new Thread

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.