RE: [PHP] searching an array for words starting with 'p'

2002-07-30 Thread Joseph Rosenblum

I don't think there's a builtin that does exactly what you are looking
for, but this will do the trick:

?php

$array = array ( pinaeapple, orange, passionfruit);
$newar = array();

foreach ($array as $val) {
   if ($val{0} == p) {
  $newar[] = $val;
   }
}

?


-Joseph Rosenblum
President, 25th Street Networks
Easy, Reliable PHP Web Hosting at:
http://www.25thstreet.net/


-Original Message-
From: andy [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, July 30, 2002 8:37 AM
To: [EMAIL PROTECTED]
Subject: [PHP] searching an array for words starting with 'p'

Hi there,

I am wondering how to search an array for words starting with a certain
character.

E.G:

$word = array('alpha', 'beta', 'php');

I would like to check if there is a word in the array starting with p

Is there alrready a function for this?

Thanx, Andy



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



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




RE: [PHP] Update of the problem w/ code - conditional image generation problem?!

2002-07-29 Thread Joseph Rosenblum

Do you know you have a typo in that conditional there? Was that your
real code? You misspelled 'else' as 'esle'.

-Joseph Rosenblum
President, 25th Street Networks
Get Easy, Reliable PHP Web Hosting at:
http://www.25thstreet.net

-Original Message-
From: Alex Maslov [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 29, 2002 1:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Update of the problem w/ code - conditional image
generation problem?!

Thank everyone for suggestions.

I followed through on them but unsuccessfully. I looked for any mistake
but
couldn't find it. I tried commenting out lines in chunks and one by one,
without any effect.

the problem stays the same, if the conditional statement is present then
image
is not generated, otherwise the code works and is generating an image.
Also, the image is generating only in Netscape browzer?! Internet
Explorer
does not display the image at all, never, with or without conditional.

Is their some trick i need to know to display images both in netscape
and
iexplorer?

if smone would give it a shot i would be very thankfull! thnks in
advance for
your help.

---file counter.php ---
?php
session_start();

//get stats info
/*
if ($_SERVER[QUERY_STRING] != NULL ) {
$from_page  = $_GET[fp];
$scr_width  = $_GET[wd];
$scr_height = $_GET[ht];
$color_palt = $_GET[cl];
$platform   = $_GET[pl];
$java   = $_GET[jv];
$taint  = $_GET[tn];
}//fi
*/
/*
$this_page  = $_SERVER[PHP_SELF];
$address= $_SERVER[REMOTE_ADDR];
$lang   = $_SERVER[HTTP_ACCEPT_LANGUAGE];

if (!isset($from_page)) $from_page =
$_SERVER[HTTP_REFERER];

*/
//  $bwzr_info  = $_SERVER[HTTP_USER_AGENT];

/*
echo(previous page = $from_page br);
echo(current page = $this_page br);
echo(address = $address br);
echo(screen width = $scr_width br);
echo(screen height = $scr_height br);
echo(color pallette = $color_palt br);
echo(platform = $platform br);
echo(language = $lang br);
echo(browzer info = $bwzr_info br);
echo(java enabled = $java br);
echo(taint enabled = $taint br);
*/
//---   LOG DATA INTO DATABASE  ---//
// todo //

//this is the begining of troublesome conditional statment
if ( false ) {
//echo(we here);
//$image = ImageCreate(1,1);
//$navyblue = ImageColorAllocate($image, 0, 0, 0);
//ImageFilledRectangle($image, 0, 0, 1, 1, $navyblue);
} esle {

$web_uniqe_kount = sprintf(%07d,
$_SESSION['web_uniqe_count']);
$web_total_kount = sprintf(%07d,
$_SESSION['web_total_count']);
$web_print_kount = sprintf(%07d,
$_SESSION['web_print_count']);

$office_uniqe_kount = sprintf(%07d,
$_SESSION['office_uniqe_count']);
$office_total_kount = sprintf(%07d,
$_SESSION['office_total_count']);
$office_print_kount = sprintf(%07d,
$_SESSION['office_print_count']);

$uniqe_str = Uniqe;
$total_str = Total;
$print_str = Print;

$web_head = Web;
$office_head = Office;

$header_length = 6;
$column_length = 9;

$spacer = 1;

$font_size = 1;
$charHeight = ImageFontHeight($font_size);
$charWidth = ImageFontWidth($font_size);

$head_cell_Width = ($charWidth * $header_length) + (2 *
$spacer);
$numb_cell_Width = ($charWidth * $column_length) + (2 *
$spacer);
$cell_Height = $charHeight + (4 * $spacer);

$row_Width = $head_cell_Width + (2 * $numb_cell_Width);
$row_Height = $cell_Height;

$column_Width = $numb_cell_Width;
$column_Height = $cell_Height * 4;

$horizontalMargin = 1;
$verticalMargin = 1;

$image_Width = $row_Width + (2 * horizontalMargin);
$image_Height = $column_Height + (2 * verticalMargin);

//create blank image template with specified dimmentions
$image = ImageCreate($image_Width, $image_Height);

//initiate color pallete to be used
$black = ImageColorAllocate($image, 0, 0, 0);
$white = ImageColorAllocate($image, 255, 255, 255);
$red   = ImageColorAllocate($image, 255, 0, 0);

//fill image background with black color
ImageFilledRectangle($image, 0, 0, $imageWidth,
$imageHeight,
$black);

//set line style