Re: [PHP] Looping through array

2006-11-16 Thread Darrell Brogdon

?php
$arr = array(5, 4, 3, 2, 1, 10, 9, 8, 7, 6,);

echo 'table border=1';
echo 'tr';

for ($x=0,$y=sizeof($arr); $x$y; ++$x) {
echo td{$arr[$x]}/td;

if ($x == 4) {
echo '/trtr';
}
}

echo '/tr';
echo '/table';
?

On Nov 16, 2006, at 1:19 PM, Ashley M. Kirchner wrote:



   Say I have an array containing ten items, and I want to display  
them in a table as follows:


5 4 3 2 1
   10 9 8 7 6

   What's the best way to loop through that array to do that?  My  
thinking gets me to create a loop for 5 through 1, repeated twice,  
and the second time I add '5' to the index value.  There's got to  
be a saner way...


--
W | It's not a bug - it's an undocumented feature.
 +
 Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
 IT Director / SysAdmin / Websmith . 800.441.3873 x130
 Photo Craft Imaging   . 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







Darrell Brogdon
[EMAIL PROTECTED]
http://darrell.brogdon.net

*
** Prepare for PHP Certication!**
** http://phpflashcards.com**
*




Re: [PHP] Looping through array

2006-11-16 Thread Darrell Brogdon
So in other words, you have an array like $arr = array 
(1,2,3,4,5,6,7,8,9,10) but you want it to render on the page as:


  5 4 3 2 1
10 9 8 7 6

right?

-D


On Nov 16, 2006, at 1:35 PM, Ashley M. Kirchner wrote:


Darrell Brogdon wrote:

$arr = array(5, 4, 3, 2, 1, 10, 9, 8, 7, 6,);

   The array is in order, from 1 to 10.  It was populated that way.

--
W | It's not a bug - it's an undocumented feature.
 +
 Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
 IT Director / SysAdmin / Websmith . 800.441.3873 x130
 Photo Craft Imaging   . 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.







Darrell Brogdon
[EMAIL PROTECTED]
http://darrell.brogdon.net

*
** Prepare for PHP Certication!**
** http://phpflashcards.com**
*




Re: [PHP] Splitting a string

2006-11-14 Thread Darrell Brogdon

What's the code?

-D


On Nov 14, 2006, at 4:17 PM, Børge Holen wrote:


This numer has dynamic lenght, witch is the root of my problems.

$number = 123456789

should print as following:
var1: 12345   (and it is this lengt witch varies)
var2: 67
var3: 89.

I've been using substr with negative numbers to fetch the last two  
vars.

thereafter explode to get the first number.
Ok I understand the code and can use it, but it feels wrong.
Does anyone have any idea on suitable functions for such a task,  
both more
size (as in code) and speed effective. It is not a mission  
critical, but

moreover a opinion of what things should look like.
I've been looking into string/explode functions on php.net without  
getting

past my current code.


--
---
Børge
Kennel Arivene
http://www.arivene.net
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






Darrell Brogdon
[EMAIL PROTECTED]
http://darrell.brogdon.net

*
** Prepare for PHP Certication!**
** http://phpflashcards.com**
*




Re: [PHP] Regular expressions

2006-11-14 Thread Darrell Brogdon
Can you elaborate a little?  Do you mean that you want certain  
letters to have a numeric representation?


-D

On Nov 14, 2006, at 6:57 PM, John Meyer wrote:

Is there a way to make a regular expression to match on a  
particular way

the letters are arranged?  For instance, if you had a word:

THAT


It could match on any word in the dictionary that had the form:

1231

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






Darrell Brogdon
[EMAIL PROTECTED]
http://darrell.brogdon.net

*
** Prepare for PHP Certication!**
** http://phpflashcards.com**
*




Re: [PHP] Determining what's installed

2006-11-09 Thread Darrell Brogdon
phpinfo() should mention it if its installed.  Also, just try calling  
one of the ImageMagick functions in a test script.  If its not  
installed PHP will complain accordingly.


-D

On Nov 9, 2006, at 11:02 AM, tedd wrote:


Hi gang:

I'm sure this is an obvious question to most, but how does one  
determine what software is installed on a virtual host?


You see, I want to know if ImageMagick (MagicWand for PHP) is  
installed on my host or not. I've tried using cPannel and phpinfo,  
but neither mention it -- however --  I don't know for sure if  
either would anyway.


So, how do you find out -- other than asking the host (who in my  
case, is very slow to respond)?


Thanks,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Darrell Brogdon
[EMAIL PROTECTED]
http://darrell.brogdon.net

*
** Prepare for PHP Certication!**
** http://phpflashcards.com**
*