File: var.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (955 lines) | stat: -rw-r--r-- 29,087 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
<?xml version="1.0" encoding="utf-8"?>
 <reference id="ref.variables">
  <title>Variable Functions</title>
  <titleabbrev>Variables</titleabbrev>

  <refentry id="function.doubleval">
   <refnamediv>
    <refname>doubleval</refname>
    <refpurpose>Get double value of a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>double</type><methodname>doubleval</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     Returns the double (floating point) value of
     <parameter>var</parameter>.
    </simpara>
    <para>
     <parameter>Var</parameter> may be any scalar type. You cannot use
     <function>doubleval</function> on arrays or objects.
    <informalexample>
      <programlisting role="php">
$var = '122.34343The';
$double_value_of_var = doubleval ($var);
print $double_value_of_var; // prints 122.34343
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     See also <function>intval</function>,
     <function>strval</function>, <function>settype</function> and
     <link linkend="language.types.type-juggling">Type
     juggling</link>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.empty">
   <refnamediv>
    <refname>empty</refname>
    <refpurpose>Determine whether a variable is set</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>empty</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns &false; if <parameter>var</parameter> is set and has a
     non-empty or non-zero value; &true; otherwise.
     <informalexample>
      <programlisting role="php">
$var = 0;

if (empty($var)) {  // evaluates true
    echo '$var is either 0 or not set at all';
}

