note 77398 deleted from function.strpos by danbrown

From: Date: Sun, 17 May 2009 16:31:38 +0000
Subject: note 77398 deleted from function.strpos by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154842@lists.php.net to get a copy of this message
Note Submitter: Cybertinus ---- @Wagner Christian: Yes, there are better methods. The best is to just cast is. You cast like this: <?php $id = 1; $string = (string) $id; ?> If you var_dump() $string now you get the following output: string(1) "1" This is the recommended method. You're example should look like this then: <?php $id = 1; $my_text = "hel124lo"; $first_position =strpos($my_text , (string) $id); ?>

« previous php.notes (#154842) next »