PHP Classes

give example how to store and retrieve variables

Recommend this page to a friend!

      Storage  >  All threads  >  give example how to store and...  >  (Un) Subscribe thread alerts  
Subject:give example how to store and...
Summary:Package rating comment
Messages:18
Author:synthetron
Date:2010-05-28 12:11:34
Update:2010-06-01 09:12:29
 

synthetron rated this package as follows:

Utility: Insufficient
Consistency: Not sure
  1 - 10   11 - 18  

  1. give example how to store and...   Reply   Report abuse  
Picture of synthetron synthetron - 2010-05-28 12:11:34
give example how to store and retrieve variables

  2. Re: give example how to store and...   Reply   Report abuse  
Picture of Stephen R Mann Stephen R Mann - 2010-05-28 12:54:50 - In reply to message 1 from synthetron
I agree. As a total novice to PHP programming, examples help me learn faster.

  3. Re: give example how to store and...   Reply   Report abuse  
Picture of synthetron synthetron - 2010-05-28 13:41:26 - In reply to message 2 from Stephen R Mann

  4. Re: give example how to store and...   Reply   Report abuse  
Picture of Domenico Pontari Domenico Pontari - 2010-05-28 17:19:04 - In reply to message 1 from synthetron
done

  5. Re: give example how to store and...   Reply   Report abuse  
Picture of synthetron synthetron - 2010-05-29 07:37:42 - In reply to message 4 from Domenico Pontari
i try


$myVar2 = 'http://www.google.com';
$storage->setObj ('link', $myVar2);
$storedVar = $storage->getObj ('storedVar');

echo 'Dump for storedVar: ';

var_dump ($storedVar);


i dont c difference

how to to getvar('link')
and get the google link as result



in the example of the other author it is so easy to put en get vars

  6. Re: give example how to store and...   Reply   Report abuse  
Picture of synthetron synthetron - 2010-05-29 07:41:14 - In reply to message 5 from synthetron
at last found it


echo "<hr>";
$myVar2 = 'http://www.google.com';
$storage->setObj ('link', $myVar2);
$storedVar = $storage->getObj ('link');

echo 'Dump for link: ';

var_dump ($storedVar);
echo "<hr>";
echo $storedVar;

  7. Re: give example how to store and...   Reply   Report abuse  
Picture of synthetron synthetron - 2010-05-29 07:52:12 - In reply to message 6 from synthetron

$br='<br>';
echo 'format '.$storedVar['format'].$br;
echo 'number '.$storedVar['number'].$br;

not working

  8. Re: give example how to store and...   Reply   Report abuse  
Picture of Domenico Pontari Domenico Pontari - 2010-05-29 09:41:38 - In reply to message 7 from synthetron
As you can see dumping $storedVar, it is a stdObject not an array. So that:

$br='<br>';
echo 'format '.$storedVar->format.$br;
echo 'number '.$storedVar->number.$br;

will work

  9. Re: give example how to store and...   Reply   Report abuse  
Picture of synthetron synthetron - 2010-05-29 13:10:21 - In reply to message 8 from Domenico Pontari
tx

almost there

what gets into $storedvar if link does not exist?


$storedVar = $storage->getObj ('link');

  10. Re: give example how to store and...   Reply   Report abuse  
Picture of synthetron synthetron - 2010-05-29 13:32:37 - In reply to message 9 from synthetron
when key not exist

echo "<hr>";
$storedVar = $storage->getObj ('zzz');

echo 'zzz: '.$storedVar;
echo "<hr>";
var_dump ($storedVar);



it blocks just on hr

getobj ld return errorcode then


 
  1 - 10   11 - 18  
For more information send a message to info at phpclasses dot org.