if (!isset($var)) { // evaluates false
    echo '$var is not set at all';
}
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     Note that this is meaningless when used on anything which isn't a
     variable; i.e. <command>empty (addslashes ($name))</command> has
     no meaning since it would be checking whether something which
     isn't a variable is a variable with a &false; value.
    </simpara>
    <simpara>
     See also <function>isset</function> and
     <function>unset</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.gettype">
   <refnamediv>
    <refname>gettype</refname>
    <refpurpose>Get the type of a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>gettype</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns the type of the PHP variable
     <parameter>var</parameter>.
    </para>
    <para>
     Possibles values for the returned string are:
     <itemizedlist>
      <listitem>
       <simpara>"boolean"</simpara>
      </listitem>
      <listitem>
       <simpara>"integer"</simpara>
      </listitem>
      <listitem>
       <simpara>"double"</simpara>
      </listitem>
      <listitem>
       <simpara>"string"</simpara>
      </listitem>
      <listitem>
       <simpara>"array"</simpara>
      </listitem>
      <listitem>
       <simpara>"object"</simpara>
      </listitem>
      <listitem>
       <simpara>"resource"</simpara>
      </listitem>
      <listitem>
       <simpara>"user function" (PHP 3 only, deprecated)</simpara>
      </listitem>
      <listitem>
       <simpara>"unknown type"</simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     For PHP 4, you should use <function>function_exists</function> and
     <function>method_exists</function> to replace the prior usage of
     <function>gettype</function> on a function.
    </para>
    <para>
     See also <function>settype</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.intval">
   <refnamediv>
    <refname>intval</refname>
    <refpurpose>Get integer value of a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>intval</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>base</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     Returns the integer value of <parameter>var</parameter>,
     using the specified base for the conversion (the default is
     base 10).
    </simpara>
    <simpara>
     <parameter>Var</parameter> may be any scalar type. You cannot use
     <function>intval</function> on arrays or objects.
    </simpara>
    <simpara>
     See also <function>doubleval</function>,
     <function>strval</function>, <function>settype</function> and
     <link linkend="language.types.type-juggling">Type
     juggling</link>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.is-array">
   <refnamediv>
    <refname>is_array</refname>
    <refpurpose>Finds whether a variable is an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_array</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns &true; if <parameter>var</parameter> is an array, &false;
     otherwise.
    </para>
    <para>
     See also <function>is_double</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_real</function>,
     <function>is_string</function>,
     <function>is_long</function>, and
     <function>is_object</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.is-bool">
   <refnamediv>
    <refname>is_bool</refname>
     <refpurpose>
      Finds out whether a variable is a boolean
     </refpurpose>
    </refnamediv>
    <refsect1>
     <title>Description</title>
     <methodsynopsis>
       <type>bool</type><methodname>is_bool</methodname>
       <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
     <para>
      Returns &true; if the <parameter>var</parameter> parameter is 
      a boolean.
     </para>
     <para>
     See also <function>is_array</function>,
     <function>is_double</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_real</function>,
     <function>is_string</function>,
     <function>is_long</function>, and
     <function>is_object</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-double">
   <refnamediv>
    <refname>is_double</refname>
    <refpurpose>Finds whether a variable is a double</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_double</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns &true; if <parameter>var</parameter> is a double,
     &false; otherwise.
    </para>
    <para>
     See also <function>is_array</function>,
     <function>is_bool</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_real</function>,
     <function>is_string</function>,
     <function>is_long</function>, and
     <function>is_object</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-float">
   <refnamediv>
    <refname>is_float</refname>
    <refpurpose>Finds whether a variable is a float</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_float</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     This function is an alias for <function>is_double</function>.
    </simpara>
    <simpara>
     See also <function>is_double</function>,
     <function>is_bool</function>,
     <function>is_real</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_string</function>,
     <function>is_object</function>,
     <function>is_array</function>, and
     <function>is_long</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.is-int">
   <refnamediv>
    <refname>is_int</refname>
    <refpurpose>Find whether a variable is an integer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_int</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     This function is an alias for <function>is_long</function>.
    </simpara>
    <simpara>
     See also <function>is_bool</function>,
     <function>is_double</function>,
     <function>is_float</function>,
     <function>is_integer</function>,
     <function>is_string</function>,
     <function>is_real</function>,
     <function>is_object</function>,
     <function>is_array</function>, and
     <function>is_long</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.is-integer">
   <refnamediv>
    <refname>is_integer</refname>
    <refpurpose>Find whether a variable is an integer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_integer</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     This function is an alias for
     <function>is_long</function>.
    </simpara>
    <simpara>
     See also <function>is_bool</function>,
     <function>is_double</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_string</function>,
     <function>is_real</function>,
     <function>is_object</function>,
     <function>is_array</function>, and
     <function>is_long</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.is-long">
   <refnamediv>
    <refname>is_long</refname>
    <refpurpose>Finds whether a variable is an integer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_long</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns &true; if <parameter>var</parameter> is an integer (long),
     &false; otherwise.
    </para>
    <para>
     See also <function>is_bool</function>,
     <function>is_double</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_real</function>,
     <function>is_string</function>,
     <function>is_object</function>,
     <function>is_array</function>, and
     <function>is_integer</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-numeric">
   <refnamediv>
    <refname>is_numeric</refname>
    <refpurpose>
     Finds whether a variable is a number or a numeric string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_numeric</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns &true; if <parameter>var</parameter> is a number or a
     numeric string, &false; otherwise.
    </para>
    <para>
     See also <function>is_bool</function>,
     <function>is_double</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_real</function>,
     <function>is_string</function>,
     <function>is_object</function>,
     <function>is_array</function>, and
     <function>is_integer</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-object">
   <refnamediv>
    <refname>is_object</refname>
    <refpurpose>Finds whether a variable is an object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_object</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns &true; if <parameter>var</parameter> is an object, &false;
     otherwise.
    </para>
    <para>
     See also <function>is_bool</function>,
     <function>is_long</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_float</function>,
     <function>is_double</function>,
     <function>is_real</function>,
     <function>is_string</function>, and
     <function>is_array</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-real">
   <refnamediv>
    <refname>is_real</refname>
    <refpurpose>Finds whether a variable is a real</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_real</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     This function is an alias for <function>is_double</function>.
    </simpara>
    <simpara>
     See also <function>is_bool</function>,
     <function>is_long</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_float</function>,
     <function>is_double</function>,
     <function>is_object</function>,
     <function>is_string</function>, and
     <function>is_array</function>.
    </simpara>
   </refsect1>
  </refentry>
  
  <refentry id="function.is-resource">
   <refnamediv>
    <refname>is_resource</refname>
    <refpurpose>
     Finds whether a variable is a resource
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_resource</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>is_resource</function> returns &true; if the variable
     given by the <parameter>var</parameter> parameter is a resource, 
     otherwise it returns &false;.
    </para>
    <para>
     Resources are things like file or database result handles that
     are allocated and freed by internal PHP functions and that may
     need some cleanup when they are no longer in use but haven't been
     freed by user code.  
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-string">
   <refnamediv>
    <refname>is_string</refname>
    <refpurpose>Finds whether a variable is a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>bool</type><methodname>is_string</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns &true; if <parameter>var</parameter> is a string,
     &false; otherwise.
    </para>
    <para>
     See also <function>is_bool</function>,
     <function>is_long</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_float</function>,
     <function>is_double</function>,
     <function>is_real</function>,
     <function>is_object</function>, and
     <function>is_array</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.isset">
   <refnamediv>
    <refname>isset</refname>
    <refpurpose>Determine whether a variable is set</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>isset</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     Returns &true; if <parameter>var</parameter> exists;
     &false; otherwise.
    </simpara>
    <para>
     If a variable has been unset with <function>unset</function>,
     it will no longer be <function>isset</function>.
     <informalexample>
      <programlisting role="php">
