Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


php strings within strings

Posted on 2011-10-07
Medium Priority
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
  • 2
  • 2
LVL 15

Expert Comment

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

Author Comment

ID: 36930091
Sorry... I have found a solution...
LVL 15

Expert Comment

ID: 36930098
good to hear tht
LVL 111

Accepted Solution

Ray Paseur earned 2000 total points
ID: 36930912
$title_element = "hello";
$date_element = "1st October";

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

Author Closing Comment

ID: 36939360
This is what I had done! cheers ray

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

564 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