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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:09:17+00:00 2026-06-10T04:09:17+00:00

Well I was just wondering how can I put this semicolon separated string into

  • 0

Well I was just wondering how can I put this semicolon separated string into an array

one,two,three; four,five,six; if( i < x { "seven,eight"; } if( x < i ) { nine; }

The result I need would be

[0] => one,two,three
[1] => four,five,six
[2] => if( i < x { "seven,eight"; } if( x < i ) { nine; }

I know how to explode those separated values but I’m stuck in this

if( i < x { "seven,eight"; } if( x < i ) { nine; }

The original data is this

bonus2 bAddRace,RC_DemiHuman,80; bonus2 bIgnoreDefRate,RC_DemiHuman,30; if(getrefine()>=6) { bonus2 bAddRace,RC_DemiHuman,40; } if(getrefine()>=9) {  autobonus2 "{ bonus bShortWeaponDamageReturn,20; bonus bMagicDamageReturn,20; }",200,1000,BF_WEAPON,"{ specialeffect2 EF_REFLECTSHIELD; }"; }

The code I’ve tried so far is this

function build_item_script_options( $data = array() )
{
    $html = "";
    $bonus_txt = "";
    $bonus_opts = "";
    $bonus_opts_array = array();

    $script = explode( ";", $data['script'] );
    for( $i = 0; $i <= count( $script ) - 1; $i++ )
    {
        if( strtolower( substr( $script[$i], 0, 5 ) ) == 'bonus' )
        {
            $bonus = explode( ',', $script[$i] );
            for( $k = 1; $k <= $bonus[$i] - 1; $k++ )
            {
                array_push( $bonus_opts_array, $bonus[$i][$k] );
            }
            $bonus_txt = $bonus[0];
            $bonus_opts = implode( ',', $bonus_opts_array );
        }
        else
        {
            $bonus_txt = $script[$i];
        }

        $html .= "<option opts=\"" . $bonus_opts . "\" value=\"" . $bonus_txt . "\" selected=selected>" . $bonus_txt . "</option>";
    }

    return $html;
}
  • 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-10T04:09:18+00:00Added an answer on June 10, 2026 at 4:09 am

    Is this what you need?

    $str = 'one,two,three; four,five,six; if( i < x { "seven,eight"; } if( x < i ) { nine; }';
    $str = explode("; ", $str, 3);
    print_r($str);
    

    Example:

    http://codepad.org/fqKMTUcp

    ** EDIT **

    You could also try this:

    $open_brackets = '0';
    $string = '';
    $str = 'one,two,three; four,five,six; if( i < x { "seven,eight"; } if( x < i ) { nine; }';
    $split = str_split($str);
    foreach($split as $bracket){
    $string .= $bracket;
    if($open_brackets == '0' && $bracket == ';'){
    $string = substr_replace($string, "*", -1);
    }
    if($bracket == '{'){
    $open_brackets++;
    }
    if($bracket == '}'){
    $open_brackets--;
    }
    }
    $string = explode('* ', $string);
    print_r($string);
    

    Example:

    http://codepad.org/uO9sGnDz

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

Sidebar

Related Questions

just wondering where to put this macro. It's supposed to cause correctly labelled excel
well I'm just wondering how I can get an mp3 download to start instantly,
I'm looking into Windows Azure now and wondering if one can implement a TCP/IP
I just finished this script it works well, but I am struggling to pass
I just realized that this piece of code works well in Firefox but not
I just started diving into the world of Rails by reading the well known
Well just getting into the flow of thing with Python. Reading a few books,
I am just wondering if there is a possibility that my program can add/remove
I'm sure i can figure something out using replace , etc, but just wondering
Just wondering if anyone can recommend a .NET library that converts audio formats to

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.