$a = "test";
echo isset ($a); // true
unset ($a);
echo isset ($a); // false
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     See also <function>empty</function> and
     <function>unset</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.print-r">
   <refnamediv>
    <refname>print_r</refname>
    <refpurpose>
     Prints human-readable information about a variable
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>void</type><methodname>print_r</methodname>
      <methodparam><type>mixed</type><parameter>expression</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     This function displays information about the values of variables
     in a way that's readable by humans.  If given a string, integer
     or double, the value itself will be printed.  If given an array,
     values will be presented in a format that shows keys and
     elements.  Similar notation is used for objects.
    </simpara>
    <simpara>
     Compare <function>print_r</function> to
     <function>var_dump</function>.
    </simpara>
    <para>
     <informalexample>
      <programlisting role="php">
&lt;?php
$a = array (1, 2, array ("a", "b", "c"));
print_r ($a);
?>
      </programlisting>
     </informalexample>
    </para>
    <warning>
     <para>
      This function will continue forever if given an array or object 
      that contains a direct or indirect reference to itself or that 
      contains an array or object on a deeper level that does so.
      This is especially &true; for <literal>print_r($GLOBALS)</literal>, 
      as <literal>$GLOBALS</literal> is itself a global variable and
      contains a reference to itself as such.
     </para>
    </warning>
   </refsect1>
  </refentry>

  <refentry id="function.serialize">
   <refnamediv>
    <refname>serialize</refname>
    <refpurpose>
     Generates a storable representation of a value
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>serialize</methodname>
      <methodparam><type>mixed</type><parameter>value</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>serialize</function> returns a string containing a
     byte-stream representation of <parameter>value</parameter> that
     can be stored anywhere.
    </simpara>
    <simpara>
     This is useful for storing or passing PHP values around without
     losing their type and structure.
    </simpara>
    <simpara>
     To make the serialized string into a PHP value again, use
     <function>unserialize</function>.    <function>serialize</function>
     handles the types <type>integer</type>, <type>double</type>,
     <type>string</type>, <type>array</type> (multidimensional) and
     <type>object</type> (object properties will be serialized, but
     methods are lost).
    </simpara>
    <para>
     <example>
      <title><function>serialize</function> example</title>
      <programlisting role="php">
// $session_data contains a multi-dimensional array with session
// information for the current user.  We use serialize() to store
// it in a database at the end of the request.

$conn = odbc_connect ("webdb", "php", "chicken");
$stmt = odbc_prepare ($conn,
      "UPDATE sessions SET data = ? WHERE id = ?");
