php strings within strings

Posted on 2011-10-07
Last Modified: 2012-05-12
Hi Experts,

I have this script for example...

$type = "blog";
$blog_form = "title,date";
$title_element = "hello";
$date_element = "1st October";

$form = explode(",", $I NEED TYPE IN HERE_form);
for($i = 0; $i < count($form); $i++){
      echo $$form[$i]_element;


Output being:

Hello 1st October

Any ideas would be swell!!

Question by:maccaj51
    LVL 15

    Expert Comment

    what is $I NEED TYPE IN HERE_form just confused please elaborate little more

    Author Comment

    Sorry... I have found a solution...
    LVL 15

    Expert Comment

    good to hear tht
    LVL 107

    Accepted Solution

    $title_element = "hello";
    $date_element = "1st October";

    $answer = ucfirst($title_element) . ' ' . $date_element;

    Author Closing Comment

    This is what I had done! cheers ray

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now