note 36601 added to function.explode

From: Date: Wed, 15 Oct 2003 22:57:46 +0000
Subject: note 36601 added to function.explode
Groups: php.notes 
Request: Send a blank email to php-notes+get-58669@lists.php.net to get a copy of this message
This is an addendum to joelith at cyberone dot com dot au's note. First of all, here is the correct code for your example: ... $temp = explode('.', $test); ... There was a variable name error. Also, you may have never heard of the modulus operator, but it's quite simpler with it. Ex: $test = 5 % 2; // $test = 1; $test = 4 % 2; // $test = 0; So, the easiest way to find if a number is even or odd is the following: $test = $number % 2; if ($temp == 0){ // even } else{ //odd } ---- Manual Page -- http://www.php.net/manual/en/function.explode.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36601 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36601&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36601&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#58669) next »