$sqldata = array (serialize($session_data), $PHP_AUTH_USER);
if (!odbc_execute ($stmt, &amp;$sqldata)) {
    $stmt = odbc_prepare($conn,
     "INSERT INTO sessions (id, data) VALUES(?, ?)");
    if (!odbc_execute($stmt, &amp;$sqldata)) {
    /* Something went wrong.  Bitch, whine and moan. */
    }
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.settype">
   <refnamediv>
    <refname>settype</refname>
    <refpurpose>Set the type of a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>settype</methodname>
      <methodparam><type>string</type><parameter>var</parameter></methodparam>
      <methodparam><type>string</type><parameter>type</parameter></methodparam>
     </methodsynopsis>
    <para>
     Set the type of variable <parameter>var</parameter> to
     <parameter>type</parameter>.
    </para>
    <para>
     Possibles values of <parameter>type</parameter> are:
     <itemizedlist>
      <listitem><simpara>"integer"</simpara></listitem>
      <listitem><simpara>"double"</simpara></listitem>
      <listitem><simpara>"string"</simpara></listitem>
      <listitem><simpara>"array"</simpara></listitem>
      <listitem><simpara>"object"</simpara></listitem>
     </itemizedlist>
    </para>
    <para>
     Returns &true; if successful; otherwise returns &false;.
    </para>
    <para>
     See also <function>gettype</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strval">
   <refnamediv>
    <refname>strval</refname>
    <refpurpose>Get string value of a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>strval</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     Returns the string value of <parameter>var</parameter>.
    </simpara>
    <simpara>
     <parameter>var</parameter> may be any scalar type. You cannot use
     <function>strval</function> on arrays or objects.
    </simpara>
    <simpara>
     See also <function>doubleval</function>,
     <function>intval</function>, <function>settype</function> and
     <link linkend="language.types.type-juggling">Type
     juggling</link>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.unserialize">
   <refnamediv>
    <refname>unserialize</refname>
    <refpurpose>
     Creates a PHP value from a stored representation
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>mixed</type><methodname>unserialize</methodname>
      <methodparam><type>string</type><parameter>str</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <function>unserialize</function> takes a single serialized
     variable (see <function>serialize</function>) and converts it
     back into a PHP value.  The converted value is returned, and can
     be an <type>integer</type>, <type>double</type>,
     <type>string</type>, <type>array</type> or <type>object</type>.
     If an object was serialized, its methods are not preserved in the
     returned value.
    </simpara>
    <para>
     <example>
      <title><function>unserialize</function> example</title>
      <programlisting role="php">
// Here, we use unserialize() to load session data from a database
// into $session_data.    This example complements the one described
// with <function>serialize</function>.

$conn = odbc_connect ("webdb", "php", "chicken");
$stmt = odbc_prepare ($conn, "SELECT data FROM sessions WHERE id = ?");
$sqldata = array ($PHP_AUTH_USER);
if (!odbc_execute ($stmt, &amp;$sqldata) || !odbc_fetch_into ($stmt, &amp;$tmp)) {
    // if the execute or fetch fails, initialize to empty array
    $session_data = array();
} else {
    // we should now have the serialized data in $tmp[0].
    $session_data = unserialize ($tmp[0]);
    if (!is_array ($session_data)) {
    // something went wrong, initialize to empty array
    $session_data = array();
    }
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.unset">
   <refnamediv>
    <refname>unset</refname>
    <refpurpose>Unset a given variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>int</type><methodname>unset</methodname>
      <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
      <methodparam choice="opt"><type>mixed</type><parameter>var</parameter></methodparam>
      <methodparam choice="opt"><parameter>...</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>unset</function> destroys the specified variables and
     returns &true;.
    </para>
    <para>
     <example>
      <title><function>unset</function> example</title>
      <programlisting role="php">
// destroy a single variable
unset ($foo);

// destroy a single element of an array
unset ($bar['quux']);

// destroy more than one variable
unset ($foo1, $foo2, $foo3);
      </programlisting>
     </example>
    </para>
    <para>
     The behavior of <function>unset</function> inside of a function
     can vary depending on what type of variable you are attempting to
     destroy.
    </para>
    <para>
     If a globalized variable is <function>unset</function> inside of
     a function, only the local variable is destroyed.  The variable
     in the calling environment will retain the same value as before
     <function>unset</function> was called.
     <informalexample>
      <programlisting role="php">
function destroy_foo() {
    global $foo;
    unset($foo);
}

$foo = 'bar';
destroy_foo();
echo $foo;
      </programlisting>
     </informalexample>
     The above example would output:
     <informalexample>
      <programlisting>
bar
      </programlisting>
     </informalexample>
    </para>
    <para>
     If a variable that is PASSED BY REFERENCE is
     <function>unset</function> inside of a function, only the local
     variable is destroyed.  The variable in the calling environment
     will retain the same value as before <function>unset</function>
     was called.
     <informalexample>
      <programlisting role="php">
function foo(&amp;$bar) { 
    unset($bar); 
    $bar = "blah"; 
}

$bar = 'something';
echo "$bar\n";

foo($bar);
echo "$bar\n";
      </programlisting>
     </informalexample>
     The above example would output:
     <informalexample>
      <programlisting>
something
something
      </programlisting>
     </informalexample>
    </para>
    <para>
     If a static variable is <function>unset</function> inside of a
     function, <function>unset</function> unsets the reference to the
     static variable, rather than the static variable itself.
     <informalexample>
      <programlisting role="php">
function foo() { 
    static $a;
    $a++;
       echo "$a\n";

    unset($a);
}

foo();
foo();
foo();
      </programlisting>
     </informalexample>
     The above example would output:
     <informalexample>
      <programlisting>
1
2
3
      </programlisting>
     </informalexample>
    </para>
    <para>
     If you would like to <function>unset</function> a global variable inside of a function, you can use the <parameter>$GLOBALS</parameter> array to do so:
     <informalexample>
      <programlisting role="php">
function foo() {
    unset($GLOBALS['bar']);       
}

$bar = "something";
foo();
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>isset</function> and
     <function>empty</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.var-dump">
   <refnamediv>
    <refname>var_dump</refname>
    <refpurpose>Dumps information about a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>void</type><methodname>var_dump</methodname>
      <methodparam><type>mixed</type><parameter>expression</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     This function returns structured information about an expression
     that includes its type and value.  Arrays are explored
     recursively with values indented to show structure.
    </simpara>
    <simpara>
     Compare <function>var_dump</function> to
     <function>print_r</function>.
    </simpara>
    <para>
     <informalexample>
      <programlisting role="php">
&lt;pre>
&lt;?php
    $a = array (1, 2, array ("a", "b", "c"));
    var_dump ($a);
?>
&lt;/pre>
      </programlisting>
     </informalexample>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->