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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:15:55+00:00 2026-06-09T21:15:55+00:00

I have a string that is formatted like this: function1!!param1||ignore!!param2&&function2!!param1||ignore!!param2||ignore!!param3 The number of functions

  • 0

I have a string that is formatted like this:

function1!!param1||ignore!!param2&&function2!!param1||ignore!!param2||ignore!!param3

The number of functions it has is unlimited (they are split with &&)

a basic function call that would be generated from the string above is:

function1($param1,$param2);

and the second one:

function2($param1,$param2,$param3);

the number of params is unlimited. (they aren’t called function and param that is only an example)

Happy to answer any questions!! I already tried exploding by && and then !! but I can’t quite figure out how to call a dynamic function with dynamic params.

Solution for 5.2:

function function1( $a1, $a2 ) {
    echo $a1 . $a2;
}

function function2( $a1, $a2, $a3 ) {
    echo " ".$a1 . $a2 . $a3;
}
function explodemap($val) {
        $explode = explode( "!!", $val );
        return $explode[1];
}
$functions = explode( "&&", 'function1!!param1||ignore!!param2&&function2!!param1||ignore!!param2||ignore!!param3' );

foreach( $functions as $function ) {
    $split = explode( "||", $function );
    $weird_excalmation_split = explode("!!", $split[0] );
    $params = array_slice( $split, 1 );

    $params = array_map( "explodemap", $params );

    $fn_name = $weird_excalmation_split[0];
    array_unshift( $params, $weird_excalmation_split[1]  );

    call_user_func_array( $fn_name, $params );
}
  • 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-09T21:15:57+00:00Added an answer on June 9, 2026 at 9:15 pm

    Use call_user_func_array:

    function function1( $a1, $a2 ) {
        echo $a1 . $a2;
    }
    
    function function2( $a1, $a2, $a3 ) {
        echo $a1 . $a2 . $a3;
    }
    
    $functions = explode( "&&", 'function1!!param1||ignore!!param2&&function2!!param1||ignore!!param2||ignore!!param3' );
    
    foreach( $functions as $function ) {
        $split = explode( "||", $function );
        $weird_excalmation_split = explode("!!", $split[0] );
        $params = array_slice( $split, 1 );
    
        $params = array_map( function($val) {
            return explode( "!!", $val )[1];
        }, $params );
    
        $fn_name = $weird_excalmation_split[0];
        array_unshift( $params, $weird_excalmation_split[1]  );
    
        call_user_func_array( $fn_name, $params );
    }
    
    //echoes param1param2param1param2param3
    

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

Sidebar

Related Questions

I have a string that is formatted like the following: ... {{word1}} {{word2}} ....
I have string that look like Array that fetched from other webservice like this
I have a String that looks like this String = Förpackning Flaska (375 ml)
I have a string that looks like this: <name>-<gender>-<age>.jpg I want to be very
I have a function that reads a formatted file. It looks like this: 1;Name_of_the_author;The
I have a bignum formatted like a string like this: 123456789123456789123456789 and I need
I have a problem that output string must be utf8-formatted, I am writing currently
I need to redirect a single Wordpress URL that is formatted like this: www.bluewidgets.com/?p=123
I have a string that represents a non indented XML that I would like
I have a table which is full of arbitrarily formatted phone numbers, like this

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.