473,325 Members | 2,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

How to format this? Comma and periods stuff

matheussousuke
249 100+
How do I format this?

I know that
Expand|Select|Wrap|Line Numbers
  1.     $from = "From: $a2[0] <$a2[1]>";
is wrong, so should it be:
Expand|Select|Wrap|Line Numbers
  1. $from = "From: '$a2['0']'.'<$a2['1']>.'";
???
Dec 9 '11 #1
4 1695
johny10151981
1,059 1GB
read how to concatenate string and variable.
Dec 10 '11 #2
omerbutt
638 512MB
hi
try this
Expand|Select|Wrap|Line Numbers
  1. $from = "From: ".$a2[0]." <".$a2[1].">";
regards,
Omer Aslam
Dec 10 '11 #3
Dormilich
8,658 Expert Mod 8TB
I don't see what's wrong with the first example. the second ain't wrong from PHP's syntax point-of-view, but certainly invalid when it comes to mail addresses.

though you might use a printf function (better readable, IMO):
Expand|Select|Wrap|Line Numbers
  1. // if $a contains only those 2 values
  2. $from = vsprintf('From: %s <%s>', $a);
  3.  
  4. // otherwise
  5. $from = sprintf('From: %s <%s>', $a[0], $a[1]);
Dec 15 '11 #4
matheussousuke
249 100+
lol, the first one wasn't wrong, but I was worried cause it was too old. thx
Dec 15 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Chris | last post by:
Hi, When I use msgbox(Now().ToShortDateString) I get 4/21/2005. How can I convert that to 042105. Thanks
8
by: Joseph | last post by:
I have a textBox that people writes stories in it. They can use for format. I have Aspell installed on the server, so people can make correction to their text. Sometimes, they forget to add a...
0
by: Shapper | last post by:
Hello, I have an ASP.Net Repeater where I display a date from a date field: <%# DataBinder.Eval(Container.DataItem, "pubDate", "{0:f}") %> When the dataset is created from a database the date...
2
by: laredotornado | last post by:
Hi, I am grabbing prices from a database. Sometimes the price is NULL and sometimes there's a floating point value. Using PHP 4, when I print the price to my CSV file, I want the price,...
3
by: starman7 | last post by:
I'm attempting a query that gathers product data for a particular product id. One of the items is designer(s) which can be more than one. The product table has comma separated id's of the...
1
by: Iver.Leung | last post by:
I am reading the source code of tfn2k, in function "tfntransmit" within file "tribe.c", there is a defination saying that: int tot_len = sizeof (struct ip), ssock; and ssock becomes a struct ip....
4
by: saintor1 | last post by:
Access 97 - I want the date format YYYY-M M-DD to show everywhere. My problem is that I deal with French and English versions. And don't want to play with Windows Regional Settings. In the...
2
by: Ron | last post by:
so if my textbox is named textbox1 and my listbox is named ltsdisplay, for the button that would make this all happen I would just need to: ...
11
by: =?Utf-8?B?QXNhZg==?= | last post by:
Hello, I have two Table Adapters that I am storing in a Cache using .NET 2.0 Web Service and the Database is SQL Server on Windows 2003 IIS6. Each of the two table adapters has its own...
2
by: necron99 | last post by:
import RuntimeEnvironment as renv import os, sys import win32com.client import getpass OMI = win32com.client.Dispatch("MOVEitAPI.clientObj") OMI.Host = system
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.