to get rid of potential double spaces after the explode, you could do:
foreach ($words as $word) {
if (!empty($word)) {
$first = $word;
break;
}
}
echo $first;
This will always return the first word.
Jordan
On Sep 20, 2005, at 7:24 AM, Jochem Maas wrote:
how much eas
- Original Message -
From: "Jochem Maas" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General"
Sent: Tuesday, September 20, 2005 2:24 PM
Subject: Re: [PHP] Easy question - delete strings from the beginning of
space...
Gustav Wiberg wrote:
Hi there!
I guess this is an easy question. I have string...
"Hello you"
and I want to get the "Hello" part.
How do I do that? (I can of course search for first occurence of space
and then use substr, but I guess there is an easier solution?
how much easier do you want
On Tue, 2004-08-03 at 23:25, Robert Frame wrote:
> I am sure this is an obvious answer, but dang if I could find it.
>
> How do you chop off a decimal value in PHP? I know I can do it using a
> combination of modulus, subtraction and division, but isn't there a function
> that does this? I think
Are you looking for the round function?
$number = "4.3392";
$number = round($number);
-
Thank you,
Richard Bewley
[EMAIL PROTECTED]
Equinox Systems and Development
Website: http://www.eq-dev.com/
Also, please look at our webhost
> Sent: Tuesday, February 05, 2002 1:53 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Easy Question -- Show/ Hide text based on
> output of query
>
>
> On Wednesday 06 February 2002 02:53, Edward R. Bailey wrote:
> > Sorry -- Here it i
On Wednesday 06 February 2002 02:53, Edward R. Bailey wrote:
> Sorry -- Here it is
>
>
>$notes = " size=-1>Notes:";
>} else {
> $notes = "";
>}
> ?>
>
> Then I call $notes using --
>
> echo ($notes)
I meant your *whole* script -- never mind, have you tried ec
Sorry -- Here it is
Notes:";
} else {
$notes = "";
}
?>
Then I call $notes using --
echo ($notes)
> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 05, 2002 1:39 PM
> To: [EMAIL
On Wednesday 06 February 2002 02:38, Edward R. Bailey wrote:
> I used echo($notes) at the bottom of the page and the output of $notes
> prints reardless of whether or not the db field $memberNotes contains
> any data. It seems to me that $notes is always acting as if $memberNotes
> always contains
returns any data?
Thanks for your help,
ED
> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 05, 2002 1:22 PM
> To: PHP General Mailing List
> Subject: Re: [PHP] Easy Question -- Show/ Hide text based on
> output of query
>
On Wednesday 06 February 2002 02:14, Edward R. Bailey wrote:
Please keep the discussion on the list!
> Thanks for responding! Yes the "memberNotes" database field only
> contains information in about a third of the records so I wanted to hide
> the entire field and label when their was no releve
On Wednesday 06 February 2002 00:03, Edward R. Bailey wrote:
> Hi,
>
> I am working on a page the displays the output of a query in a table and
> I only want to show the field labels that have corresponding output from
> the database. I am only really concerned with the last label in the
> table.
My Database functions are all wrapped up in an easy to use class. The
methods look something like this:
$db = new DB;
$q = "SELECT * FROM ATable";
$db->query($q);
while ($db->next_record()) {
$db->p("SomethingOrOther");
}
For the PHP script itself, the content management system I wrote up
On 06-Oct-2001 Chip wrote:
> When you write a php script to access a database,edit records, etc., is the
> entire thing 1 giant PHP page or a bunch of different ones? If it can be
> written both ways, which is the better way to do it?
>
I tend to write based on function:
userland.php
adminlan
> When you write a php script to access a database,edit records,
> etc., is the
> entire thing 1 giant PHP page or a bunch of different ones? If it can be
> written both ways, which is the better way to do it?
Using seperate files eases code maintenance and prevents parsing of
redundant code.
-
> When you write a php script to access a database,edit
> records, etc., is the entire thing 1 giant PHP page or a
> bunch of different ones?
A giant one
If it can be written both ways,
> which is the better way to do it?
Depends how big is your 'giant'.
It is all about your coding style
If you want to pass more than one variable via GET, you need to use an
ampersand (&) character for the variables after the first one (still using a
question mark for the first).
So in your case, you can have this:
http://wwbl.hyrum.net/send_email.php?to=4&from=25
Then within your send_email.ph
proposed IF:
>> if(($fname) && ($lname) && ($email))
Alex:
> if (isset($fname) && isset($lname) && isset($email)) {
> echo "test";
> I believe the parens in your code don't do anything. anyway, best o' my
> knowledge that's the way to do it.
First IF tests whether the vars are 'true', Alex's
if(($fname) && ($lname) && ($email))
{ echo "test"; }
>
> Is there an easier way to write the IF line?
if (isset($fname) && isset($lname) && isset($email)) {
echo "test";
}
I believe the parens in your code don't do anything. anyway, best o' my
knowledge that's the way to do it.
"_)
-a
the only thing I can think of, would be to eliminate the () around
$fname, $lname, and $email
if they all test true in the first place, the () are kinda obsolete. :)
Nathan Cook wrote:
>
> I have always wrote code this like:
>
> if(($fname) && ($lname) && ($email))
> { echo "test";
if ($fname && $lname && $email)
echo "test";
If by easier you mean typing less. ;)
Jeremy
Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21 matches
Mail list logo