Variable Handling and the PHP Novice
Grok Headline matches for Variable Handling and the PHP Novice
Overclocking. Anything in it for the
Novice?
Overclocking. Anything in it for the
Novice?
07/15/2002 10:34 AMOverclocking is easy if you have the right equipment to start with. It
can cost nothing if your temps are ok. Its a quick, cheap and easy way
to get more out of your PC.
make money online novice
make money online novice
04/10/2004 01:07 AMWebDevInfo Apr 10 2004 5:28AM GMT
Internet chock full of tools that can
turn a novice investor into a pro
Internet chock full of tools that can
turn a novice investor into a pro
01/04/2005 04:21 AMGlobe and Mail Jan 4 2005 7:59AM GMT
Class to help novice learn to avoid
losing his shirt on eBay
Class to help novice learn to avoid
losing his shirt on eBay
06/20/2004 08:28 AMChicago Tribune Jun 20 2004 12:11PM GMT
Boca retiree teaches novice online
shoppers the ins and outs of using eBay
Boca retiree teaches novice online
shoppers the ins and outs of using eBay
04/10/2005 10:39 AMSun-sentinel.com - Sun Apr 10, 11:15 am GMT
ProWebmasterTools Offers Professional
Tools and Services to Webmasters Both
Expert and Novice
ProWebmasterTools Offers Professional
Tools and Services to Webmasters Both
Expert and Novice
03/19/2005 02:39 AMLovell Technology, LLC releases their newest Internet venture
providing professional tools and services for Webmasters of any
experience level. [PRWEB Mar 18, 2005]
Advanced Error Handling: Writing an
Error Handling Class
Advanced Error Handling: Writing an
Error Handling Class
11/10/2003 11:25 PMIf you're tired of the default error handler and want to have complete
control over default error messages, you should write your own error
handling class. Writing your own handler will enable you to change the
way php handles your error messages, and allows you to create your own
error types. With this class you will be able to send error messages
to a log file, or send error reports via email.
Variable Variables in PHP
Variable Variables in PHP
12/19/2002 10:43 PMVariable Variables in PHP
Well since it's late but I'm still grinding and I feel guilty for not
blogging much today, here's a special PHP Treat: A Variable Variable
Tutorial. Yes that's right. There is a feature in PHP called
"Variable Variables".
One of the issues that I had with implementing our Digibuy support was
our old friend and enemy: Parsing. This is such a fundamental thing
but there always seems to be a new wrinkle in it. In this case we had
an existing PHP script which did our registration calculations and was
expecting a certain set of variables. Now this code was fairly
complex and I didn't want to re-write it (much). Here's the input
data we had to parse:
author_id=BillBrown & author_password=HemosRules &
prod_sku=98079949999
With the exception that it had like 30 odd variables in it. Since my
code was expecting a series of variables I needed to parse this and
automatically create a series of variables like $author_id and
$author_password. Now if this data was being given to me by a URL
then it would be easy -- PHP could automatically do it or I could just
pull them out of $_REQUEST. But, instead, I had them going to me as
if they were a file. So ... How do you create a series of variables
on the fly?
Note: Yes I could have made an associative array but that wouldn't
have taught me anything, now would it ? I could also have gotten a
similar effect with the extract function but I found out about that
after this working. And if the code is working then ...
Well deep in the recesses of what I call a brain was a recollection of
"variable variables". I think I heard about this in a talk that
Rasmus gave although I can't honestly be sure. I do know that
whenever you need to do "meta" type tasks like this in a language, you
need to poke around the oddball features since that's usually where
they reside. What I do is look for the sections of the documentation
that I've never read. The idea behind a variable variable is simple:
interpret the value of a variable and make it into a variable itself.
I.e. the "variable variable" nomenclature.
Since php uses $ for indicating a variable they've chosen to use $$ to
make a variable variable. Let's say you have two variables, $part1
and $part2. If $part1 = "author_id" and $part2="HemosRules" how do I
get to $author_id = "HemosRules". Simple: $$part1 = $part2. Yup.
It's just that easy. Of course I did need to wrap it into a string
parsing loop. Here's the guts of it:
$strarray = explode("&",$input); foreach ($strarray as $stritem) {
$stritem = trim($stritem); $part1 = substr ( $stritem, 0, strpos
( $stritem,"=" ) ); $part2 = substr ( $stritem, strpos (
$stritem,"=" )+1, strlen ( $stritem ) ); #magic! $$ is a "variable
variable" i.e. it converts the value #in the variable into a
variable itself $$part1 = $part2; }
The way this works is an input string, $input, contains everything
that needs to be processed. First I explode this into an array using
"&" as the delimiter. Then I loop over the array with a foreach loop
creating a $part1 variable and a $part2 variable. Finally I just do
the magic $$part1 = $part2.
Here's the example Source Code.
Here's the working Example
Thanks again to my favorite Systems Administrator, Apokalyptik, for
showing me how to use PHP to generate code listings. Much easier than
pasting it into a blog entry.
More on Variable Variables from PHP.Net: [_Go_]
Variable Variables. A little confusing but definitely a frothy good
thing!
Install_Result Variable
Install_Result Variable
06/07/2004 06:57 PMThe Lowdown on Variable Annuities
The Lowdown on Variable Annuities
08/19/2004 09:27 AMThey're not all they're cracked up to be.
Variable Compliance Actuators
Variable Compliance Actuators
04/15/2004 06:21 PMThe CMU Robotics Institute has
released a new technical paper title, "An
Actuator with Mechanically Adjustable Series Compliance" (PDF
format). It sounds complicated but basically what they're describing
is
the use of a spring with adjustable stiffness in the leg of a biped.
The
spring is adjusted to recover and reuse energy that would otherwise be
lost
when the robot is running, jumping, or performing other high-energy
tasks. The paper includes plenty of background info, diagrams, and a
photo of the complete leg actuator. The research is being done at the
CMU
Microdynamic Systems Lab.
Variable Naming Restrictions
Variable Naming Restrictions
05/28/2004 07:59 PMGet Environment Variable Information
Get Environment Variable Information
08/30/2004 06:10 AMForum Stories: Variable for CDrom
Forum Stories: Variable for CDrom
08/22/2004 11:50 AMSQL Server forum stories – Use db with
variable
SQL Server forum stories – Use db with
variable
07/22/2004 06:21 PMVariable Intensity Brake Lights
Variable Intensity Brake Lights
08/10/2004 11:31 PMHere's an idea. Why not design brake lights whose intensity varies
depending up on how hard the driver is stomping on the pedal? It might
help ease some of the overreaction I've seen on various highways and
interstates in the last few years. According to a quick search, this
isn't a new idea. But why it it only mentioned on the expensive 5
series BMW cars?...
phpBB datenbank mod has XSS/SQL
Injection in the id variable
phpBB datenbank mod has XSS/SQL
Injection in the id variable
04/16/2005 02:52 PMPosted by tom cruise, Apr 16 2005
LDAP plug-in allows variable
substitution
LDAP plug-in allows variable
substitution
06/08/2004 12:04 PMI was gob-smacked to discover that the current version (1.6.2) of the
LDAP plug-in for Directory Access supports variable substitution in
its LDAP mappings! This wasn't the case with the plug-in not so long
ago, so I don't k...
Variable fees to fund bursaries
Variable fees to fund bursaries
01/19/2004 12:52 PMExeter University backs the government's tuition fees plan - saying it
will mean £4m in bursaries for poorer students.
Forum Stories: Truncate a variable
Forum Stories: Truncate a variable
07/05/2004 04:11 PMUsing the OS Environment Variable in SMS
Installer to Test for NT Workstation
Using the OS Environment Variable in SMS
Installer to Test for NT Workstation
07/03/2004 06:20 PMGetting the START Menu Directory into a
SMS Installer Variable
Getting the START Menu Directory into a
SMS Installer Variable
07/01/2004 10:18 PMForum Stories: User Desktop Variable
Forum Stories: User Desktop Variable
07/27/2004 07:32 AMSMS Installer Walkthrough: Compiler
Variable If Script Action
SMS Installer Walkthrough: Compiler
Variable If Script Action
12/31/2004 10:30 AMSMS Installer Walkthrough: Get
Environment Variable Script Action
SMS Installer Walkthrough: Get
Environment Variable Script Action
12/26/2004 07:19 AMQuarkXPress module offers variable data
capabilities
QuarkXPress module offers variable data
capabilities
05/07/2004 12:09 PMQuark today announced the release of QuarkXClusive, a new XTensions
module for QuarkXPress 6 that offers powerful variable data publishing
capabilities...
SMS Installer Walkthrough: Compiler
Variable Else Script Action
SMS Installer Walkthrough: Compiler
Variable Else Script Action
08/12/2004 11:51 PMCross-Browser Variable Opacity with PNG:
A Real Solution
Cross-Browser Variable Opacity with PNG:
A Real Solution
01/07/2004 07:11 PMThink you're stuck with wimpy GIFs and their rigid binary
transparency? Well, think again, Sunshine. Michael Lovitt shows how to
overcome flaky browser support for PNG so you can take advantage of
this graphic format's lossless compression, alpha transparency, and
variable opacity.
Working Draft: SPARQL Variable Binding
Results XML Format
Working Draft: SPARQL Variable Binding
Results XML Format
12/22/2004 01:11 AM2004-12-21: The RDF Data Access Working Group has released the First
Public Working Draft of the SPARQL Variable Binding Results XML
Format. The SPARQL query language (pronounced "sparkle") offers
developers and end users a way to write and to consume search results
across a wide range of information such as personal data, social
networks and metadata about digital artifacts like music and images.
SPARQL also provides a means of integration over disparate sources.
Visit the Semantic Web home page. (News archive)
SA04-002 - Apache config file env
variable buffer overflow
SA04-002 - Apache config file env
variable buffer overflow
09/15/2004 01:22 PMjonas.thambert_at_pts.se (Sep 15 2004)
Windows Installer Secrets and Traps –
Path Environment Variable
Windows Installer Secrets and Traps –
Path Environment Variable
02/17/2004 06:32 PMNSFOCUS SA2003-08: HP-UX libc NLSPATH
Environment Variable Privilege Elevation
Vulnerability
NSFOCUS SA2003-08: HP-UX libc NLSPATH
Environment Variable Privilege Elevation
Vulnerability
11/13/2003 12:26 PMNSFOCUS Security Team (Nov 13 2003)
Subscribe Me Pro/Enterprise - Remote
Code Execution via Backticked Perl
Variable Injection.
Subscribe Me Pro/Enterprise - Remote
Code Execution via Backticked Perl
Variable Injection.
12/19/2003 05:09 PMPaul Craig - Pimp Industries (Dec 18 2003)
MDKSA-2004:049 - Updated libneon
packages fix heap variable overflow
issues
MDKSA-2004:049 - Updated libneon
packages fix heap variable overflow
issues
05/19/2004 02:58 PMMandrake Linux Security Team (May 19 2004)
New Technology Can Improve Direct Mail
Response Rate Up to 500 Times -Marketers
Using Variable Data Printing to Connect
with Consumers
New Technology Can Improve Direct Mail
Response Rate Up to 500 Times -Marketers
Using Variable Data Printing to Connect
with Consumers
06/24/2005 09:03 PMNew variable data printing technology improves Direct Mail Response
Rates by connecting directly with consumers. [PRWEB Jun 23, 2005]
The W3C RDF Data Access Working Group
has published the first public working
draft of SPARQL Variable Binding
The W3C RDF Data Access Working Group
has published the first public working
draft of SPARQL Variable Binding
01/02/2005 11:31 AMxmlhack Jan 2 2005 1:45PM GMT
Handling events in C#
Handling events in C#
10/01/2002 11:42 PMCNET Oct 1 2002 10:01PM ET
RFC: virus handling
RFC: virus handling
01/28/2004 03:36 PMThomas Zehetbauer (Jan 28 2004)
Simple IO Handling with IO::All
Simple IO Handling with IO::All
04/09/2004 04:00 PMPerl module author extraordinaire Brian Ingerson demonstrates his
latest creation. IO::All ties together almost all of Perl's IO
handling libraries in one neat, cohesive package.
Grok Description matches for Variable Handling and the PHP Novice
GrokA matches for Variable Handling and the PHP Novice
Gimme some sugar, I am your neighbor!
Gimme some sugar, I am your neighbor!
01/23/2004 04:16 PM Andre
3000, Meet Schroeder. Well, it's not flash, but it's good for a
Friday... Charlie Brown meets OutKast.
A Perl script to find duplicate iTunes
tracks
A Perl script to find duplicate iTunes
tracks
09/17/2004 10:31 AMFor some reason, I end up with a ton of "duplicate" tracks in my
iTunes library and playlists. By this I mean that more than one track
in iTunes maps to a single file on my hard drive. I may get into this
problem because I s...
A script to remove duplicate messages
from Mail.app
A script to remove duplicate messages
from Mail.app
12/27/2003 05:25 PMSome bug in Mail.app of Panther leads to multiple downloads of the
same messages (at least in my configuration). It's a pain to manually
remove all these massages again and again. Luckily, I found Andreas
Amann's Mail Scripts...
Zizasoft Releases zsDuplicateHunter a
New Utility to Find and Remove Duplicate
Files From Computers and Updates
zsCompare to Version 2.10
Zizasoft Releases zsDuplicateHunter a
New Utility to Find and Remove Duplicate
Files From Computers and Updates
zsCompare to Version 2.10
08/19/2004 02:10 AMZizasoft has released zsDuplicateHunter, a new utility which allows
you to find and remove duplicate files from your computer.
zsDuplicateHunter runs on all modern versions of Windows and Mac OS X
10.3 or later. The functionality of zsDuplicateHunter is also
included in zsCompare version 2.10. [PRWEB Aug 19, 2004]
Sugar Free Jelly Worms [Flickr]
Sugar Free Jelly Worms [Flickr]
02/01/2005 09:34 PMDelete artwork from multiple songs in
iTunes
Delete artwork from multiple songs in
iTunes
06/29/2004 08:58 AMThe old way of removing cover art in iTunes was to scale down to a
lower MP3 tag, or individually edit Get Info boxes. Today I found out
through trial and error that when selecting multiple songs, opening
Get Info, and unchec...
Duplicate and Empty Elements
Duplicate and Empty Elements
10/02/2002 06:06 PMIn his monthly Transforming XML column, Bob DuCharme explains how to
detect, delete, and create duplicate and empty elements in source and
result trees.
Duplicate and empty elements (XML.com)
Duplicate and empty elements (XML.com)
10/08/2002 07:08 AMSMS Query to Determine Duplicate IDs
SMS Query to Determine Duplicate IDs
07/14/2004 06:31 PMDuplicate Computer Name Collection
Duplicate Computer Name Collection
08/19/2004 10:46 PMManaging Tracks: Delete Never Played
Songs from iTunes
Managing Tracks: Delete Never Played
Songs from iTunes
12/17/2004 06:30 PMThis script will survey the selected Playlist for tracks with a play
count of 0 and remove them completely from iTunes, then Trash their
files. Use with extreme caution!
Find Duplicate Music Files 0.0.9g
Find Duplicate Music Files 0.0.9g
08/08/2004 02:08 AMFinds music files that are likely to contain the same music.
Find Duplicate Music Files 0.0.9f
Find Duplicate Music Files 0.0.9f
07/26/2004 04:08 PMFinds music files that are likely to contain the same music.
10.3: Removing duplicate fonts using
FontBook
10.3: Removing duplicate fonts using
FontBook
10/29/2003 12:32 PMIf you open FontBook and see dots at the end of the font name, it
means you have duplicate copies of that font installed in your system.
To get rid of these, select the version of the font you want to use,
and then click Edit...
Find Duplicate Music Files 0.0.9j
Find Duplicate Music Files 0.0.9j
08/15/2004 02:02 AMFinds music files that are likely to contain the same music.
Duplicate posts in .Text bl0gs
Duplicate posts in .Text bl0gs
01/05/2004 11:31 PMFor anyone that noticed a lot of duplicate posts recently in .Text
weblogs, this is not a SharpReader bug, but rather a result of some
changes in the rss generated by .Text in a recent version. These
changes are: <guid>, which went from
http://{site}/{blogname}/posts/{post-number}.aspx to
http://{site}/{blogname}/archive/{year}/{month}/{day}/{post-number}.as
px <link>, which was changed in the same way. <description>,
which now adds an invisible... (245 words)
Duplicate GUID Detection and Removal
Duplicate GUID Detection and Removal
09/09/2004 10:47 AMFind Duplicate Music Files 0.0.4
Find Duplicate Music Files 0.0.4
06/01/2004 05:13 PMFinds music files that are likely to contain the same music.
With copiers, can HP print unit
duplicate its success?
With copiers, can HP print unit
duplicate its success?
11/11/2003 05:45 PMHewlett-Packard will use Comdex to discuss new moves to ensure that
its printer division can continue to thrive. A push into copiers has
been a big part of the strategy.
Notes and Tips: Duplicate Disk Images
Notes and Tips: Duplicate Disk Images
08/31/2004 03:13 PMMounting multiple copies of a disk image in Mac OS X creates problems.
Stop repeating yourself: Duplicate file
finders
Stop repeating yourself: Duplicate file
finders
04/25/2004 08:41 PMZDNet Apr 26 2004 0:36AM GMT
"DeDRMs, remove iTunes DRM under
Windows
"
"DeDRMs, remove iTunes DRM under
Windows
"
04/27/2004 08:57 AMEasy Duplicate GUID Detection Via
Command Line
Easy Duplicate GUID Detection Via
Command Line
05/21/2004 12:54 PM Variable Handling and the PHP Novice