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

  • Home
  • SEARCH
  • 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 8307765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:36:19+00:00 2026-06-08T18:36:19+00:00

I am trying to create an own code to allow a client to post

  • 0

I am trying to create an own code to allow a client to post something on a pixel matrix.

Here an example of a code:
15e3n:3;geo(386299n283752w):4;delta(16e3n:5;line(20e0n;20e10n;0e10n;color:d);19w55n;rectangle(50w50n;height:100;width:50));88e2n:randomColor()

I want to interpret this using functions like in this case geo, delta, line, rectangle, geo, randomColor. The things that are written between (and )are the parameters, separated by a ;. (15e3n is in this case a position “15 east, 3 north”)

Example:
function(param1:value1;param2:value2;value3;value4);function2(param1:value1)

The functions should be executed and should replace the function with the result like here:

The text 16e13n:3;line(17e13n;19e13n;color:4);15e13n:3 should result in 16e13n:3;17e13n:4;18e13n:4;19e13n:4;15e13n:3. Because the function line with params 17e13n;19e13n;color:4 have the result 17e13n:4;18e13n:4;19e13n:4;that replaced the function in the input.

How can I achieve this? What is the best way? Regex?
Are there existing examples about how to do this?

Now, this looks a bit complicated 🙂

I thank you in advance for getting help on 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-08T18:36:20+00:00Added an answer on June 8, 2026 at 6:36 pm

    Note: content are not necessary valid PHP script

    My suggestion will be:

    5e3n:3;geo(386299n283752w):4;delta(16e3n:5;line(20e0n;20e10n;0e10n;color:d);19w55n;rectangle(50w50n;height:100;width:50));88e2n:randomColor()
    

    First implement a parser to separate statements into an array. You can loop every character, hold a counter of brackets and split by ; that is outside brackets, resulting into this array:

    array(
        0 => object(prefix => "5e3n", suffix => "3"),
        1 => object(prefix => "geo(386299n283752w)", suffix => "4"),
        2 => object(prefix => "delta(16e3n:5;line(20e0n;20e10n;0e10n;color:d);19w55n;rectangle(50w50n;height:100;width:50))", suffix => ""),
        3 => object(prefix => "88e2n", suffix => "randomColor()")
    )
    

    Then extract the function parameters, you may want to use objects…

    array(
        0 => object(prefix => "5e3n", suffix => "3"),
        1 => object(
            prefix => (object)func(
                name => "geo",
                params => array(
                    0 => "386299n283752w"
                )
            ),
            suffix => "4"),
        ),
        2 => object(
            prefix => (object)func(
                name => "delta",
                params => array(
                    0 => "16e3n:5",
                    1 => "line(20e0n;20e10n;0e10n;color:d)",
                    2 => "19w55n",
                    3 => "rectangle(50w50n;height:100;width:50)"
                )
            ),
            suffix => ""
        ),
        3 => object(
            prefix => "88e2n",
            suffix => (object)func(
                name => "randomColor",
                params => array()
            )
        )
    )
    

    Do this recursively until all functions deep inside are extracted.

    Then from the depth, process the functions by replacing a (object)func block into the resulting string, by a switch block that do appropriate action according to the name, for example:

    function processFunc($func){
        switch($func->name){
            case "randomColor":
                return selectRandomColor();
            /* ... */
        }
    }
    

    will process this:

    (object)func(
        name => "randomColor",
        params => array()
    )
    

    into this:

    "blueColor"
    

    Then at the end you will end up a single array which the contents, for example (not directly matching above):

    array(
        0 => object(prefix => "5e3n", suffix => "3"),
        1 => object(prefix => "6e2n", suffix => "4"),
        2 => object(prefix => "88e2n", suffix => "")
    )
    

    Then re-combine them into a resulting string.

    I am not going to write a full script for you, but here’s an idea of how to deal with it. This may not be complete though, but by thinking a bit you should be able to complete it.

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

Sidebar

Related Questions

I'm trying to create a web application that will allow a user to post
I am trying to create my own Native win32 C++ Checkbox that can have
I am trying to create my own lightbox for images on my website. Yes,
I'm trying to create my own Magento shipping module in Magento 1.6. Since I
I am trying to create my own torrent tracker but dont know how to
I'm trying to create my own plugin. But I'm having trouble getting things right.
I'm trying to create my own templated List class as a practice excercise. I
I'm trying to create my own template for a List class as a learning
I am trying to create my own next and previous arrows in a fancybox
I am trying to create my own plist file to be used in my

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.