Search results for 'array'. 3 post(s) found.
- 2007/10/16 How to declare array in PHP like C/C++
- 2007/08/26 IsIn For Arrays
- 2007/08/26 Array_count_values
simple PHP array declaration:
<?php
// array starting from index 1
$notes = array(1 => 'Do', 'Re', 'Me');
//print out array
print_r($notes);
?>
// array starting from index 1
$notes = array(1 => 'Do', 'Re', 'Me');
//print out array
print_r($notes);
?>
Another posts included in "PHP"
| How to pass variables via url (0) | 2007/10/16 |
| How to send email in PHP ? (0) | 2007/10/16 |
| PHP Switch Example (0) | 2007/10/16 |
| PHP date and time formatting (0) | 2007/10/16 |
| How to redirect browser in PHP ? (0) | 2007/10/16 |
| How to get current filename as variable ? (0) | 2007/10/16 |
| email validation, simple (0) | 2007/10/16 |
| How to ban / block IP addresses (0) | 2007/10/16 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 01:41
moneyideas
-
Subject different money making ideas
2010/01/29 09:54
moneyideas
-
Subject different money making ideas
2010/01/31 16:42
moneyideas
Coming from a Python to JavaScript I was a bit miffed by the lack of functions for some things. I once tried to use am isIn function on an array and found it to be absent. Or at at least it was at the time. This was some time ago back in the early days of JS. So I wrote this little snippet and I think many beginners might find it useful and maybe use it even if they didn’t know they needed it. The function takes two arguments an array and a value. The value is first and the array second. Why? Simple “Hey Marilyn is the burrito still in the fridge?” What is this man talking about? Simple the idea that this function is essentially a question. It’s asking if something is in something else. I’ve yet to pose the question “Hey, Marilyn does the fridge have a burrito in it?” It’s rather awkward and no one likes that so to remember parameter orders I like to put them in the order that they would be if I asked it as a question. The internal names are basically what they are. thearray is “the array” and theValue is “the value” you’re looking for. checkValue is the iteration of the loop and thus what value in “the array” or thearray you’re looking for.
function isIn(theValue, thearray) {
for(checkValue = 0; checkValue < thearray.length-1; checkValue++){
if((thearray[checkValue] == theValue))
return true;
}
return false;
}
for(checkValue = 0; checkValue < thearray.length-1; checkValue++){
if((thearray[checkValue] == theValue))
return true;
}
return false;
}
Another posts included in "HTML, Javascript"
| Keyboard event detection (Key Tracker) (0) | 2007/08/26 |
| Get A Print Dialog Box By Clicking A Button (0) | 2007/08/26 |
| Roman Numerals From Integers (0) | 2007/08/26 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 05:07
moneyideas
-
Subject different money making ideas
2010/01/29 13:53
moneyideas
-
Subject different money making ideas
2010/01/31 16:43
moneyideas
This code prints array count values
Another posts included in "PHP"
| Send email Message With PHP (0) | 2007/08/26 |
| The three simplest regular expressions you will use in PHP (0) | 2007/09/12 |
| Adding and Subtracting Time (0) | 2007/09/13 |
| Calculator with basic four functions (0) | 2007/08/26 |
| Number Format (0) | 2007/08/26 |
| A Function Returns Large Random Numbers (0) | 2007/08/26 |
| Function AccountCryptPassword($password,$salt) (0) | 2007/08/26 |
| Cardinal Endings (0) | 2007/08/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 04:45
moneyideas
-
Subject different money making ideas
2010/01/29 13:37
moneyideas
-
Subject different money making ideas
2010/01/31 16:43
moneyideas

Prev

Rss Feed