home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / phpmanual / phpmanual.exe / php_manual_cs.html.htm < prev    next >
Encoding:
Extensible Markup Language  |  2005-01-13  |  7.5 MB  |  515,016 lines

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1. <HTML
  2. ><HEAD
  3. ><TITLE
  4. >Manußl PHP</TITLE
  5. ><META
  6. NAME="GENERATOR"
  7. CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><META
  8. HTTP-EQUIV="Content-type"
  9. CONTENT="text/html; charset=ISO-8859-2"></HEAD
  10. ><BODY
  11. CLASS="book"
  12. BGCOLOR="#FFFFFF"
  13. TEXT="#000000"
  14. LINK="#0000FF"
  15. VLINK="#840084"
  16. ALINK="#0000FF"
  17. ><DIV
  18. CLASS="BOOK"
  19. ><A
  20. NAME="manual"
  21. ></A
  22. ><DIV
  23. CLASS="TITLEPAGE"
  24. ><H1
  25. CLASS="title"
  26. ><A
  27. NAME="manual"
  28. ></A
  29. >Manußl PHP</H1
  30. ><DIV
  31. CLASS="author"
  32. >Stig Sæther Bakken</DIV
  33. ><DIV
  34. CLASS="author"
  35. >Alexander Aulbach</DIV
  36. ><DIV
  37. CLASS="author"
  38. >Egon Schmid</DIV
  39. ><DIV
  40. CLASS="author"
  41. >Jim Winstead</DIV
  42. ><DIV
  43. CLASS="author"
  44. >Lars Torben Wilson</DIV
  45. ><DIV
  46. CLASS="author"
  47. >Rasmus Lerdorf</DIV
  48. ><DIV
  49. CLASS="author"
  50. >Andrei Zmievski</DIV
  51. ><DIV
  52. CLASS="author"
  53. >Jouni Ahto</DIV
  54. ><H2
  55. CLASS="EDITEDBY"
  56. >Sestavil</H2
  57. ><DIV
  58. CLASS="editor"
  59. >Lukß╣ Jelφnek</DIV
  60. ><DIV
  61. CLASS="editor"
  62. >Jakub Vrßna</DIV
  63. ><P
  64. CLASS="pubdate"
  65. >03-01-2004<BR></P
  66. ><P
  67. CLASS="copyright"
  68. >Copyright © 1997, 1998, 1999, 2000, 2001, 2002 the PHP Documentation Group</P
  69. ><DIV
  70. CLASS="legalnotice"
  71. ><A
  72. NAME="copyright"
  73. ></A
  74. ><P
  75. ><B
  76. >Copyright</B
  77. ></P
  78. ><P
  79. >     Tento manußl je © Copyright 1997, 1998, 1999, 2000, 2001, 2002 PHP
  80.     Documentation Group.  Seznam Φlen∙ tΘto skupiny je na titulnφ stran∞
  81.     tohoto manußlu.
  82.    </P
  83. ><P
  84. >     Tento manußl lze redistribuovat podle podmφnek GNU General Public License
  85.     publikovanΘ Free Software Foundation; bu∩ verzφ 2 tΘto Licence, nebo (dle
  86.     va╣eho uvß╛enφ) kterΘkoliv pozd∞j╣φ verze.
  87.    </P
  88. ><P
  89. >     Sekce tohoto manußlu "Roz╣φ°enφ PHP 4.0" je © 2000 Zend Technologies,
  90.     Ltd. Tento materißl smφ b²t redistribuovßn pouze za podmφnek
  91.     specifikovan²ch v Open Publication License v1.0 nebo pozd∞j╣φ (nejnov∞j╣φ
  92.     verze je v souΦasnosti k dispozici na
  93.     <A
  94. HREF="http://www.opencontent.org/openpub/"
  95. TARGET="_top"
  96. >http://www.opencontent.org/openpub/</A
  97. >).
  98.    </P
  99. ></DIV
  100. ><HR></DIV
  101. ><DIV
  102. CLASS="TOC"
  103. ><DL
  104. ><DT
  105. ><B
  106. >Obsah</B
  107. ></DT
  108. ><DT
  109. ><A
  110. HREF="#preface"
  111. >P°edmluva</A
  112. ></DT
  113. ><DT
  114. >I. <A
  115. HREF="#getting-started"
  116. >ZaΦφnßme</A
  117. ></DT
  118. ><DD
  119. ><DL
  120. ><DT
  121. >1. <A
  122. HREF="#introduction"
  123. >Introduction</A
  124. ></DT
  125. ><DT
  126. >2. <A
  127. HREF="#tutorial"
  128. >A simple tutorial</A
  129. ></DT
  130. ><DT
  131. >3. <A
  132. HREF="#installation"
  133. >Instalace</A
  134. ></DT
  135. ><DT
  136. >4. <A
  137. HREF="#configuration"
  138. >Runtime Configuration</A
  139. ></DT
  140. ></DL
  141. ></DD
  142. ><DT
  143. >II. <A
  144. HREF="#langref"
  145. >Reference jazyka</A
  146. ></DT
  147. ><DD
  148. ><DL
  149. ><DT
  150. >5. <A
  151. HREF="#language.basic-syntax"
  152. >Zßkladnφ syntaxe</A
  153. ></DT
  154. ><DT
  155. >6. <A
  156. HREF="#language.types"
  157. >Types</A
  158. ></DT
  159. ><DT
  160. >7. <A
  161. HREF="#language.variables"
  162. >Prom∞nnΘ</A
  163. ></DT
  164. ><DT
  165. >8. <A
  166. HREF="#language.constants"
  167. >Konstanty</A
  168. ></DT
  169. ><DT
  170. >9. <A
  171. HREF="#language.expressions"
  172. >V²razy</A
  173. ></DT
  174. ><DT
  175. >10. <A
  176. HREF="#language.operators"
  177. >Operßtory</A
  178. ></DT
  179. ><DT
  180. >11. <A
  181. HREF="#control-structures"
  182. >╪φdicφ struktury</A
  183. ></DT
  184. ><DT
  185. >12. <A
  186. HREF="#functions"
  187. >Funkce</A
  188. ></DT
  189. ><DT
  190. >13. <A
  191. HREF="#language.oop"
  192. >Classes and Objects</A
  193. ></DT
  194. ><DT
  195. >14. <A
  196. HREF="#language.references"
  197. >Vysv∞tlenφ referencφ (odkaz∙)</A
  198. ></DT
  199. ></DL
  200. ></DD
  201. ><DT
  202. >III. <A
  203. HREF="#security"
  204. >Security</A
  205. ></DT
  206. ><DD
  207. ><DL
  208. ><DT
  209. >15. <A
  210. HREF="#security.index"
  211. >Security</A
  212. ></DT
  213. ></DL
  214. ></DD
  215. ><DT
  216. >IV. <A
  217. HREF="#features"
  218. >Vlastnosti</A
  219. ></DT
  220. ><DD
  221. ><DL
  222. ><DT
  223. >16. <A
  224. HREF="#features.http-auth"
  225. >HTTP autentikace a PHP</A
  226. ></DT
  227. ><DT
  228. >17. <A
  229. HREF="#features.cookies"
  230. >Cookies</A
  231. ></DT
  232. ><DT
  233. >18. <A
  234. HREF="#features.file-upload"
  235. >Zpracovßnφ uploadu soubor∙</A
  236. ></DT
  237. ><DT
  238. >19. <A
  239. HREF="#features.remote-files"
  240. >Pou╛itφ vzdßlen²ch soubor∙</A
  241. ></DT
  242. ><DT
  243. >20. <A
  244. HREF="#features.connection-handling"
  245. >Obsluha spojenφ</A
  246. ></DT
  247. ><DT
  248. >21. <A
  249. HREF="#features.persistent-connections"
  250. >Persistentnφ databßzovß spojenφ</A
  251. ></DT
  252. ><DT
  253. >22. <A
  254. HREF="#features.safe-mode"
  255. >BezpeΦn² re╛im</A
  256. ></DT
  257. ><DT
  258. >23. <A
  259. HREF="#features.commandline"
  260. >Pou╛itφ PHP z p°φkazovΘ °ßdky</A
  261. ></DT
  262. ></DL
  263. ></DD
  264. ><DT
  265. >V. <A
  266. HREF="#funcref"
  267. >Reference funkcφ</A
  268. ></DT
  269. ><DD
  270. ><DL
  271. ><DT
  272. >I. <A
  273. HREF="#ref.apache"
  274. >Funkce specifickΘ pro Apache</A
  275. ></DT
  276. ><DT
  277. >II. <A
  278. HREF="#ref.array"
  279. >Funkce pro prßci s poli</A
  280. ></DT
  281. ><DT
  282. >III. <A
  283. HREF="#ref.aspell"
  284. >Aspell funkce [zastaralΘ]</A
  285. ></DT
  286. ><DT
  287. >IV. <A
  288. HREF="#ref.bc"
  289. >BCMath funkce pro v²poΦty s libovolnou p°esnostφ</A
  290. ></DT
  291. ><DT
  292. >V. <A
  293. HREF="#ref.bzip2"
  294. >Kompresnφ funkce bzip2</A
  295. ></DT
  296. ><DT
  297. >VI. <A
  298. HREF="#ref.calendar"
  299. >Kalendß°ovΘ funkce</A
  300. ></DT
  301. ><DT
  302. >VII. <A
  303. HREF="#ref.ccvs"
  304. >CCVS API Functions</A
  305. ></DT
  306. ><DT
  307. >VIII. <A
  308. HREF="#ref.com"
  309. >Funkce na podporu COM ve Windows</A
  310. ></DT
  311. ><DT
  312. >IX. <A
  313. HREF="#ref.classobj"
  314. >Funkce pro prßci s t°φdami/objekty</A
  315. ></DT
  316. ><DT
  317. >X. <A
  318. HREF="#ref.cpdf"
  319. >ClibPDF functions</A
  320. ></DT
  321. ><DT
  322. >XI. <A
  323. HREF="#ref.crack"
  324. >Crack functions</A
  325. ></DT
  326. ><DT
  327. >XII. <A
  328. HREF="#ref.curl"
  329. >Funkce pro prßci s CURL, Client URL Library</A
  330. ></DT
  331. ><DT
  332. >XIII. <A
  333. HREF="#ref.cybercash"
  334. >Cybercash platebnφ funkce</A
  335. ></DT
  336. ><DT
  337. >XIV. <A
  338. HREF="#ref.cyrus"
  339. >Cyrus IMAP administration functions</A
  340. ></DT
  341. ><DT
  342. >XV. <A
  343. HREF="#ref.ctype"
  344. >Character type functions</A
  345. ></DT
  346. ><DT
  347. >XVI. <A
  348. HREF="#ref.dba"
  349. >Database (dbm-style) abstraction layer functions</A
  350. ></DT
  351. ><DT
  352. >XVII. <A
  353. HREF="#ref.datetime"
  354. >Funkce pro datum a Φas</A
  355. ></DT
  356. ><DT
  357. >XVIII. <A
  358. HREF="#ref.dbase"
  359. >dBase functions</A
  360. ></DT
  361. ><DT
  362. >XIX. <A
  363. HREF="#ref.dbm"
  364. >DBM Funkce [zastaralΘ]</A
  365. ></DT
  366. ><DT
  367. >XX. <A
  368. HREF="#ref.dbx"
  369. >dbx functions</A
  370. ></DT
  371. ><DT
  372. >XXI. <A
  373. HREF="#ref.dbplus"
  374. >DB++ Functions</A
  375. ></DT
  376. ><DT
  377. >XXII. <A
  378. HREF="#ref.dio"
  379. >Direct IO functions</A
  380. ></DT
  381. ><DT
  382. >XXIII. <A
  383. HREF="#ref.dir"
  384. >Adresß°ovΘ funkce</A
  385. ></DT
  386. ><DT
  387. >XXIV. <A
  388. HREF="#ref.domxml"
  389. >DOM XML functions</A
  390. ></DT
  391. ><DT
  392. >XXV. <A
  393. HREF="#ref.dotnet"
  394. >.NET functions</A
  395. ></DT
  396. ><DT
  397. >XXVI. <A
  398. HREF="#ref.errorfunc"
  399. >Error Handling and Logging Functions</A
  400. ></DT
  401. ><DT
  402. >XXVII. <A
  403. HREF="#ref.fam"
  404. >File alteration monitor functions</A
  405. ></DT
  406. ><DT
  407. >XXVIII. <A
  408. HREF="#ref.fbsql"
  409. >FrontBase Functions</A
  410. ></DT
  411. ><DT
  412. >XXIX. <A
  413. HREF="#ref.filepro"
  414. >filePro funkce</A
  415. ></DT
  416. ><DT
  417. >XXX. <A
  418. HREF="#ref.filesystem"
  419. >Funkce filesystΘmu</A
  420. ></DT
  421. ><DT
  422. >XXXI. <A
  423. HREF="#ref.fdf"
  424. >Forms Data Format functions</A
  425. ></DT
  426. ><DT
  427. >XXXII. <A
  428. HREF="#ref.fribidi"
  429. >FriBiDi functions</A
  430. ></DT
  431. ><DT
  432. >XXXIII. <A
  433. HREF="#ref.ftp"
  434. >FTP functions</A
  435. ></DT
  436. ><DT
  437. >XXXIV. <A
  438. HREF="#ref.funchand"
  439. >Funkce pro prßci s funkcemi</A
  440. ></DT
  441. ><DT
  442. >XXXV. <A
  443. HREF="#ref.gettext"
  444. >Gettext</A
  445. ></DT
  446. ><DT
  447. >XXXVI. <A
  448. HREF="#ref.gmp"
  449. >GMP functions</A
  450. ></DT
  451. ><DT
  452. >XXXVII. <A
  453. HREF="#ref.http"
  454. >HTTP funkce</A
  455. ></DT
  456. ><DT
  457. >XXXVIII. <A
  458. HREF="#ref.hyperwave"
  459. >Hyperwave functions</A
  460. ></DT
  461. ><DT
  462. >XXXIX. <A
  463. HREF="#ref.hwapi"
  464. >Hyperwave API functions</A
  465. ></DT
  466. ><DT
  467. >XL. <A
  468. HREF="#ref.iconv"
  469. >iconv functions</A
  470. ></DT
  471. ><DT
  472. >XLI. <A
  473. HREF="#ref.image"
  474. >Image functions</A
  475. ></DT
  476. ><DT
  477. >XLII. <A
  478. HREF="#ref.imap"
  479. >IMAP, POP3 and NNTP functions</A
  480. ></DT
  481. ><DT
  482. >XLIII. <A
  483. HREF="#ref.ifx"
  484. >Informix functions</A
  485. ></DT
  486. ><DT
  487. >XLIV. <A
  488. HREF="#ref.ibase"
  489. >InterBase functions</A
  490. ></DT
  491. ><DT
  492. >XLV. <A
  493. HREF="#ref.ingres"
  494. >Ingres II functions</A
  495. ></DT
  496. ><DT
  497. >XLVI. <A
  498. HREF="#ref.ircg"
  499. >IRC Gateway Functions</A
  500. ></DT
  501. ><DT
  502. >XLVII. <A
  503. HREF="#ref.java"
  504. >PHP / Java Integration</A
  505. ></DT
  506. ><DT
  507. >XLVIII. <A
  508. HREF="#ref.ldap"
  509. >LDAP functions</A
  510. ></DT
  511. ><DT
  512. >XLIX. <A
  513. HREF="#ref.mail"
  514. >MailovΘ funkce</A
  515. ></DT
  516. ><DT
  517. >L. <A
  518. HREF="#ref.mailparse"
  519. >mailparse functions</A
  520. ></DT
  521. ><DT
  522. >LI. <A
  523. HREF="#ref.math"
  524. >MatematickΘ funkce</A
  525. ></DT
  526. ><DT
  527. >LII. <A
  528. HREF="#ref.mbstring"
  529. >Multi-Byte String Functions</A
  530. ></DT
  531. ><DT
  532. >LIII. <A
  533. HREF="#ref.mcal"
  534. >MCAL functions</A
  535. ></DT
  536. ><DT
  537. >LIV. <A
  538. HREF="#ref.mcrypt"
  539. >Mcrypt Encryption Functions</A
  540. ></DT
  541. ><DT
  542. >LV. <A
  543. HREF="#ref.mcve"
  544. >MCVE Payment Functions</A
  545. ></DT
  546. ><DT
  547. >LVI. <A
  548. HREF="#ref.mhash"
  549. >Mhash funkce</A
  550. ></DT
  551. ><DT
  552. >LVII. <A
  553. HREF="#ref.mime-magic"
  554. >Mimetype Functions</A
  555. ></DT
  556. ><DT
  557. >LVIII. <A
  558. HREF="#ref.mssql"
  559. >Microsoft SQL Server functions</A
  560. ></DT
  561. ><DT
  562. >LIX. <A
  563. HREF="#ref.ming"
  564. >Ming functions for Flash</A
  565. ></DT
  566. ><DT
  567. >LX. <A
  568. HREF="#ref.misc"
  569. >R∙znΘ funkce</A
  570. ></DT
  571. ><DT
  572. >LXI. <A
  573. HREF="#ref.mnogo"
  574. >mnoGoSearch Functions</A
  575. ></DT
  576. ><DT
  577. >LXII. <A
  578. HREF="#ref.msql"
  579. >mSQL functions</A
  580. ></DT
  581. ><DT
  582. >LXIII. <A
  583. HREF="#ref.mysql"
  584. >MySQL funkce</A
  585. ></DT
  586. ><DT
  587. >LXIV. <A
  588. HREF="#ref.mysqli"
  589. >Improved MySQL Extension</A
  590. ></DT
  591. ><DT
  592. >LXV. <A
  593. HREF="#ref.msession"
  594. >Mohawk Software session handler functions</A
  595. ></DT
  596. ><DT
  597. >LXVI. <A
  598. HREF="#ref.muscat"
  599. >muscat functions</A
  600. ></DT
  601. ><DT
  602. >LXVII. <A
  603. HREF="#ref.network"
  604. >Sφ╗ovΘ funkce</A
  605. ></DT
  606. ><DT
  607. >LXVIII. <A
  608. HREF="#ref.ncurses"
  609. >Ncurses terminal screen control functions</A
  610. ></DT
  611. ><DT
  612. >LXIX. <A
  613. HREF="#ref.notes"
  614. >Lotus Notes functions</A
  615. ></DT
  616. ><DT
  617. >LXX. <A
  618. HREF="#ref.nsapi"
  619. >NSAPI-specific Functions</A
  620. ></DT
  621. ><DT
  622. >LXXI. <A
  623. HREF="#ref.odbc"
  624. >Unified ODBC functions</A
  625. ></DT
  626. ><DT
  627. >LXXII. <A
  628. HREF="#ref.objaggregation"
  629. >Object Aggregation/Composition Functions</A
  630. ></DT
  631. ><DT
  632. >LXXIII. <A
  633. HREF="#ref.oci8"
  634. >Oracle 8 functions</A
  635. ></DT
  636. ><DT
  637. >LXXIV. <A
  638. HREF="#ref.openssl"
  639. >OpenSSL funkce</A
  640. ></DT
  641. ><DT
  642. >LXXV. <A
  643. HREF="#ref.oracle"
  644. >Oracle functions</A
  645. ></DT
  646. ><DT
  647. >LXXVI. <A
  648. HREF="#ref.ovrimos"
  649. >Ovrimos SQL functions</A
  650. ></DT
  651. ><DT
  652. >LXXVII. <A
  653. HREF="#ref.outcontrol"
  654. >Funkce pro °φzenφ v²stupu</A
  655. ></DT
  656. ><DT
  657. >LXXVIII. <A
  658. HREF="#ref.overload"
  659. >Object property and method call overloading</A
  660. ></DT
  661. ><DT
  662. >LXXIX. <A
  663. HREF="#ref.pdf"
  664. >PDF funkce</A
  665. ></DT
  666. ><DT
  667. >LXXX. <A
  668. HREF="#ref.pfpro"
  669. >Funkce pro prßci s Verisign Payflow Pro</A
  670. ></DT
  671. ><DT
  672. >LXXXI. <A
  673. HREF="#ref.info"
  674. >PHP volby a informace</A
  675. ></DT
  676. ><DT
  677. >LXXXII. <A
  678. HREF="#ref.posix"
  679. >POSIX functions</A
  680. ></DT
  681. ><DT
  682. >LXXXIII. <A
  683. HREF="#ref.pgsql"
  684. >PostgreSQL functions</A
  685. ></DT
  686. ><DT
  687. >LXXXIV. <A
  688. HREF="#ref.pcntl"
  689. >Process Control Functions</A
  690. ></DT
  691. ><DT
  692. >LXXXV. <A
  693. HREF="#ref.exec"
  694. >Funkce spou╣t∞nφ program∙</A
  695. ></DT
  696. ><DT
  697. >LXXXVI. <A
  698. HREF="#ref.printer"
  699. >Printer functions</A
  700. ></DT
  701. ><DT
  702. >LXXXVII. <A
  703. HREF="#ref.pspell"
  704. >Pspell Functions</A
  705. ></DT
  706. ><DT
  707. >LXXXVIII. <A
  708. HREF="#ref.readline"
  709. >GNU Readline</A
  710. ></DT
  711. ><DT
  712. >LXXXIX. <A
  713. HREF="#ref.recode"
  714. >GNU Recode funkce</A
  715. ></DT
  716. ><DT
  717. >XC. <A
  718. HREF="#ref.pcre"
  719. >Regular Expression Functions (Perl-Compatible)</A
  720. ></DT
  721. ><DT
  722. >XCI. <A
  723. HREF="#ref.qtdom"
  724. >qtdom functions</A
  725. ></DT
  726. ><DT
  727. >XCII. <A
  728. HREF="#ref.regex"
  729. >Regular Expression Functions (POSIX Extended)</A
  730. ></DT
  731. ><DT
  732. >XCIII. <A
  733. HREF="#ref.sem"
  734. >Semaphore, Shared Memory and IPC Functions</A
  735. ></DT
  736. ><DT
  737. >XCIV. <A
  738. HREF="#ref.sesam"
  739. >SESAM database functions</A
  740. ></DT
  741. ><DT
  742. >XCV. <A
  743. HREF="#ref.session"
  744. >Session handling functions</A
  745. ></DT
  746. ><DT
  747. >XCVI. <A
  748. HREF="#ref.shmop"
  749. >Funkce pro prßci se sdφlenou pam∞tφ</A
  750. ></DT
  751. ><DT
  752. >XCVII. <A
  753. HREF="#ref.sqlite"
  754. >SQLite</A
  755. ></DT
  756. ><DT
  757. >XCVIII. <A
  758. HREF="#ref.swf"
  759. >Shockwave Flash functions</A
  760. ></DT
  761. ><DT
  762. >XCIX. <A
  763. HREF="#ref.snmp"
  764. >SNMP functions</A
  765. ></DT
  766. ><DT
  767. >C. <A
  768. HREF="#ref.sockets"
  769. >Socket functions</A
  770. ></DT
  771. ><DT
  772. >CI. <A
  773. HREF="#ref.stream"
  774. >Stream functions</A
  775. ></DT
  776. ><DT
  777. >CII. <A
  778. HREF="#ref.strings"
  779. >Funkce pro prßci s °et∞zci</A
  780. ></DT
  781. ><DT
  782. >CIII. <A
  783. HREF="#ref.sybase"
  784. >Sybase functions</A
  785. ></DT
  786. ><DT
  787. >CIV. <A
  788. HREF="#ref.tidy"
  789. >tidy Functions</A
  790. ></DT
  791. ><DT
  792. >CV. <A
  793. HREF="#ref.tokenizer"
  794. >Tokenizer functions</A
  795. ></DT
  796. ><DT
  797. >CVI. <A
  798. HREF="#ref.url"
  799. >URL funkce</A
  800. ></DT
  801. ><DT
  802. >CVII. <A
  803. HREF="#ref.variables"
  804. >Variable Functions</A
  805. ></DT
  806. ><DT
  807. >CVIII. <A
  808. HREF="#ref.vpopmail"
  809. >vpopmail functions</A
  810. ></DT
  811. ><DT
  812. >CIX. <A
  813. HREF="#ref.w32api"
  814. >W32api functions</A
  815. ></DT
  816. ><DT
  817. >CX. <A
  818. HREF="#ref.wddx"
  819. >WDDX funkce</A
  820. ></DT
  821. ><DT
  822. >CXI. <A
  823. HREF="#ref.xml"
  824. >XML parser functions</A
  825. ></DT
  826. ><DT
  827. >CXII. <A
  828. HREF="#ref.xmlrpc"
  829. >XML-RPC functions</A
  830. ></DT
  831. ><DT
  832. >CXIII. <A
  833. HREF="#ref.xslt"
  834. >XSLT funkce</A
  835. ></DT
  836. ><DT
  837. >CXIV. <A
  838. HREF="#ref.yaz"
  839. >YAZ functions</A
  840. ></DT
  841. ><DT
  842. >CXV. <A
  843. HREF="#ref.nis"
  844. >Funkce pro prßci s YP/NIS</A
  845. ></DT
  846. ><DT
  847. >CXVI. <A
  848. HREF="#ref.zip"
  849. >Zip File Functions (Read Only Access)</A
  850. ></DT
  851. ><DT
  852. >CXVII. <A
  853. HREF="#ref.zlib"
  854. >Zlib Compression Functions</A
  855. ></DT
  856. ></DL
  857. ></DD
  858. ><DT
  859. >VI. <A
  860. HREF="#zend"
  861. >Zend API</A
  862. ></DT
  863. ><DD
  864. ><DL
  865. ><DT
  866. >24. <A
  867. HREF="#zend.overview"
  868. >Overview</A
  869. ></DT
  870. ><DT
  871. >25. <A
  872. HREF="#zend.possibilities"
  873. >Extension Possibilities</A
  874. ></DT
  875. ><DT
  876. >26. <A
  877. HREF="#zend.layout"
  878. >Source Layout</A
  879. ></DT
  880. ><DT
  881. >27. <A
  882. HREF="#zend.build"
  883. >PHP's Automatic Build System</A
  884. ></DT
  885. ><DT
  886. >28. <A
  887. HREF="#zend.creating"
  888. >Creating Extensions</A
  889. ></DT
  890. ><DT
  891. >29. <A
  892. HREF="#zend.using"
  893. >Using Extensions</A
  894. ></DT
  895. ><DT
  896. >30. <A
  897. HREF="#zend.troubleshooting"
  898. >Troubleshooting</A
  899. ></DT
  900. ><DT
  901. >31. <A
  902. HREF="#zend.structure"
  903. >Source Discussion</A
  904. ></DT
  905. ><DT
  906. >32. <A
  907. HREF="#zend.arguments"
  908. >Accepting Arguments</A
  909. ></DT
  910. ><DT
  911. >33. <A
  912. HREF="#zend.variables"
  913. >Creating Variables</A
  914. ></DT
  915. ><DT
  916. >34. <A
  917. HREF="#zend.copy-constructor"
  918. >Duplicating Variable Contents: The Copy Constructor</A
  919. ></DT
  920. ><DT
  921. >35. <A
  922. HREF="#zend.returning"
  923. >Returning Values</A
  924. ></DT
  925. ><DT
  926. >36. <A
  927. HREF="#zend.printing"
  928. >Printing Information</A
  929. ></DT
  930. ><DT
  931. >37. <A
  932. HREF="#zend.startup-and-shutdown"
  933. >Startup and Shutdown Functions</A
  934. ></DT
  935. ><DT
  936. >38. <A
  937. HREF="#zend.calling-user-functions"
  938. >Calling User Functions</A
  939. ></DT
  940. ><DT
  941. >39. <A
  942. HREF="#zend.ini-file-support"
  943. >Initialization File Support</A
  944. ></DT
  945. ><DT
  946. >40. <A
  947. HREF="#zend.where-to-go"
  948. >Where to Go from Here</A
  949. ></DT
  950. ><DT
  951. >41. <A
  952. HREF="#zend.configuration-macros"
  953. >Reference: Some Configuration Macros</A
  954. ></DT
  955. ><DT
  956. >42. <A
  957. HREF="#zend.api-macros"
  958. >API Macros</A
  959. ></DT
  960. ></DL
  961. ></DD
  962. ><DT
  963. >VII. <A
  964. HREF="#api"
  965. >PHP API: Interfaces for extension writers</A
  966. ></DT
  967. ><DD
  968. ><DL
  969. ><DT
  970. >43. <A
  971. HREF="#streams"
  972. >Streams API for PHP Extension Authors</A
  973. ></DT
  974. ></DL
  975. ></DD
  976. ><DT
  977. >VIII. <A
  978. HREF="#faq"
  979. >FAQ: ╚asto zodpovφdanΘ otßzky</A
  980. ></DT
  981. ><DD
  982. ><DL
  983. ><DT
  984. >44. <A
  985. HREF="#faq.general"
  986. >ObecnΘ informace</A
  987. ></DT
  988. ><DT
  989. >45. <A
  990. HREF="#faq.mailinglist"
  991. >E-mailovΘ konference (mailing lists)</A
  992. ></DT
  993. ><DT
  994. >46. <A
  995. HREF="#faq.obtaining"
  996. >Zφskßnφ PHP</A
  997. ></DT
  998. ><DT
  999. >47. <A
  1000. HREF="#faq.databases"
  1001. >Zßle╛itosti databßzφ</A
  1002. ></DT
  1003. ><DT
  1004. >48. <A
  1005. HREF="#faq.installation"
  1006. >Instalace</A
  1007. ></DT
  1008. ><DT
  1009. >49. <A
  1010. HREF="#faq.build"
  1011. >Sestavovacφ (kompilaΦnφ) problΘmy</A
  1012. ></DT
  1013. ><DT
  1014. >50. <A
  1015. HREF="#faq.using"
  1016. >Pou╛φvßnφ PHP</A
  1017. ></DT
  1018. ><DT
  1019. >51. <A
  1020. HREF="#faq.html"
  1021. >PHP a HTML</A
  1022. ></DT
  1023. ><DT
  1024. >52. <A
  1025. HREF="#faq.com"
  1026. >PHP a COM</A
  1027. ></DT
  1028. ><DT
  1029. >53. <A
  1030. HREF="#faq.languages"
  1031. >PHP a jinΘ jazyky</A
  1032. ></DT
  1033. ><DT
  1034. >54. <A
  1035. HREF="#faq.migration"
  1036. >P°echod z PHP 2 na PHP 3</A
  1037. ></DT
  1038. ><DT
  1039. >55. <A
  1040. HREF="#faq.migration4"
  1041. >P°echod z PHP 3 na PHP 4</A
  1042. ></DT
  1043. ><DT
  1044. >56. <A
  1045. HREF="#faq.misc"
  1046. >Ostatnφ otßzky</A
  1047. ></DT
  1048. ></DL
  1049. ></DD
  1050. ><DT
  1051. >IX. <A
  1052. HREF="#appendixes"
  1053. >Dodatky</A
  1054. ></DT
  1055. ><DD
  1056. ><DL
  1057. ><DT
  1058. >A. <A
  1059. HREF="#history"
  1060. >Historie PHP a souvisejφcφch projekt∙</A
  1061. ></DT
  1062. ><DT
  1063. >B. <A
  1064. HREF="#migration4"
  1065. >P°echod z PHP 3 na PHP 4</A
  1066. ></DT
  1067. ><DT
  1068. >C. <A
  1069. HREF="#migration"
  1070. >P°echod z PHP/FI 2 na PHP 3</A
  1071. ></DT
  1072. ><DT
  1073. >D. <A
  1074. HREF="#debugger"
  1075. >Lad∞nφ (debugging) PHP</A
  1076. ></DT
  1077. ><DT
  1078. >E. <A
  1079. HREF="#phpdevel"
  1080. >Extending PHP 3</A
  1081. ></DT
  1082. ><DT
  1083. >F. <A
  1084. HREF="#aliases"
  1085. >Seznam alias∙ funkcφ</A
  1086. ></DT
  1087. ><DT
  1088. >G. <A
  1089. HREF="#reserved"
  1090. >Seznam vyhrazen²ch slov</A
  1091. ></DT
  1092. ><DT
  1093. >H. <A
  1094. HREF="#resource"
  1095. >List of Resource Types</A
  1096. ></DT
  1097. ><DT
  1098. >I. <A
  1099. HREF="#wrappers"
  1100. >List of Supported Protocols/Wrappers</A
  1101. ></DT
  1102. ><DT
  1103. >J. <A
  1104. HREF="#transports"
  1105. >List of Supported Socket Transports</A
  1106. ></DT
  1107. ><DT
  1108. >K. <A
  1109. HREF="#types.comparisons"
  1110. >PHP type comparison tables</A
  1111. ></DT
  1112. ><DT
  1113. >L. <A
  1114. HREF="#tokens"
  1115. >List of Parser Tokens</A
  1116. ></DT
  1117. ><DT
  1118. >M. <A
  1119. HREF="#about"
  1120. >O tomto manußlu</A
  1121. ></DT
  1122. ><DT
  1123. >N. <A
  1124. HREF="#opl.license"
  1125. >Open Publication License</A
  1126. ></DT
  1127. ><DT
  1128. >O. <A
  1129. HREF="#indexes"
  1130. >Rejst°φk funkcφ</A
  1131. ></DT
  1132. ><DT
  1133. >P. <A
  1134. HREF="#missing-stuff"
  1135. >Co zde chybφ</A
  1136. ></DT
  1137. ></DL
  1138. ></DD
  1139. ></DL
  1140. ></DIV
  1141. ><DIV
  1142. CLASS="preface"
  1143. ><HR><H1
  1144. ><A
  1145. NAME="preface"
  1146. >P°edmluva</A
  1147. ></H1
  1148. ><BLOCKQUOTE
  1149. CLASS="ABSTRACT"
  1150. ><DIV
  1151. CLASS="abstract"
  1152. ><A
  1153. NAME="AEN53"
  1154. ></A
  1155. ><P
  1156. ></P
  1157. ><P
  1158. >     <SPAN
  1159. CLASS="acronym"
  1160. >PHP</SPAN
  1161. >, co╛ znamenß "PHP: Hypertext
  1162.     Preprocessor", je ╣iroce pou╛φvan² mnoho·Φelov² skriptovacφ jazyk,
  1163.     ╣φ°en² pod Open Source licencφ, zvlß╣╗ vhodn² pro v²voj WWW aplikacφ a
  1164.     zp∙sobil² pro vklßdßnφ do HTML. Velkß Φßst jeho syntaxe je vyp∙jΦenß z C,
  1165.     Javy a Perlu. Cφlem tohoto jazyka je je umo╛nit webov²m v²vojß°um rychle
  1166.     psßt dynamicky generovanΘ strßnky - ale s PHP m∙╛ete d∞lat mnohem vφc!
  1167.    </P
  1168. ><P
  1169. ></P
  1170. ></DIV
  1171. ></BLOCKQUOTE
  1172. ><P
  1173. >    Tento manußl je tvo°en p°edev╣φm referenΦnφ p°φruΦkou funkcφ, ale obsahuje
  1174.    takΘ refereΦnφ p°φruΦku jazyka, vysv∞tlenφ hlavnφch vlastnostφ a mo╛nostφ
  1175.    PHP a r∙znΘ dopl≥kovΘ informace.
  1176.   </P
  1177. ><P
  1178. >    Manußl si m∙╛ete stßhnout v r∙zn²ch formßtech na
  1179.    <A
  1180. HREF="http://www.php.net/docs.php"
  1181. TARGET="_top"
  1182. >http://www.php.net/docs.php</A
  1183. >. Soubory ke sta╛enφ
  1184.    se aktualizujφ v╛dy p°i zm∞n∞ obsahu. Vφce informacφ o tom, jak je tento
  1185.    manußl vytvß°en, najdete v dodatku
  1186.    <A
  1187. HREF="#about"
  1188. >'O manußlu'</A
  1189. >.
  1190.   </P
  1191. ></DIV
  1192. ><DIV
  1193. CLASS="PART"
  1194. ><A
  1195. NAME="getting-started"
  1196. ></A
  1197. ><DIV
  1198. CLASS="TITLEPAGE"
  1199. ><H1
  1200. CLASS="title"
  1201. >I. ZaΦφnßme</H1
  1202. ><DIV
  1203. CLASS="TOC"
  1204. ><DL
  1205. ><DT
  1206. ><B
  1207. >Obsah</B
  1208. ></DT
  1209. ><DT
  1210. >1. <A
  1211. HREF="#introduction"
  1212. >Introduction</A
  1213. ></DT
  1214. ><DT
  1215. >2. <A
  1216. HREF="#tutorial"
  1217. >A simple tutorial</A
  1218. ></DT
  1219. ><DT
  1220. >3. <A
  1221. HREF="#installation"
  1222. >Instalace</A
  1223. ></DT
  1224. ><DT
  1225. >4. <A
  1226. HREF="#configuration"
  1227. >Runtime Configuration</A
  1228. ></DT
  1229. ></DL
  1230. ></DIV
  1231. ></DIV
  1232. ><DIV
  1233. CLASS="chapter"
  1234. ><HR><H1
  1235. ><A
  1236. NAME="introduction"
  1237. >Kapitola 1. Introduction</A
  1238. ></H1
  1239. ><DIV
  1240. CLASS="sect1"
  1241. ><H2
  1242. CLASS="sect1"
  1243. ><A
  1244. NAME="intro-whatis"
  1245. ></A
  1246. >What is PHP?</H2
  1247. ><P
  1248. >     <SPAN
  1249. CLASS="acronym"
  1250. >PHP</SPAN
  1251. > (recursive acronym for "PHP: Hypertext
  1252.     Preprocessor") is a widely-used Open Source general-purpose
  1253.     scripting language that is especially suited for Web
  1254.     development and can be embedded into HTML.
  1255.    </P
  1256. ><P
  1257. >     Simple answer, but what does that mean? An example:
  1258.    </P
  1259. ><P
  1260. >     <TABLE
  1261. WIDTH="100%"
  1262. BORDER="0"
  1263. CELLPADDING="0"
  1264. CELLSPACING="0"
  1265. CLASS="EXAMPLE"
  1266. ><TR
  1267. ><TD
  1268. ><DIV
  1269. CLASS="example"
  1270. ><A
  1271. NAME="AEN70"
  1272. ></A
  1273. ><P
  1274. ><B
  1275. >P°φklad 1-1. An introductory example</B
  1276. ></P
  1277. ><TABLE
  1278. BORDER="0"
  1279. BGCOLOR="#E0E0E0"
  1280. CELLPADDING="5"
  1281. ><TR
  1282. ><TD
  1283. ><PRE
  1284. CLASS="php"
  1285. ><html>
  1286.     <head>
  1287.         <title>Example</title>
  1288.     </head>
  1289.     <body>
  1290.  
  1291.         <?php 
  1292.         echo "Hi, I'm a PHP script!"; 
  1293.         ?>
  1294.  
  1295.     </body>
  1296. </html></PRE
  1297. ></TD
  1298. ></TR
  1299. ></TABLE
  1300. ></DIV
  1301. ></TD
  1302. ></TR
  1303. ></TABLE
  1304. >
  1305.    </P
  1306. ><P
  1307. >     Notice how this is different from a script written in other
  1308.     languages like Perl or C -- instead of writing a program with lots
  1309.     of commands to output HTML, you write an HTML script with some
  1310.     embedded code to do something (in this case, output some
  1311.     text). The PHP code is enclosed in special <A
  1312. HREF="#language.basic-syntax.phpmode"
  1313. >start and end tags</A
  1314. >
  1315.     that allow you to jump into and out of "PHP mode".
  1316.    </P
  1317. ><P
  1318. >     What distinguishes PHP from something like client-side JavaScript
  1319.     is that the code is executed on the server. If you were to have a
  1320.     script similar to the above on your server, the client would receive
  1321.     the results of running that script, with no way of determining what
  1322.     the underlying code may be. You can even configure your web server
  1323.     to process all your HTML files with PHP, and then there's really no
  1324.     way that users can tell what you have up your sleeve.
  1325.    </P
  1326. ><P
  1327. >     The best things in using PHP are that it is extremely simple
  1328.     for a newcomer, but offers many advanced features for
  1329.     a professional programmer. Don't be afraid reading the long
  1330.     list of PHP's features. You can jump in, in a short time, and
  1331.     start writing simple scripts in a few hours.
  1332.    </P
  1333. ><P
  1334. >     Although PHP's development is focused on server-side scripting,
  1335.     you can do much more with it. Read on, and see more in the
  1336.     <A
  1337. HREF="#intro-whatcando"
  1338. >What can PHP do?</A
  1339. > section.
  1340.    </P
  1341. ></DIV
  1342. ><DIV
  1343. CLASS="sect1"
  1344. ><HR><H2
  1345. CLASS="sect1"
  1346. ><A
  1347. NAME="intro-whatcando"
  1348. ></A
  1349. >What can PHP do?</H2
  1350. ><P
  1351. >     Anything. PHP is mainly focused on server-side scripting,
  1352.     so you can do anything any other CGI program can do, such
  1353.     as collect form data, generate dynamic page content, or
  1354.     send and receive cookies. But PHP can do much more.
  1355.    </P
  1356. ><P
  1357. >     There are three main fields where PHP scripts are used.
  1358.     <P
  1359. ></P
  1360. ><UL
  1361. ><LI
  1362. ><P
  1363. >        Server-side scripting. This is the most traditional
  1364.        and main target field for PHP. You need three things
  1365.        to make this work. The PHP parser (CGI or server
  1366.        module), a webserver and a web browser. You need to
  1367.        run the webserver, with a connected PHP installation.
  1368.        You can access the PHP program output with a web browser,
  1369.        viewing the PHP page through the server. See the
  1370.        <A
  1371. HREF="#installation"
  1372. >installation instructions</A
  1373. >
  1374.        section for more information.
  1375.       </P
  1376. ></LI
  1377. ><LI
  1378. ><P
  1379. >        Command line scripting. You can make a PHP script
  1380.        to run it without any server or browser.
  1381.        You only need the PHP parser to use it this way.
  1382.        This type of usage is ideal for scripts regularly
  1383.        executed using cron (on *nix or Linux) or Task Scheduler (on
  1384.        Windows). These scripts can also be used for simple text
  1385.        processing tasks. See the section about 
  1386.        <A
  1387. HREF="#features.commandline"
  1388. >Command line usage of PHP</A
  1389. >
  1390.        for more information.
  1391.       </P
  1392. ></LI
  1393. ><LI
  1394. ><P
  1395. >        Writing client-side GUI applications. PHP is probably
  1396.        not the very best language to write windowing
  1397.        applications, but if you know PHP very well, and
  1398.        would like to use some advanced PHP features in
  1399.        your client-side applications you can also use
  1400.        PHP-GTK to write such programs. You also have the
  1401.        ability to write cross-platform applications this way.
  1402.        PHP-GTK is an extension to PHP, not available in
  1403.        the main distribution. If you are interested
  1404.        in PHP-GTK, visit <A
  1405. HREF="http://gtk.php.net/"
  1406. TARGET="_top"
  1407. >its
  1408.        own website</A
  1409. >.
  1410.       </P
  1411. ></LI
  1412. ></UL
  1413. >
  1414.    </P
  1415. ><P
  1416. >     PHP can be used on all major operating systems, including
  1417.     Linux, many Unix variants (including HP-UX, Solaris and OpenBSD),
  1418.     Microsoft Windows, Mac OS X, RISC OS, and probably others.
  1419.     PHP has also support for most of the web servers today. This
  1420.     includes Apache, Microsoft Internet Information Server,
  1421.     Personal Web Server, Netscape and iPlanet servers, Oreilly
  1422.     Website Pro server, Caudium, Xitami, OmniHTTPd, and many
  1423.     others. For the majority of the servers PHP has a module,
  1424.     for the others supporting the CGI standard, PHP can work
  1425.     as a CGI processor.
  1426.    </P
  1427. ><P
  1428. >     So with PHP, you have the freedom of choosing an operating
  1429.     system and a web server. Furthermore, you also have the choice
  1430.     of using procedural programming or object oriented
  1431.     programming, or a mixture of them. Although not every
  1432.     standard OOP feature is realized in the current version
  1433.     of PHP, many code libraries and large applications (including the
  1434.     PEAR library) are written only using OOP code.
  1435.    </P
  1436. ><P
  1437. >     With PHP you are not limited to output HTML. PHP's abilities
  1438.     includes outputting images, PDF files and even Flash movies
  1439.     (using libswf and Ming) generated on the fly. You can also
  1440.     output easily any text, such as XHTML and any other XML file.
  1441.     PHP can autogenerate these files, and save them in the file
  1442.     system, instead of printing it out, forming a server-side
  1443.     cache for your dynamic content.
  1444.    </P
  1445. ><P
  1446. >     One of the strongest and most significant feature in PHP is its
  1447.     support for a wide range of databases. Writing a database-enabled
  1448.     web page is incredibly simple. The following databases are currently
  1449.     supported:
  1450.     <A
  1451. NAME="AEN97"
  1452. ></A
  1453. ><BLOCKQUOTE
  1454. CLASS="BLOCKQUOTE"
  1455. ><P
  1456. ></P
  1457. ><TABLE
  1458. BORDER="0"
  1459. ><TBODY
  1460. ><TR
  1461. ><TD
  1462. >Adabas D</TD
  1463. ><TD
  1464. >Ingres</TD
  1465. ><TD
  1466. >Oracle (OCI7 and OCI8)</TD
  1467. ></TR
  1468. ><TR
  1469. ><TD
  1470. >dBase</TD
  1471. ><TD
  1472. >InterBase</TD
  1473. ><TD
  1474. >Ovrimos</TD
  1475. ></TR
  1476. ><TR
  1477. ><TD
  1478. >Empress</TD
  1479. ><TD
  1480. >FrontBase</TD
  1481. ><TD
  1482. >PostgreSQL</TD
  1483. ></TR
  1484. ><TR
  1485. ><TD
  1486. >FilePro (read-only)</TD
  1487. ><TD
  1488. >mSQL</TD
  1489. ><TD
  1490. >Solid</TD
  1491. ></TR
  1492. ><TR
  1493. ><TD
  1494. >Hyperwave</TD
  1495. ><TD
  1496. >Direct MS-SQL</TD
  1497. ><TD
  1498. >Sybase</TD
  1499. ></TR
  1500. ><TR
  1501. ><TD
  1502. >IBM DB2</TD
  1503. ><TD
  1504. >MySQL</TD
  1505. ><TD
  1506. >Velocis</TD
  1507. ></TR
  1508. ><TR
  1509. ><TD
  1510. >Informix</TD
  1511. ><TD
  1512. >ODBC</TD
  1513. ><TD
  1514. >Unix dbm</TD
  1515. ></TR
  1516. ></TBODY
  1517. ></TABLE
  1518. ><P
  1519. ></P
  1520. ></BLOCKQUOTE
  1521. >
  1522.     We also have a DBX database abstraction extension allowing you
  1523.     to transparently use any database supported by that extension.
  1524.     Additionally PHP supports ODBC, the Open Database Connection
  1525.     standard, so you can connect to any other database supporting
  1526.     this world standard.
  1527.    </P
  1528. ><P
  1529. >     PHP also has support for talking to other services using protocols
  1530.     such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and
  1531.     countless others. You can also open raw network sockets and
  1532.     interact using any other protocol. PHP has support for the WDDX
  1533.     complex data exchange between virtually all Web programming
  1534.     languages. Talking about interconnection, PHP has support for
  1535.     instantiation of Java objects and using them transparently
  1536.     as PHP objects. You can also use our CORBA extension to
  1537.     access remote objects.
  1538.    </P
  1539. ><P
  1540. >     PHP has extremely useful text processing features, from the
  1541.     POSIX Extended or Perl regular expressions to parsing XML
  1542.     documents. For parsing and accessing XML documents, we
  1543.     support the SAX and DOM standards. You can use our XSLT
  1544.     extension to transform XML documents.
  1545.    </P
  1546. ><P
  1547. >     While using PHP in the e-commerce field, you'll find
  1548.     the Cybercash payment, CyberMUT, VeriSign Payflow
  1549.     Pro and CCVS functions useful for your online payment
  1550.     programs.
  1551.    </P
  1552. ><P
  1553. >     At last but not least, we have many other interesting
  1554.     extensions, the mnoGoSearch search engine functions,
  1555.     the IRC Gateway functions, many compression utilities
  1556.     (gzip, bz2), calendar conversion, translation...
  1557.    </P
  1558. ><P
  1559. >     As you can see this page is not enough to list all
  1560.     the features and benefits PHP can offer. Read on in
  1561.     the sections about <A
  1562. HREF="#installation"
  1563. >installing
  1564.     PHP</A
  1565. >, and see the <A
  1566. HREF="#funcref"
  1567. >function
  1568.     reference</A
  1569. > part for explanation of the extensions
  1570.     mentioned here.
  1571.    </P
  1572. ></DIV
  1573. ></DIV
  1574. ><DIV
  1575. CLASS="chapter"
  1576. ><HR><H1
  1577. ><A
  1578. NAME="tutorial"
  1579. >Kapitola 2. A simple tutorial</A
  1580. ></H1
  1581. ><P
  1582. >    Here we would like to show the very basics of PHP in a short, simple
  1583.    tutorial. This text only deals with dynamic webpage creation with
  1584.    PHP, though PHP is not only capable of creating webpages. See
  1585.    the section titled <A
  1586. HREF="#intro-whatcando"
  1587. >What can PHP
  1588.    do</A
  1589. > for more information.
  1590.   </P
  1591. ><P
  1592. >    PHP-enabled web pages are treated just like regular HTML pages and
  1593.    you can create and edit them the same way you normally create
  1594.    regular HTML pages.
  1595.   </P
  1596. ><DIV
  1597. CLASS="sect1"
  1598. ><HR><H2
  1599. CLASS="sect1"
  1600. ><A
  1601. NAME="tutorial.requirements"
  1602. ></A
  1603. >What do I need?</H2
  1604. ><P
  1605. >     In this tutorial we assume that your server has activated support 
  1606.     for PHP and that all files ending in <TT
  1607. CLASS="filename"
  1608. >.php</TT
  1609. >
  1610.     are handled by PHP. On most servers, this is the default extension
  1611.     for PHP files, but ask your server administrator to be sure. If
  1612.     your server supports PHP, then you do not need to do anything. Just
  1613.     create your <TT
  1614. CLASS="filename"
  1615. >.php</TT
  1616. > files, put them in your
  1617.     web directory and the server will automatically parse them for you.
  1618.     There is no need to compile anything nor do you need to install
  1619.     any extra tools. Think of these PHP-enabled files as simple HTML
  1620.     files with a whole new family of magical tags that let you do all
  1621.     sorts of things.  Most web hosts offer PHP support, but if your
  1622.     host does not consider reading the <A
  1623. HREF="http://www.php.net/links.php"
  1624. TARGET="_top"
  1625. >     PHP Links</A
  1626. > section for resources on finding PHP enabled
  1627.     web hosts.
  1628.    </P
  1629. ><P
  1630. >     Let us say you want to save precious bandwidth and develop locally.  
  1631.     In this case, you will want to install a web server, such as 
  1632.     <A
  1633. HREF="#install.apache"
  1634. >Apache</A
  1635. >, and of course 
  1636.     <A
  1637. HREF="http://www.php.net/downloads.php"
  1638. TARGET="_top"
  1639. >PHP</A
  1640. >.  You will most likely 
  1641.     want to install a database as well, such as 
  1642.     <A
  1643. HREF="http://www.mysql.com/documentation/"
  1644. TARGET="_top"
  1645. >MySQL</A
  1646. >.  You can either install 
  1647.     these individually or choose a simpler way. <A
  1648. HREF="http://www.hotscripts.com/PHP/Software_and_Servers/Installation_Kits/"
  1649. TARGET="_top"
  1650. >Locate a pre-configured package</A
  1651.     which automatically installs all of these with just a few mouse
  1652.     clicks.  It is easy to setup a web server with PHP support on
  1653.     any operating system, including Linux and Windows.  On Linux,
  1654.     you may find <A
  1655. HREF="http://www.rpmfind.net/"
  1656. TARGET="_top"
  1657. >rpmfind</A
  1658. > and
  1659.     <A
  1660. HREF="http://rpm.pbone.net/"
  1661. TARGET="_top"
  1662. >PBone</A
  1663. > helpful for
  1664.     locating RPMs.
  1665.    </P
  1666. ></DIV
  1667. ><DIV
  1668. CLASS="sect1"
  1669. ><HR><H2
  1670. CLASS="sect1"
  1671. ><A
  1672. NAME="tutorial.firstpage"
  1673. ></A
  1674. >Your first PHP-enabled page</H2
  1675. ><P
  1676. >     Create a file named <TT
  1677. CLASS="filename"
  1678. >hello.php</TT
  1679. > and put it
  1680.     in your web servers root directory (<TT
  1681. CLASS="varname"
  1682. >DOCUMENT_ROOT</TT
  1683. >) 
  1684.     with the following content:
  1685.    </P
  1686. ><P
  1687. >     <TABLE
  1688. WIDTH="100%"
  1689. BORDER="0"
  1690. CELLPADDING="0"
  1691. CELLSPACING="0"
  1692. CLASS="EXAMPLE"
  1693. ><TR
  1694. ><TD
  1695. ><DIV
  1696. CLASS="example"
  1697. ><A
  1698. NAME="AEN151"
  1699. ></A
  1700. ><P
  1701. ><B
  1702. >P°φklad 2-1. Our first PHP script: <TT
  1703. CLASS="filename"
  1704. >hello.php</TT
  1705. ></B
  1706. ></P
  1707. ><TABLE
  1708. BORDER="0"
  1709. BGCOLOR="#E0E0E0"
  1710. CELLPADDING="5"
  1711. ><TR
  1712. ><TD
  1713. ><PRE
  1714. CLASS="php"
  1715. ><html>
  1716.  <head>
  1717.   <title>PHP Test</title>
  1718.  </head>
  1719.  <body>
  1720.  <?php echo "<p>Hello World</p>"; ?>
  1721.  </body>
  1722. </html></PRE
  1723. ></TD
  1724. ></TR
  1725. ></TABLE
  1726. ><P
  1727. >       Use your browser to access the file with your web access URL, ending
  1728.       with the "/hello.php" file reference.  When developing locally this
  1729.       url will be something like <TT
  1730. CLASS="literal"
  1731. >http://localhost/hello.php</TT
  1732.       or <TT
  1733. CLASS="literal"
  1734. >http://127.0.0.1/hello.php</TT
  1735. > but this depends on the
  1736.       web servers configuration.  Although this is outside the scope of this
  1737.       tutorial, see also the <TT
  1738. CLASS="varname"
  1739. >DocumentRoot</TT
  1740. > and
  1741.       <TT
  1742. CLASS="varname"
  1743. >ServerName</TT
  1744. > directives in your web server's
  1745.       configuration file (for Apache, this is <TT
  1746. CLASS="filename"
  1747. >httpd.conf</TT
  1748. >).
  1749.       If everything is configured correctly, this file will be parsed by PHP 
  1750.       and the following output will be sent to your browser:
  1751.      </P
  1752. ><TABLE
  1753. BORDER="0"
  1754. BGCOLOR="#E0E0E0"
  1755. CELLPADDING="5"
  1756. ><TR
  1757. ><TD
  1758. ><PRE
  1759. CLASS="html"
  1760. ><html>
  1761.  <head>
  1762.   <title>PHP Test</title>
  1763.  </head>
  1764.  <body>
  1765.  <p>Hello World</p>
  1766.  </body>
  1767. </html></PRE
  1768. ></TD
  1769. ></TR
  1770. ></TABLE
  1771. ></DIV
  1772. ></TD
  1773. ></TR
  1774. ></TABLE
  1775. >
  1776.    </P
  1777. ><P
  1778. >     Note that this is not like a CGI script. The file does not need to be
  1779.     executable or special in any way. Think of it as a normal HTML
  1780.     file which happens to have a set of special tags available to you
  1781.     that do a lot of interesting things.
  1782.    </P
  1783. ><P
  1784. >     This program is extremely simple and you really did not need to use
  1785.     PHP to create a page like this. All it does is display:
  1786.     <TT
  1787. CLASS="literal"
  1788. >Hello World</TT
  1789. > using the PHP <A
  1790. HREF="#function.echo"
  1791. ><B
  1792. CLASS="function"
  1793. >echo()</B
  1794. ></A
  1795. >
  1796.     statement.
  1797.    </P
  1798. ><P
  1799. >     If you tried this example and it did not output anything, or it prompted 
  1800.     for download, or you see the whole file as text, chances are that the 
  1801.     server you are on does not have PHP enabled. Ask your administrator 
  1802.     to enable it for you using the
  1803.     <A
  1804. HREF="#installation"
  1805. >Installation</A
  1806. > chapter 
  1807.     of the manual.  If you are developing locally, also read the
  1808.     installation chapter to make sure everything is configured
  1809.     properly.  If problems continue to persist, do not hesitate to use one of
  1810.     the many <A
  1811. HREF="http://www.php.net/support.php"
  1812. TARGET="_top"
  1813. >PHP support</A
  1814. > options.
  1815.    </P
  1816. ><P
  1817. >     The point of the example is to show the special PHP tag format.
  1818.     In this example we used <TT
  1819. CLASS="literal"
  1820. ><?php</TT
  1821. > to indicate the
  1822.     start of a PHP tag. Then we put the PHP statement and left PHP mode by
  1823.     adding the closing tag, <TT
  1824. CLASS="literal"
  1825. >?></TT
  1826. >. You may jump in
  1827.     and out of PHP mode in an HTML file like this all you want.  For more
  1828.     details, read the manual section on <A
  1829. HREF="#language.basic-syntax"
  1830. >     basic PHP syntax</A
  1831. >.
  1832.    </P
  1833. ><DIV
  1834. CLASS="note"
  1835. ><BLOCKQUOTE
  1836. CLASS="note"
  1837. ><P
  1838. ><B
  1839. >A Note on Text Editors: </B
  1840. >
  1841.      There are many text editors and Integrated Development Environments (IDEs)
  1842.      that you can use to create, edit and manage PHP files. A partial list of 
  1843.      these tools is maintained at <A
  1844. HREF="http://phpeditors.linuxbackup.co.uk/"
  1845. TARGET="_top"
  1846. >PHP Editor's
  1847.      List</A
  1848. >. If you wish to recommend an editor, please visit the above
  1849.      page and ask the page maintainer to add the editor to the list.  Having
  1850.      an editor with syntax highlighting can be helpful.
  1851.     </P
  1852. ></BLOCKQUOTE
  1853. ></DIV
  1854. ><DIV
  1855. CLASS="note"
  1856. ><BLOCKQUOTE
  1857. CLASS="note"
  1858. ><P
  1859. ><B
  1860. >A Note on Word Processors: </B
  1861. >
  1862.      Word processors such as StarOffice Writer, Microsoft Word and Abiword are
  1863.      not optimal for editing PHP files.  If you wish to use one for this 
  1864.      test script, you must ensure that you save the file as PLAIN TEXT or PHP 
  1865.      will not be able to read and execute the script.
  1866.     </P
  1867. ></BLOCKQUOTE
  1868. ></DIV
  1869. ><DIV
  1870. CLASS="note"
  1871. ><BLOCKQUOTE
  1872. CLASS="note"
  1873. ><P
  1874. ><B
  1875. >A Note on Windows Notepad: </B
  1876. >    
  1877.      If you are writing your PHP scripts using Windows Notepad, you will need
  1878.      to ensure that your files are saved with the .php extension. (Notepad adds
  1879.      a .txt extension to files automatically unless you take one of the
  1880.      following steps to prevent it.)  When you save the file and are prompted
  1881.      to provide a name for the file, place the filename in quotes 
  1882.      (i.e. "<TT
  1883. CLASS="filename"
  1884. >hello.php</TT
  1885. >").  Alternately, you can click on the 
  1886.      'Text Documents' drop-down menu in the save dialog box and change the setting 
  1887.      to "All Files". You can then enter your filename without quotes.
  1888.     </P
  1889. ></BLOCKQUOTE
  1890. ></DIV
  1891. ><P
  1892. >    Now that you have successfully created a working PHP script, it is
  1893.    time to create the most famous PHP script!  Make a call to the
  1894.    <A
  1895. HREF="#function.phpinfo"
  1896. ><B
  1897. CLASS="function"
  1898. >phpinfo()</B
  1899. ></A
  1900. > function and you will see a lot of useful
  1901.    information about your system and setup such as available
  1902.    <A
  1903. HREF="#language.variables.predefined"
  1904. >predefined variables</A
  1905. >, 
  1906.    loaded PHP modules, and <A
  1907. HREF="#configuration"
  1908. >configuration</A
  1909. >
  1910.    settings.  Take some time and review this important information.
  1911.   </P
  1912. ></DIV
  1913. ><DIV
  1914. CLASS="sect1"
  1915. ><HR><H2
  1916. CLASS="sect1"
  1917. ><A
  1918. NAME="tutorial.useful"
  1919. ></A
  1920. >Something Useful</H2
  1921. ><P
  1922. >     Let us do something more useful now. We are going to check
  1923.     what sort of browser the visitor is using.
  1924.     For that, we check the user agent string the browser
  1925.     sends as part of the HTTP request. This information is stored in a <A
  1926. HREF="#language.variables"
  1927. >variable</A
  1928. >. Variables always start
  1929.     with a dollar-sign in PHP. The variable we are interested in right now 
  1930.     is <TT
  1931. CLASS="varname"
  1932. >$_SERVER["HTTP_USER_AGENT"]</TT
  1933. >.
  1934.    </P
  1935. ><DIV
  1936. CLASS="note"
  1937. ><BLOCKQUOTE
  1938. CLASS="note"
  1939. ><P
  1940. ><B
  1941. >Poznßmka: </B
  1942. >
  1943.      <A
  1944. HREF="#reserved.variables.server"
  1945. >$_SERVER</A
  1946. > is a 
  1947.      special reserved PHP variable that contains all web server information.
  1948.      It is known as an autoglobal (or superglobal).  See the related manual page on
  1949.      <A
  1950. HREF="#language.variables.superglobals"
  1951. >autoglobals</A
  1952. >
  1953.      for more information.  These special variables were introduced in PHP 
  1954.      <A
  1955. HREF="http://www.php.net/release_4_1_0.php"
  1956. TARGET="_top"
  1957. >4.1.0</A
  1958. >.  Before this time, we used
  1959.      the older <TT
  1960. CLASS="varname"
  1961. >$HTTP_*_VARS</TT
  1962. > arrays instead,
  1963.      such as <TT
  1964. CLASS="varname"
  1965. >$HTTP_SERVER_VARS</TT
  1966. >.  Although deprecated, 
  1967.      these older variables still exist.  (See also the note on
  1968.      <A
  1969. HREF="#tutorial.oldcode"
  1970. >old code</A
  1971. >.)
  1972.     </P
  1973. ></BLOCKQUOTE
  1974. ></DIV
  1975. ><P
  1976. >     To display this variable, you can simply do:
  1977.    </P
  1978. ><P
  1979. >     <TABLE
  1980. WIDTH="100%"
  1981. BORDER="0"
  1982. CELLPADDING="0"
  1983. CELLSPACING="0"
  1984. CLASS="EXAMPLE"
  1985. ><TR
  1986. ><TD
  1987. ><DIV
  1988. CLASS="example"
  1989. ><A
  1990. NAME="AEN203"
  1991. ></A
  1992. ><P
  1993. ><B
  1994. >P°φklad 2-2. Printing a variable (Array element)</B
  1995. ></P
  1996. ><TABLE
  1997. BORDER="0"
  1998. BGCOLOR="#E0E0E0"
  1999. CELLPADDING="5"
  2000. ><TR
  2001. ><TD
  2002. ><PRE
  2003. CLASS="php"
  2004. ><?php echo $_SERVER["HTTP_USER_AGENT"]; ?></PRE
  2005. ></TD
  2006. ></TR
  2007. ></TABLE
  2008. ><P
  2009. >      A sample output of this script may be:
  2010.     </P
  2011. ><TABLE
  2012. BORDER="0"
  2013. BGCOLOR="#E0E0E0"
  2014. CELLPADDING="5"
  2015. ><TR
  2016. ><TD
  2017. ><PRE
  2018. CLASS="html"
  2019. >Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)</PRE
  2020. ></TD
  2021. ></TR
  2022. ></TABLE
  2023. ></DIV
  2024. ></TD
  2025. ></TR
  2026. ></TABLE
  2027. >
  2028.    </P
  2029. ><P
  2030. >     There are many <A
  2031. HREF="#language.types"
  2032. >types</A
  2033. > of 
  2034.     variables available in PHP.  In the above example we printed 
  2035.     an <A
  2036. HREF="#language.types.array"
  2037. >Array</A
  2038. > element.
  2039.     Arrays can be very useful.
  2040.    </P
  2041. ><P
  2042. >     <TT
  2043. CLASS="varname"
  2044. >$_SERVER</TT
  2045. > is just one variable that is automatically 
  2046.     made available to you by PHP.  A list can be seen in the 
  2047.     <A
  2048. HREF="#reserved.variables"
  2049. >Reserved Variables</A
  2050. > section 
  2051.     of the manual or you can get a complete list of them by creating
  2052.     a file that looks like this:
  2053.    </P
  2054. ><P
  2055. >     <TABLE
  2056. WIDTH="100%"
  2057. BORDER="0"
  2058. CELLPADDING="0"
  2059. CELLSPACING="0"
  2060. CLASS="EXAMPLE"
  2061. ><TR
  2062. ><TD
  2063. ><DIV
  2064. CLASS="example"
  2065. ><A
  2066. NAME="AEN215"
  2067. ></A
  2068. ><P
  2069. ><B
  2070. >P°φklad 2-3. Show all predefined variables with <A
  2071. HREF="#function.phpinfo"
  2072. ><B
  2073. CLASS="function"
  2074. >phpinfo()</B
  2075. ></A
  2076. ></B
  2077. ></P
  2078. ><TABLE
  2079. BORDER="0"
  2080. BGCOLOR="#E0E0E0"
  2081. CELLPADDING="5"
  2082. ><TR
  2083. ><TD
  2084. ><PRE
  2085. CLASS="php"
  2086. ><?php phpinfo(); ?></PRE
  2087. ></TD
  2088. ></TR
  2089. ></TABLE
  2090. ></DIV
  2091. ></TD
  2092. ></TR
  2093. ></TABLE
  2094. >
  2095.    </P
  2096. ><P
  2097. >     When you load up this file in your browser, you will see a page
  2098.     full of information about PHP along with a list of all the
  2099.     variables available to you.
  2100.    </P
  2101. ><P
  2102. >     You can put multiple PHP statements inside a PHP tag and create
  2103.     little blocks of code that do more than just a single echo.
  2104.     For example, if you want to check for Internet Explorer you
  2105.     can do this:
  2106.    </P
  2107. ><P
  2108. >     <TABLE
  2109. WIDTH="100%"
  2110. BORDER="0"
  2111. CELLPADDING="0"
  2112. CELLSPACING="0"
  2113. CLASS="EXAMPLE"
  2114. ><TR
  2115. ><TD
  2116. ><DIV
  2117. CLASS="example"
  2118. ><A
  2119. NAME="AEN222"
  2120. ></A
  2121. ><P
  2122. ><B
  2123. >P°φklad 2-4. Example using <A
  2124. HREF="#control-structures"
  2125. >control 
  2126.      structures</A
  2127. > and <A
  2128. HREF="#functions"
  2129. >functions</A
  2130. ></B
  2131. ></P
  2132. ><TABLE
  2133. BORDER="0"
  2134. BGCOLOR="#E0E0E0"
  2135. CELLPADDING="5"
  2136. ><TR
  2137. ><TD
  2138. ><PRE
  2139. CLASS="php"
  2140. ><?php
  2141. if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") !== false) {
  2142.     echo "You are using Internet Explorer<br />";
  2143. }
  2144. ?></PRE
  2145. ></TD
  2146. ></TR
  2147. ></TABLE
  2148. ><P
  2149. >       A sample output of this script may be:
  2150.      </P
  2151. ><TABLE
  2152. BORDER="0"
  2153. BGCOLOR="#E0E0E0"
  2154. CELLPADDING="5"
  2155. ><TR
  2156. ><TD
  2157. ><PRE
  2158. CLASS="html"
  2159. >You are using Internet Explorer<br /></PRE
  2160. ></TD
  2161. ></TR
  2162. ></TABLE
  2163. ></DIV
  2164. ></TD
  2165. ></TR
  2166. ></TABLE
  2167. >
  2168.    </P
  2169. ><P
  2170. >     Here we introduce a couple of new concepts. We have an 
  2171.     <A
  2172. HREF="#control-structures.if"
  2173. >if</A
  2174. > statement.
  2175.     If you are familiar with the basic syntax used by the C
  2176.     language, this should look logical to you. Otherwise, you
  2177.     should probably pick up any introductory PHP book and read the first
  2178.     couple of chapters, or read the <A
  2179. HREF="#langref"
  2180. >Language
  2181.     Reference</A
  2182. > part of the manual. You can find a list of PHP books
  2183.     at <A
  2184. HREF="http://www.php.net/books.php"
  2185. TARGET="_top"
  2186. >http://www.php.net/books.php</A
  2187. >.
  2188.    </P
  2189. ><P
  2190. >     The second concept we introduced was the <A
  2191. HREF="#function.strpos"
  2192. ><B
  2193. CLASS="function"
  2194. >strpos()</B
  2195. ></A
  2196. >
  2197.     function call. <A
  2198. HREF="#function.strpos"
  2199. ><B
  2200. CLASS="function"
  2201. >strpos()</B
  2202. ></A
  2203. > is a function built into
  2204.     PHP which searches a string for another string. In this case we are
  2205.     looking for <TT
  2206. CLASS="literal"
  2207. >"MSIE"</TT
  2208. > (so-called needle) inside
  2209.     <TT
  2210. CLASS="varname"
  2211. >$_SERVER["HTTP_USER_AGENT"]</TT
  2212. > (so-called haystack).  If
  2213.     the needle is found inside the haystack, the function returns the position
  2214.     of the needle relative to the start of the haystack.  Otherwise, it
  2215.     returns <TT
  2216. CLASS="constant"
  2217. ><B
  2218. >FALSE</B
  2219. ></TT
  2220. >.  If it does not return <TT
  2221. CLASS="constant"
  2222. ><B
  2223. >FALSE</B
  2224. ></TT
  2225. >, the <A
  2226. HREF="#control-structures.if"
  2227. >if</A
  2228. > expression evaluates to <TT
  2229. CLASS="constant"
  2230. ><B
  2231. >TRUE</B
  2232. ></TT
  2233. >
  2234.     and the code within its {braces} is executed. Otherwise, the code is not
  2235.     run. Feel free to create similar examples, 
  2236.     with <A
  2237. HREF="#control-structures.if"
  2238. >if</A
  2239. >, 
  2240.     <A
  2241. HREF="#control-structures.else"
  2242. >else</A
  2243. >, and other 
  2244.     functions such as <A
  2245. HREF="#function.strtoupper"
  2246. ><B
  2247. CLASS="function"
  2248. >strtoupper()</B
  2249. ></A
  2250. > and 
  2251.     <A
  2252. HREF="#function.strlen"
  2253. ><B
  2254. CLASS="function"
  2255. >strlen()</B
  2256. ></A
  2257. >.  Each related manual page contains examples 
  2258.     too.  If you are unsure how to use functions, you will want to read both
  2259.     the manual page on <A
  2260. HREF="#about.prototypes"
  2261. >how to read a
  2262.     function definition</A
  2263. > and the section about  
  2264.     <A
  2265. HREF="#functions"
  2266. >PHP functions</A
  2267. >.
  2268.    </P
  2269. ><P
  2270. >     We can take this a step further and show how you can jump in and out
  2271.     of PHP mode even in the middle of a PHP block:
  2272.    </P
  2273. ><P
  2274. >     <TABLE
  2275. WIDTH="100%"
  2276. BORDER="0"
  2277. CELLPADDING="0"
  2278. CELLSPACING="0"
  2279. CLASS="EXAMPLE"
  2280. ><TR
  2281. ><TD
  2282. ><DIV
  2283. CLASS="example"
  2284. ><A
  2285. NAME="AEN250"
  2286. ></A
  2287. ><P
  2288. ><B
  2289. >P°φklad 2-5. Mixing both HTML and PHP modes</B
  2290. ></P
  2291. ><TABLE
  2292. BORDER="0"
  2293. BGCOLOR="#E0E0E0"
  2294. CELLPADDING="5"
  2295. ><TR
  2296. ><TD
  2297. ><PRE
  2298. CLASS="php"
  2299. ><?php
  2300. if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") !== false) {
  2301. ?>
  2302. <h3>strpos must have returned non-false</h3>
  2303. <center><b>You are using Internet Explorer</b></center>
  2304. <?php
  2305. } else {
  2306. ?>
  2307. <h3>strpos must have returned false</h3>
  2308. <center><b>You are not using Internet Explorer</b></center>
  2309. <?php
  2310. }
  2311. ?></PRE
  2312. ></TD
  2313. ></TR
  2314. ></TABLE
  2315. ><P
  2316. >       A sample output of this script may be:
  2317.      </P
  2318. ><TABLE
  2319. BORDER="0"
  2320. BGCOLOR="#E0E0E0"
  2321. CELLPADDING="5"
  2322. ><TR
  2323. ><TD
  2324. ><PRE
  2325. CLASS="html"
  2326. ><h3>strpos must have returned non-false</h3>
  2327. <center><b>You are using Internet Explorer</b></center></PRE
  2328. ></TD
  2329. ></TR
  2330. ></TABLE
  2331. ></DIV
  2332. ></TD
  2333. ></TR
  2334. ></TABLE
  2335. >
  2336.    </P
  2337. ><P
  2338. >     Instead of using a PHP echo statement to output something, we jumped out
  2339.     of PHP mode and just sent straight HTML. The important and powerful point
  2340.     to note here is that the logical flow of the script remains intact. Only
  2341.     one of the HTML blocks will end up getting sent to the viewer depending on
  2342.     the result of <A
  2343. HREF="#function.strpos"
  2344. ><B
  2345. CLASS="function"
  2346. >strpos()</B
  2347. ></A
  2348. >.  In other words, it depends on
  2349.     whether the string <TT
  2350. CLASS="literal"
  2351. >MSIE</TT
  2352. > was found or not.
  2353.    </P
  2354. ></DIV
  2355. ><DIV
  2356. CLASS="sect1"
  2357. ><HR><H2
  2358. CLASS="sect1"
  2359. ><A
  2360. NAME="tutorial.forms"
  2361. ></A
  2362. >Dealing with Forms</H2
  2363. ><P
  2364. >     One of the most powerful features of PHP is the way it handles HTML
  2365.     forms. The basic concept that is important to understand is that any
  2366.     form element in a form will automatically be available to your PHP 
  2367.     scripts.  Please read the manual section on
  2368.     <A
  2369. HREF="#language.variables.external"
  2370. >Variables from outside 
  2371.     of PHP</A
  2372. > for more information and examples on using forms 
  2373.     with PHP.  Here is an example HTML form:
  2374.    </P
  2375. ><P
  2376. >     <TABLE
  2377. WIDTH="100%"
  2378. BORDER="0"
  2379. CELLPADDING="0"
  2380. CELLSPACING="0"
  2381. CLASS="EXAMPLE"
  2382. ><TR
  2383. ><TD
  2384. ><DIV
  2385. CLASS="example"
  2386. ><A
  2387. NAME="AEN263"
  2388. ></A
  2389. ><P
  2390. ><B
  2391. >P°φklad 2-6. A simple HTML form</B
  2392. ></P
  2393. ><TABLE
  2394. BORDER="0"
  2395. BGCOLOR="#E0E0E0"
  2396. CELLPADDING="5"
  2397. ><TR
  2398. ><TD
  2399. ><PRE
  2400. CLASS="html"
  2401. ><form action="action.php" method="POST">
  2402.  Your name: <input type="text" name="name" />
  2403.  Your age: <input type="text" name="age" />
  2404.  <input type="submit">
  2405. </form></PRE
  2406. ></TD
  2407. ></TR
  2408. ></TABLE
  2409. ></DIV
  2410. ></TD
  2411. ></TR
  2412. ></TABLE
  2413. >
  2414.    </P
  2415. ><P
  2416. >     There is nothing special about this form. It is a straight HTML form
  2417.     with no special tags of any kind. When the user fills in this form
  2418.     and hits the submit button, the <TT
  2419. CLASS="filename"
  2420. >action.php</TT
  2421. > page
  2422.     is called. In this file you would have something like this:
  2423.    </P
  2424. ><P
  2425. >     <TABLE
  2426. WIDTH="100%"
  2427. BORDER="0"
  2428. CELLPADDING="0"
  2429. CELLSPACING="0"
  2430. CLASS="EXAMPLE"
  2431. ><TR
  2432. ><TD
  2433. ><DIV
  2434. CLASS="example"
  2435. ><A
  2436. NAME="AEN269"
  2437. ></A
  2438. ><P
  2439. ><B
  2440. >P°φklad 2-7. Printing data from our form</B
  2441. ></P
  2442. ><TABLE
  2443. BORDER="0"
  2444. BGCOLOR="#E0E0E0"
  2445. CELLPADDING="5"
  2446. ><TR
  2447. ><TD
  2448. ><PRE
  2449. CLASS="php"
  2450. >Hi <?php echo $_POST["name"]; ?>.
  2451. You are <?php echo $_POST["age"]; ?> years old.</PRE
  2452. ></TD
  2453. ></TR
  2454. ></TABLE
  2455. ><P
  2456. >       A sample output of this script may be:
  2457.      </P
  2458. ><TABLE
  2459. BORDER="0"
  2460. BGCOLOR="#E0E0E0"
  2461. CELLPADDING="5"
  2462. ><TR
  2463. ><TD
  2464. ><PRE
  2465. CLASS="html"
  2466. >Hi Joe.
  2467. You are 22 years old.</PRE
  2468. ></TD
  2469. ></TR
  2470. ></TABLE
  2471. ></DIV
  2472. ></TD
  2473. ></TR
  2474. ></TABLE
  2475. >
  2476.    </P
  2477. ><P
  2478. >     It should be obvious what this does. There is nothing more to it.
  2479.     The <TT
  2480. CLASS="varname"
  2481. >$_POST["name"]</TT
  2482. > and <TT
  2483. CLASS="varname"
  2484. >$_POST["age"]</TT
  2485. >
  2486.     variables are automatically set for you by PHP.  Earlier we
  2487.     used the <TT
  2488. CLASS="varname"
  2489. >$_SERVER</TT
  2490. > autoglobal, now above we just 
  2491.     introduced the <A
  2492. HREF="#reserved.variables.post"
  2493. >$_POST</A
  2494. >
  2495.     autoglobal which contains all POST data.  Notice how the
  2496.     <SPAN
  2497. CLASS="emphasis"
  2498. ><I
  2499. CLASS="emphasis"
  2500. >method</I
  2501. ></SPAN
  2502. > of our form is POST.  If we used the 
  2503.     method <SPAN
  2504. CLASS="emphasis"
  2505. ><I
  2506. CLASS="emphasis"
  2507. >GET</I
  2508. ></SPAN
  2509. > then our form information would live in 
  2510.     the <A
  2511. HREF="#reserved.variables.get"
  2512. >$_GET</A
  2513. > autoglobal instead.
  2514.     You may also use the <A
  2515. HREF="#reserved.variables.request"
  2516. >$_REQUEST</A
  2517. >
  2518.     autoglobal, if you do not care about the source of your request data. It 
  2519.     contains the merged information of GET, POST and COOKIE data.  Also see the 
  2520.     <A
  2521. HREF="#function.import-request-variables"
  2522. ><B
  2523. CLASS="function"
  2524. >import_request_variables()</B
  2525. ></A
  2526. > function.
  2527.    </P
  2528. ></DIV
  2529. ><DIV
  2530. CLASS="sect1"
  2531. ><HR><H2
  2532. CLASS="sect1"
  2533. ><A
  2534. NAME="tutorial.oldcode"
  2535. ></A
  2536. >Using old code with new versions of PHP</H2
  2537. ><P
  2538. >     Now that PHP has grown to be a popular scripting language, there are
  2539.     a lot of public repositories/libraries containing code you can reuse.
  2540.     The PHP developers have largely tried to preserve backwards compatibility, 
  2541.     so a script written for an older version will run (ideally) without changes
  2542.     in a newer version of PHP. In practice, some changes will usually be needed.
  2543.    </P
  2544. ><P
  2545. >     Two of the most important recent changes that affect old code are:
  2546.     <P
  2547. ></P
  2548. ><UL
  2549. ><LI
  2550. ><P
  2551. >        The deprecation of the old <TT
  2552. CLASS="varname"
  2553. >$HTTP_*_VARS</TT
  2554. > arrays
  2555.        (which need to be indicated as global when used inside a function or
  2556.        method).  The following 
  2557.        <A
  2558. HREF="#language.variables.superglobals"
  2559. >autoglobal arrays</A
  2560. >
  2561.        were introduced in PHP <A
  2562. HREF="http://www.php.net/release_4_1_0.php"
  2563. TARGET="_top"
  2564. >4.1.0</A
  2565. >. 
  2566.        They are: <TT
  2567. CLASS="varname"
  2568. >$_GET</TT
  2569. >, <TT
  2570. CLASS="varname"
  2571. >$_POST</TT
  2572. >, 
  2573.        <TT
  2574. CLASS="varname"
  2575. >$_COOKIE</TT
  2576. >, <TT
  2577. CLASS="varname"
  2578. >$_SERVER</TT
  2579. >, 
  2580.        <TT
  2581. CLASS="varname"
  2582. >$_FILES</TT
  2583. >, <TT
  2584. CLASS="varname"
  2585. >$_ENV</TT
  2586. >,
  2587.        <TT
  2588. CLASS="varname"
  2589. >$_REQUEST</TT
  2590. >, and <TT
  2591. CLASS="varname"
  2592. >$_SESSION</TT
  2593. >.  The
  2594.        older <TT
  2595. CLASS="varname"
  2596. >$HTTP_*_VARS</TT
  2597. > arrays, such as
  2598.        <TT
  2599. CLASS="varname"
  2600. >$HTTP_POST_VARS</TT
  2601. >, still exist and have since PHP 3. 
  2602.        
  2603.        Od PHP 5.0.0 mohou b²t dlouhΘ
  2604. <A
  2605. HREF="#language.variables.predefined"
  2606. >p°eddefinovanΘ pole</A
  2607. >
  2608. zakßzanΘ direktivou
  2609. <A
  2610. HREF="#ini.register-long-arrays"
  2611. >register_long_arrays</A
  2612. >.
  2613.       </P
  2614. ></LI
  2615. ><LI
  2616. ><P
  2617. >        External variables are no longer registered in the global scope by
  2618.        default.  In other words, as of PHP
  2619.        <A
  2620. HREF="http://www.php.net/release_4_2_0.php"
  2621. TARGET="_top"
  2622. >4.2.0</A
  2623. > the PHP directive 
  2624.        <A
  2625. HREF="#ini.register-globals"
  2626. >register_globals</A
  2627. > is 
  2628.        <SPAN
  2629. CLASS="emphasis"
  2630. ><I
  2631. CLASS="emphasis"
  2632. >off</I
  2633. ></SPAN
  2634. > by default in <TT
  2635. CLASS="filename"
  2636. >php.ini</TT
  2637. >. The preferred 
  2638.        method of accessing these values is via the autoglobal arrays mentioned
  2639.        above.  Older scripts, books, and tutorials may rely on this 
  2640.        directive being on.  If on, for example, one could use 
  2641.        <TT
  2642. CLASS="varname"
  2643. >$id</TT
  2644. > from the URL 
  2645.        <TT
  2646. CLASS="literal"
  2647. >http://www.example.com/foo.php?id=42</TT
  2648. >.  Whether on 
  2649.        or off, <TT
  2650. CLASS="varname"
  2651. >$_GET['id']</TT
  2652. > is available.
  2653.       </P
  2654. ></LI
  2655. ></UL
  2656. >
  2657.     For more details on these changes, see the section on 
  2658.     <A
  2659. HREF="#language.variables.predefined"
  2660. >predefined variables</A
  2661. >
  2662.     and links therein.
  2663.    </P
  2664. ></DIV
  2665. ><DIV
  2666. CLASS="sect1"
  2667. ><HR><H2
  2668. CLASS="sect1"
  2669. ><A
  2670. NAME="tutorial.whatsnext"
  2671. ></A
  2672. >What's next?</H2
  2673. ><P
  2674. >     With your new knowledge you should be able to understand most of 
  2675.     the manual and also the various example scripts available in the
  2676.     example archives. You can also find other examples on the php.net
  2677.     websites in the links section:
  2678.     <A
  2679. HREF="http://www.php.net/links.php"
  2680. TARGET="_top"
  2681. >http://www.php.net/links.php</A
  2682. >.
  2683.    </P
  2684. ><P
  2685. >     To view various slide presentations that show more of what PHP can do, 
  2686.     see the PHP Conference Material Sites: <A
  2687. HREF="http://conf.php.net/"
  2688. TARGET="_top"
  2689. >     http://conf.php.net/</A
  2690. > and <A
  2691. HREF="http://talks.php.net/"
  2692. TARGET="_top"
  2693. >http://talks.php.net/
  2694.     </A
  2695. >
  2696.    </P
  2697. ></DIV
  2698. ></DIV
  2699. ><DIV
  2700. CLASS="chapter"
  2701. ><HR><H1
  2702. ><A
  2703. NAME="installation"
  2704. >Kapitola 3. Instalace</A
  2705. ></H1
  2706. ><DIV
  2707. CLASS="sect1"
  2708. ><HR><H2
  2709. CLASS="sect1"
  2710. ><A
  2711. NAME="install.general"
  2712. ></A
  2713. >General Installation Considerations</H2
  2714. ><P
  2715. >     Before installing first, you need to know what do you
  2716.     want to use PHP for. There are three main fields you
  2717.     can use PHP, as described in the
  2718.     <A
  2719. HREF="#intro-whatcando"
  2720. >What can PHP do?</A
  2721. >
  2722.     section:
  2723.     <P
  2724. ></P
  2725. ><UL
  2726. ><LI
  2727. ><P
  2728. >Server-side scripting</P
  2729. ></LI
  2730. ><LI
  2731. ><P
  2732. >Command line scripting</P
  2733. ></LI
  2734. ><LI
  2735. ><P
  2736. >Client-side GUI applications</P
  2737. ></LI
  2738. ></UL
  2739. >
  2740.    </P
  2741. ><P
  2742. >     For the first and most common form, you need three things:
  2743.     PHP itself, a web server and a web browser. You
  2744.     probably already have a web browser, and depending on
  2745.     your operating system setup, you may also have a web
  2746.     server (e.g. Apache on Linux or IIS on Windows).
  2747.     You may also rent webspace at a company. This way, you
  2748.     don't need to set up anything on your own, only write
  2749.     your PHP scripts, upload it to the server you rent, and
  2750.     see the results in your browser. 
  2751.    </P
  2752. ><P
  2753. >     While setting up the server and PHP on your own, you have
  2754.     two choices for the method of connecting PHP to the
  2755.     server. For many servers PHP has a direct module
  2756.     interface (also called SAPI). These servers include
  2757.     Apache, Microsoft Internet Information Server,
  2758.     Netscape and iPlanet servers. Many other servers
  2759.     have support for ISAPI, the Microsoft module
  2760.     interface (OmniHTTPd for example). If PHP has no
  2761.     module support for your web server, you can always
  2762.     use it as a CGI processor. This means you set up
  2763.     your server to use the command line executable of
  2764.     PHP (<TT
  2765. CLASS="filename"
  2766. >php.exe</TT
  2767. > on Windows) to
  2768.     process all PHP file requests on the server.
  2769.    </P
  2770. ><P
  2771. >     If you are also interested to use PHP for command line
  2772.     scripting (e.g. write scripts autogenerating some images
  2773.     for you offline, or processing text files depending
  2774.     on some arguments you pass to them), you always need
  2775.     the command line executable. For more information, read
  2776.     the section about <A
  2777. HREF="#features.commandline"
  2778. >writing
  2779.     command line PHP applications</A
  2780. >. In this case,
  2781.     you need no server and no browser.
  2782.    </P
  2783. ><P
  2784. >     With PHP you can also write client side GUI applications
  2785.     using the PHP-GTK extension. This is a completely
  2786.     different approach than writing web pages, as you
  2787.     do not output any HTML, but manage windows and objects
  2788.     within them. For more information about PHP-GTK, please
  2789.     <A
  2790. HREF="http://gtk.php.net/"
  2791. TARGET="_top"
  2792. >visit the site dedicated to
  2793.     this extension</A
  2794. >. PHP-GTK is not included in the
  2795.     official PHP distribution.
  2796.    </P
  2797. ><P
  2798. >     From now on, this section deals with setting up PHP
  2799.     for web servers on Unix and Windows with server module
  2800.     interfaces and CGI executables.
  2801.    </P
  2802. ><P
  2803. >     Downloading PHP, the source code, and binary
  2804.     distributions for Windows can be found at
  2805.     <A
  2806. HREF="http://www.php.net/downloads.php"
  2807. TARGET="_top"
  2808. >http://www.php.net/downloads.php</A
  2809. >.
  2810.     We recommend you to choose a
  2811.     <A
  2812. HREF="http://www.php.net/mirrors.php"
  2813. TARGET="_top"
  2814. >mirror</A
  2815. > nearest
  2816.     to you for downloading the distributions.
  2817.    </P
  2818. ></DIV
  2819. ><DIV
  2820. CLASS="sect1"
  2821. ><HR><H2
  2822. CLASS="sect1"
  2823. ><A
  2824. NAME="install.hpux"
  2825. ></A
  2826. >Unix/HP-UX installs</H2
  2827. ><P
  2828. >     This section contains notes and hints specific to installing PHP
  2829.     on HP-UX systems. (Contributed by paul_mckay at clearwater-it dot co dot
  2830.     uk).
  2831.    </P
  2832. ><DIV
  2833. CLASS="note"
  2834. ><BLOCKQUOTE
  2835. CLASS="note"
  2836. ><P
  2837. ><B
  2838. >Poznßmka: </B
  2839. >
  2840.      These tips were written for PHP 4.0.4 and Apache 1.3.9.
  2841.     </P
  2842. ></BLOCKQUOTE
  2843. ></DIV
  2844. ><P
  2845. >     <P
  2846. ></P
  2847. ><OL
  2848. TYPE="1"
  2849. ><LI
  2850. ><P
  2851. >        You need gzip, download a binary distribution from
  2852.        <TT
  2853. CLASS="filename"
  2854. >http://hpux.connect.org.uk/ftp/hpux/Gnu/gzip-1.2.4a/gzip-1.2.4a-sd-10.20.depot.Z</TT
  2855. >
  2856.        uncompress the file and install using swinstall.
  2857.       </P
  2858. ></LI
  2859. ><LI
  2860. ><P
  2861. >        You need gcc, download a binary distribution from
  2862.        <TT
  2863. CLASS="filename"
  2864. >http://gatekeep.cs.utah.edu/ftp/hpux/Gnu/gcc-2.95.2/gcc-2.95.2-sd-10.20.depot.gz</TT
  2865. >.
  2866.        uncompress this file and install gcc using swinstall.
  2867.       </P
  2868. ></LI
  2869. ><LI
  2870. ><P
  2871. >        You need the GNU binutils, you can download a binary distribution from
  2872.        <TT
  2873. CLASS="filename"
  2874. >http://hpux.connect.org.uk/ftp/hpux/Gnu/binutils-2.9.1/binutils-2.9.1-sd-10.20.depot.gz</TT
  2875. >.
  2876.        uncompress this file and install binutils using swinstall.
  2877.       </P
  2878. ></LI
  2879. ><LI
  2880. ><P
  2881. >        You now need bison, you can download a binary distribution from
  2882.        <TT
  2883. CLASS="filename"
  2884. >http://hpux.connect.org.uk/ftp/hpux/Gnu/bison-1.28/bison-1.28-sd-10.20.depot.gz</TT
  2885. >,
  2886.        install as above.
  2887.       </P
  2888. ></LI
  2889. ><LI
  2890. ><P
  2891. >        You now need flex, you need to download the source from one of the
  2892.        http://www.gnu.org mirrors. It is in the non-gnu directory of the ftp
  2893.        site.  Download the file, <B
  2894. CLASS="command"
  2895. >gunzip</B
  2896. >, then
  2897.        <B
  2898. CLASS="command"
  2899. >tar -xvf</B
  2900. > it. Go into the newly created flex directory
  2901.        and run <B
  2902. CLASS="command"
  2903. >./configure</B
  2904. >, followed by 
  2905.        <B
  2906. CLASS="command"
  2907. >make</B
  2908. >, and then <B
  2909. CLASS="command"
  2910. >make install</B
  2911. >.
  2912.       </P
  2913. ><P
  2914. >        If you have errors here, it's probably because gcc etc. are not in your
  2915.        PATH so add them to your PATH. 
  2916.       </P
  2917. ></LI
  2918. ><LI
  2919. ><P
  2920. >        Download the PHP and apache sources. 
  2921.       </P
  2922. ></LI
  2923. ><LI
  2924. ><P
  2925. >        <B
  2926. CLASS="command"
  2927. >gunzip</B
  2928. > and <B
  2929. CLASS="command"
  2930. >tar -xvf</B
  2931. > them. We
  2932.        need to hack a couple of files so that they can compile OK.
  2933.       </P
  2934. ></LI
  2935. ><LI
  2936. ><P
  2937. >        Firstly the configure file needs to be hacked because it seems to lose
  2938.        track of the fact that you are a hpux machine, there will be a better
  2939.        way of doing this but a cheap and cheerful hack is to put
  2940.        <TT
  2941. CLASS="literal"
  2942. >lt_target=hpux10.20</TT
  2943. > on line 47286 of the configure
  2944.        script.
  2945.       </P
  2946. ></LI
  2947. ><LI
  2948. ><P
  2949. >        Next, the Apache GuessOS file needs to be hacked. Under
  2950.        <TT
  2951. CLASS="filename"
  2952. >apache_1.3.9/src/helpers</TT
  2953. > change line 89 from <TT
  2954. CLASS="literal"
  2955. >echo
  2956.        "hp${HPUXMACH}-hpux${HPUXVER}"; exit 0</TT
  2957. > to: <TT
  2958. CLASS="literal"
  2959. >echo
  2960.        "hp${HPUXMACH}-hp-hpux${HPUXVER}"; exit 0</TT
  2961. >
  2962.       </P
  2963. ></LI
  2964. ><LI
  2965. ><P
  2966. >        You cannot install PHP as a shared object under HP-UX so you must
  2967.        compile it as a static, just follow the instructions at the Apache
  2968.        page. 
  2969.       </P
  2970. ></LI
  2971. ><LI
  2972. ><P
  2973. >        PHP and Apache should have compiled OK, but Apache won't start. you
  2974.        need to create a new user for Apache, e.g. www, or apache. You then
  2975.        change lines 252 and 253 of the <TT
  2976. CLASS="filename"
  2977. >conf/httpd.conf</TT
  2978. > in
  2979.        Apache so that instead of
  2980.       </P
  2981. ><TABLE
  2982. BORDER="0"
  2983. BGCOLOR="#E0E0E0"
  2984. CELLPADDING="5"
  2985. ><TR
  2986. ><TD
  2987. ><PRE
  2988. CLASS="screen"
  2989. >User nobody 
  2990. Group nogroup</PRE
  2991. ></TD
  2992. ></TR
  2993. ></TABLE
  2994. ><P
  2995. >        you have something like 
  2996.       </P
  2997. ><TABLE
  2998. BORDER="0"
  2999. BGCOLOR="#E0E0E0"
  3000. CELLPADDING="5"
  3001. ><TR
  3002. ><TD
  3003. ><PRE
  3004. CLASS="screen"
  3005. >User www 
  3006. Group sys</PRE
  3007. ></TD
  3008. ></TR
  3009. ></TABLE
  3010. ><P
  3011. >        This is because you can't run Apache as nobody under hp-ux. Apache and
  3012.        PHP should then work. 
  3013.       </P
  3014. ></LI
  3015. ></OL
  3016. >
  3017.  </P
  3018. ></DIV
  3019. ><DIV
  3020. CLASS="sect1"
  3021. ><HR><H2
  3022. CLASS="sect1"
  3023. ><A
  3024. NAME="install.linux"
  3025. ></A
  3026. >Unix/Linux installs</H2
  3027. ><P
  3028. >     This section contains notes and hints specific to installing
  3029.     PHP on Linux distributions.
  3030.    </P
  3031. ><DIV
  3032. CLASS="sect2"
  3033. ><HR><H3
  3034. CLASS="sect2"
  3035. ><A
  3036. NAME="install.linux.packages"
  3037. ></A
  3038. >Using Packages</H3
  3039. ><P
  3040. >      Many Linux distributions have some sort of package installation
  3041.      system, such as RPM. This can assist in setting up a standard
  3042.      configuration, but if you need to have a different set of features
  3043.      (such as a secure server, or a different database driver), you may
  3044.      need to build PHP and/or your webserver. If you are unfamiliar
  3045.      with building and compiling your own software, it is worth
  3046.      checking to see whether somebody has already built a packaged
  3047.      version of PHP with the features you need.
  3048.     </P
  3049. ></DIV
  3050. ></DIV
  3051. ><DIV
  3052. CLASS="sect1"
  3053. ><HR><H2
  3054. CLASS="sect1"
  3055. ><A
  3056. NAME="install.macosx"
  3057. ></A
  3058. >Unix/Mac OS X installs</H2
  3059. ><P
  3060. >   This section contains notes and hints specific to installing
  3061.   PHP on Mac OS X Server.
  3062.  </P
  3063. ><DIV
  3064. CLASS="sect2"
  3065. ><HR><H3
  3066. CLASS="sect2"
  3067. ><A
  3068. NAME="install.macosx.packages"
  3069. ></A
  3070. >Using Packages</H3
  3071. ><P
  3072. >    There are a few pre-packaged and pre-compiled versions of PHP for
  3073.    Mac OS X. This can help in setting up a standard
  3074.    configuration, but if you need to have a different set of features
  3075.    (such as a secure server, or a different database driver), you may
  3076.    need to build PHP and/or your web server yourself. If you are unfamiliar
  3077.    with building and compiling your own software, it's worth
  3078.    checking whether somebody has already built a packaged
  3079.    version of PHP with the features you need.
  3080.   </P
  3081. ></DIV
  3082. ><DIV
  3083. CLASS="sect2"
  3084. ><HR><H3
  3085. CLASS="sect2"
  3086. ><A
  3087. NAME="install.macosx.compile"
  3088. ></A
  3089. >Compiling for OS X server</H3
  3090. ><P
  3091. >    There are two slightly different versions of Mac OS X, client and
  3092.    server. The following is for OS X Server.
  3093.   </P
  3094. ><DIV
  3095. CLASS="formalpara"
  3096. ><P
  3097. ><A
  3098. NAME="install.macosx.compile.example"
  3099. ></A
  3100. ><B
  3101. >Mac OS X server install. </B
  3102. >
  3103.     <P
  3104. ></P
  3105. ><OL
  3106. TYPE="1"
  3107. ><LI
  3108. ><P
  3109. >Get the latest distributions of Apache and PHP.</P
  3110. ></LI
  3111. ><LI
  3112. ><P
  3113. >        Untar them, and run the <B
  3114. CLASS="command"
  3115. >configure</B
  3116. > program on Apache
  3117.        like so.
  3118.        <TABLE
  3119. BORDER="0"
  3120. BGCOLOR="#E0E0E0"
  3121. CELLPADDING="5"
  3122. ><TR
  3123. ><TD
  3124. ><PRE
  3125. CLASS="shell"
  3126. >./configure --exec-prefix=/usr \
  3127. --localstatedir=/var \
  3128. --mandir=/usr/share/man \
  3129. --libexecdir=/System/Library/Apache/Modules \
  3130. --iconsdir=/System/Library/Apache/Icons \
  3131. --includedir=/System/Library/Frameworks/Apache.framework/Versions/1.3/Headers \
  3132. --enable-shared=max \
  3133. --enable-module=most \
  3134. --target=apache</PRE
  3135. ></TD
  3136. ></TR
  3137. ></TABLE
  3138. >
  3139.       </P
  3140. ></LI
  3141. ><LI
  3142. ><P
  3143. >        If you want the compiler to do some optimization., you may also want to
  3144.        add this line:
  3145.        <TABLE
  3146. BORDER="0"
  3147. BGCOLOR="#E0E0E0"
  3148. CELLPADDING="5"
  3149. ><TR
  3150. ><TD
  3151. ><PRE
  3152. CLASS="shell"
  3153. >setenv OPTIM=-O2</PRE
  3154. ></TD
  3155. ></TR
  3156. ></TABLE
  3157. >
  3158.       </P
  3159. ></LI
  3160. ><LI
  3161. ><P
  3162. >        Next, go to the PHP 4 source directory and configure it.
  3163.        <TABLE
  3164. BORDER="0"
  3165. BGCOLOR="#E0E0E0"
  3166. CELLPADDING="5"
  3167. ><TR
  3168. ><TD
  3169. ><PRE
  3170. CLASS="shell"
  3171. >./configure --prefix=/usr \
  3172.     --sysconfdir=/etc \
  3173.     --localstatedir=/var \
  3174.     --mandir=/usr/share/man \
  3175.     --with-xml \
  3176.     --with-apache=/src/apache_1.3.12</PRE
  3177. ></TD
  3178. ></TR
  3179. ></TABLE
  3180. >
  3181.        If you have any other additions (MySQL, GD, etc.), be sure to add them
  3182.        here. For the <TT
  3183. CLASS="option"
  3184. >--with-apache</TT
  3185. > string, put
  3186.        in the path to your apache source directory, for example
  3187.        <TT
  3188. CLASS="filename"
  3189. >/src/apache_1.3.12</TT
  3190. >.
  3191.       </P
  3192. ></LI
  3193. ><LI
  3194. ><P
  3195. >        Type <B
  3196. CLASS="command"
  3197. >make</B
  3198. > and <B
  3199. CLASS="command"
  3200. >make install</B
  3201. >. This
  3202.        will add a directory to your Apache source directory under
  3203.        <TT
  3204. CLASS="filename"
  3205. >src/modules/php4</TT
  3206. >.
  3207.       </P
  3208. ></LI
  3209. ><LI
  3210. ><P
  3211. >        Now, reconfigure Apache to build in PHP 4.
  3212.        <TABLE
  3213. BORDER="0"
  3214. BGCOLOR="#E0E0E0"
  3215. CELLPADDING="5"
  3216. ><TR
  3217. ><TD
  3218. ><PRE
  3219. CLASS="shell"
  3220. >./configure --exec-prefix=/usr \
  3221. --localstatedir=/var \
  3222. --mandir=/usr/share/man \
  3223. --libexecdir=/System/Library/Apache/Modules \
  3224. --iconsdir=/System/Library/Apache/Icons \
  3225. --includedir=/System/Library/Frameworks/Apache.framework/Versions/1.3/Headers \
  3226. --enable-shared=max \
  3227. --enable-module=most \
  3228. --target=apache \
  3229. --activate-module=src/modules/php4/libphp4.a</PRE
  3230. ></TD
  3231. ></TR
  3232. ></TABLE
  3233. >
  3234.        You may get a message telling you that libmodphp4.a is out of date. If
  3235.        so, go to the <TT
  3236. CLASS="filename"
  3237. >src/modules/php4</TT
  3238. >
  3239.        directory inside your apache source directory and run this command: 
  3240.        <B
  3241. CLASS="command"
  3242. >ranlib libmodphp4.a</B
  3243. >. Then go back to the root of the
  3244.        apache source directory and run the above <B
  3245. CLASS="command"
  3246. >configure</B
  3247. >
  3248.        command again. That'll bring the link table up to date. Run
  3249.        <B
  3250. CLASS="command"
  3251. >make</B
  3252. > and <B
  3253. CLASS="command"
  3254. >make install</B
  3255. > again.
  3256.       </P
  3257. ></LI
  3258. ><LI
  3259. ><P
  3260. >        Copy and rename the <TT
  3261. CLASS="filename"
  3262. >php.ini-dist</TT
  3263. > file to your
  3264.        <TT
  3265. CLASS="filename"
  3266. >bin</TT
  3267. > directory from your PHP 4
  3268.        source directory: 
  3269.        <TT
  3270. CLASS="userinput"
  3271. ><B
  3272. >cp php.ini-dist /usr/local/bin/php.ini</B
  3273. ></TT
  3274. >
  3275.        or (if your don't have a local directory)
  3276.        <TT
  3277. CLASS="userinput"
  3278. ><B
  3279. >cp php.ini-dist /usr/bin/php.ini</B
  3280. ></TT
  3281. >.
  3282.       </P
  3283. ></LI
  3284. ></OL
  3285. >
  3286.    </P
  3287. ></DIV
  3288. ></DIV
  3289. ><DIV
  3290. CLASS="sect2"
  3291. ><HR><H3
  3292. CLASS="sect2"
  3293. ><A
  3294. NAME="install.macosx.client"
  3295. ></A
  3296. >Compiling for MacOS X client</H3
  3297. ><P
  3298. >    Those tips are graciously provided by <A
  3299. HREF="http://www.entropy.ch/software/macosx/"
  3300. TARGET="_top"
  3301. >Marc Liyanage</A
  3302. >.
  3303.   </P
  3304. ><P
  3305. >    The PHP module for the Apache web server included in Mac OS X.
  3306.    This version includes support for the MySQL and PostgreSQL databases.
  3307.   </P
  3308. ><P
  3309. >    NOTE: Be careful when you do this, you could screw up your Apache web server!
  3310.   </P
  3311. ><P
  3312. >    Do this to install:
  3313.    <P
  3314. ></P
  3315. ><OL
  3316. TYPE="1"
  3317. ><LI
  3318. ><P
  3319. >       Open a terminal window.
  3320.      </P
  3321. ></LI
  3322. ><LI
  3323. ><P
  3324. >       Type
  3325.       <TT
  3326. CLASS="userinput"
  3327. ><B
  3328. >wget http://www.diax.ch/users/liyanage/software/macosx/libphp4.so.gz</B
  3329. ></TT
  3330. >,
  3331.       wait for the download to finish.
  3332.      </P
  3333. ></LI
  3334. ><LI
  3335. ><P
  3336. >       Type <TT
  3337. CLASS="userinput"
  3338. ><B
  3339. >gunzip libphp4.so.gz</B
  3340. ></TT
  3341. >.
  3342.      </P
  3343. ></LI
  3344. ><LI
  3345. ><P
  3346. >       Type <TT
  3347. CLASS="userinput"
  3348. ><B
  3349. >sudo apxs -i -a -n php4 libphp4.so</B
  3350. ></TT
  3351. >
  3352.      </P
  3353. ></LI
  3354. ><LI
  3355. ><P
  3356. >       Now type <TT
  3357. CLASS="userinput"
  3358. ><B
  3359. >sudo open -a TextEdit /etc/httpd/httpd.conf</B
  3360. ></TT
  3361. >.
  3362.       TextEdit will open with the web server configuration file. Locate these 
  3363.       two lines towards the end of the file: (Use the Find command)
  3364.       <TABLE
  3365. BORDER="0"
  3366. BGCOLOR="#E0E0E0"
  3367. CELLPADDING="5"
  3368. ><TR
  3369. ><TD
  3370. ><PRE
  3371. CLASS="apache"
  3372. >#AddType application/x-httpd-php .php 
  3373. #AddType application/x-httpd-php-source .phps</PRE
  3374. ></TD
  3375. ></TR
  3376. ></TABLE
  3377. >
  3378.        Remove the two hash marks (<TT
  3379. CLASS="literal"
  3380. >#</TT
  3381. >), then save the file and
  3382.        quit TextEdit.
  3383.       </P
  3384. ></LI
  3385. ><LI
  3386. ><P
  3387. >       Finally, type <TT
  3388. CLASS="userinput"
  3389. ><B
  3390. >sudo apachectl graceful</B
  3391. ></TT
  3392. > to restart
  3393.       the web server.
  3394.      </P
  3395. ></LI
  3396. ></OL
  3397. >
  3398.   </P
  3399. ><P
  3400. >    PHP should now be up and running. You can test it by dropping a file into 
  3401.    your <TT
  3402. CLASS="filename"
  3403. >Sites</TT
  3404. > folder which is called
  3405.    <TT
  3406. CLASS="filename"
  3407. >test.php</TT
  3408. >. Into that file, write this line:
  3409.    <TT
  3410. CLASS="literal"
  3411. ><?php phpinfo() ?></TT
  3412. >.
  3413.   </P
  3414. ><P
  3415. >    Now open up <TT
  3416. CLASS="literal"
  3417. >127.0.0.1/~your_username/test.php</TT
  3418. > in your web
  3419.    browser. You should see a status table with information about the PHP module.
  3420.   </P
  3421. ></DIV
  3422. ></DIV
  3423. ><DIV
  3424. CLASS="sect1"
  3425. ><HR><H2
  3426. CLASS="sect1"
  3427. ><A
  3428. NAME="install.openbsd"
  3429. ></A
  3430. >Unix/OpenBSD installs</H2
  3431. ><P
  3432. >  This section contains notes and hints specific to installing
  3433.  PHP on <A
  3434. HREF="http://www.openbsd.org/"
  3435. TARGET="_top"
  3436. >OpenBSD 3.4</A
  3437. >.
  3438.  </P
  3439. ><DIV
  3440. CLASS="sect2"
  3441. ><HR><H3
  3442. CLASS="sect2"
  3443. ><A
  3444. NAME="install.openbsd.packages"
  3445. ></A
  3446. >Using Binary Packages</H3
  3447. ><P
  3448. >     Using binary packages to install PHP on OpenBSD is the recommended
  3449.     and simplest method.  The core package has been separated from the various
  3450.     modules, and each can be installed and removed independently from the others.
  3451.     The files you need can be found on your OpenBSD CD or on the FTP site.
  3452.    </P
  3453. ><P
  3454. >     The main package you need to install is <TT
  3455. CLASS="filename"
  3456. >php4-core-4.3.3.tgz</TT
  3457. >,
  3458.     which contains the basic engine (plus gettext and iconv).  Next, take a look
  3459.     at the module packages, such as <TT
  3460. CLASS="filename"
  3461. >php4-mysql-4.3.3.tgz</TT
  3462. >
  3463.     or <TT
  3464. CLASS="filename"
  3465. >php4-imap-4.3.3.tgz</TT
  3466. >.  You need to use the <B
  3467. CLASS="command"
  3468. >phpxs</B
  3469. >
  3470.     command to activate and deactivate these modules in your <TT
  3471. CLASS="filename"
  3472. >php.ini</TT
  3473. >.
  3474.    </P
  3475. ><TABLE
  3476. WIDTH="100%"
  3477. BORDER="0"
  3478. CELLPADDING="0"
  3479. CELLSPACING="0"
  3480. CLASS="EXAMPLE"
  3481. ><TR
  3482. ><TD
  3483. ><DIV
  3484. CLASS="example"
  3485. ><A
  3486. NAME="install.openbsd.ports.example"
  3487. ></A
  3488. ><P
  3489. ><B
  3490. >P°φklad 3-1. OpenBSD Package Install Example</B
  3491. ></P
  3492. ><TABLE
  3493. BORDER="0"
  3494. BGCOLOR="#E0E0E0"
  3495. CELLPADDING="5"
  3496. ><TR
  3497. ><TD
  3498. ><PRE
  3499. CLASS="programlisting"
  3500. ># pkg_add php4-core-4.3.3.tgz
  3501. # /usr/local/sbin/phpxs -s
  3502. # cp /usr/local/share/doc/php4/php.ini-recommended /var/www/conf/php.ini
  3503.   (add in mysql)
  3504. # pkg_add php4-mysql-4.3.3.tgz
  3505. # /usr/local/sbin/phpxs -a mysql
  3506.   (add in imap)
  3507. # pkg_add php4-imap-4.3.3.tgz
  3508. # /usr/local/sbin/phpxs -a imap
  3509.   (remove mysql as a test)
  3510. # pkg_delete php4-mysql-4.3.3
  3511. # /usr/local/sbin/phpxs -r mysql
  3512.   (install the PEAR libraries)
  3513. # pkg_add php4-pear-4.3.3.tgz</PRE
  3514. ></TD
  3515. ></TR
  3516. ></TABLE
  3517. ></DIV
  3518. ></TD
  3519. ></TR
  3520. ></TABLE
  3521. ><P
  3522. >    Read the <A
  3523. HREF="http://www.openbsd.org/cgi-bin/man.cgi?query=packages"
  3524. TARGET="_top"
  3525. >packages(7)</A
  3526. >
  3527.    manual page for more information about binary packages on OpenBSD.
  3528.    </P
  3529. ></DIV
  3530. ><DIV
  3531. CLASS="sect2"
  3532. ><HR><H3
  3533. CLASS="sect2"
  3534. ><A
  3535. NAME="install.openbsd.ports"
  3536. ></A
  3537. >Using Ports</H3
  3538. ><P
  3539. >    You can also compile up PHP from source using the <A
  3540. HREF="http://www.openbsd.org/ports.html"
  3541. TARGET="_top"
  3542. >ports tree</A
  3543. >.
  3544.    However, this is only recommended for users familiar with OpenBSD.  The PHP 4 port
  3545.    is split into two sub-directories: core and extensions.  The
  3546.    extensions directory generates sub-packages for all of the supported
  3547.    PHP modules.  If you find you do not want to create some of these modules,
  3548.    use the <B
  3549. CLASS="command"
  3550. >no_*</B
  3551. > FLAVOR.  For example, to skip building
  3552.    the imap module, set the FLAVOR to <B
  3553. CLASS="command"
  3554. >no_imap</B
  3555. >.
  3556.   </P
  3557. ></DIV
  3558. ><DIV
  3559. CLASS="sect2"
  3560. ><HR><H3
  3561. CLASS="sect2"
  3562. ><A
  3563. NAME="install.openbsd.faq"
  3564. ></A
  3565. >Common Problems</H3
  3566. ><P
  3567. ></P
  3568. ><UL
  3569. ><LI
  3570. ><P
  3571. >The default install of Apache runs inside a
  3572.     <A
  3573. HREF="http://www.openbsd.org/cgi-bin/man.cgi?query=chroot"
  3574. TARGET="_top"
  3575. >chroot(2) jail</A
  3576. >, which will restrict PHP scripts to
  3577.     accessing files under <TT
  3578. CLASS="filename"
  3579. >/var/www</TT
  3580. >.  You will therefore need to create a
  3581.     <TT
  3582. CLASS="filename"
  3583. >/var/www/tmp</TT
  3584. > directory for PHP session files to be stored, or use an
  3585.     alternative session backend.  In addition, database sockets need to be placed inside the
  3586.     jail or listen on the <TT
  3587. CLASS="filename"
  3588. >localhost</TT
  3589. > interface.  If you use network functions,
  3590.     some files from <TT
  3591. CLASS="filename"
  3592. >/etc</TT
  3593. > such as <TT
  3594. CLASS="filename"
  3595. >/etc/resolv.conf</TT
  3596. > and
  3597.     <TT
  3598. CLASS="filename"
  3599. >/etc/services</TT
  3600. > will need to be moved into <TT
  3601. CLASS="filename"
  3602. >/var/www/etc</TT
  3603. >.
  3604.     The OpenBSD PEAR package automatically installs into the correct chroot directories, so 
  3605.     no special modification is needed there.  More information on the OpenBSD Apache is available
  3606.     in the <A
  3607. HREF="http://www.openbsd.org/faq/faq10.html#httpdchroot"
  3608. TARGET="_top"
  3609. >OpenBSD FAQ</A
  3610. >.
  3611.     </P
  3612. ></LI
  3613. ><LI
  3614. ><P
  3615. >     The OpenBSD 3.4 package for the <A
  3616. HREF="http://www.boutell.com/gd/"
  3617. TARGET="_top"
  3618. >gd</A
  3619. > extension requires
  3620.     XFree86 to be installed.  If you do not wish to use some of the font features that
  3621.     require X11, install the <TT
  3622. CLASS="filename"
  3623. >php4-gd-4.3.3-no_x11.tgz</TT
  3624. > package instead.
  3625.     </P
  3626. ></LI
  3627. ></UL
  3628. ></DIV
  3629. ><DIV
  3630. CLASS="sect2"
  3631. ><HR><H3
  3632. CLASS="sect2"
  3633. ><A
  3634. NAME="install.openbsd.older"
  3635. ></A
  3636. >Older Releases</H3
  3637. ><P
  3638. >    Older releases of OpenBSD used the FLAVORS system to compile up
  3639.    a statically linked PHP.  Since it is hard to generate binary packages using
  3640.    this method, it is now deprecated.  You can still use the old stable
  3641.    ports trees if you wish, but they are unsupported by the OpenBSD team.
  3642.    If you have any comments about this, the current maintainer for the port
  3643.    is Anil Madhavapeddy (avsm at openbsd dot org).
  3644.   </P
  3645. ></DIV
  3646. ></DIV
  3647. ><DIV
  3648. CLASS="sect1"
  3649. ><HR><H2
  3650. CLASS="sect1"
  3651. ><A
  3652. NAME="install.solaris"
  3653. ></A
  3654. >Unix/Solaris installs</H2
  3655. ><P
  3656. >   This section contains notes and hints specific to installing
  3657.   PHP on Solaris systems.
  3658.  </P
  3659. ><DIV
  3660. CLASS="sect2"
  3661. ><HR><H3
  3662. CLASS="sect2"
  3663. ><A
  3664. NAME="install.solaris.required"
  3665. ></A
  3666. >Required software</H3
  3667. ><P
  3668. >    Solaris installs often lack C compilers and their related tools.
  3669.    Read <A
  3670. HREF="#faq.installation.needgnu"
  3671. >this FAQ</A
  3672.    for information on why using GNU versions for some of these
  3673.    tools is necessary.  The required software is as follows:
  3674.    <P
  3675. ></P
  3676. ><UL
  3677. ><LI
  3678. ><P
  3679. >       gcc (recommended, other C compilers may work)
  3680.      </P
  3681. ></LI
  3682. ><LI
  3683. ><P
  3684. >       make
  3685.      </P
  3686. ></LI
  3687. ><LI
  3688. ><P
  3689. >       flex
  3690.      </P
  3691. ></LI
  3692. ><LI
  3693. ><P
  3694. >       bison
  3695.      </P
  3696. ></LI
  3697. ><LI
  3698. ><P
  3699. >       m4
  3700.      </P
  3701. ></LI
  3702. ><LI
  3703. ><P
  3704. >       autoconf
  3705.      </P
  3706. ></LI
  3707. ><LI
  3708. ><P
  3709. >       automake
  3710.      </P
  3711. ></LI
  3712. ><LI
  3713. ><P
  3714. >       perl
  3715.      </P
  3716. ></LI
  3717. ><LI
  3718. ><P
  3719. >       gzip
  3720.      </P
  3721. ></LI
  3722. ><LI
  3723. ><P
  3724. >       tar
  3725.      </P
  3726. ></LI
  3727. ><LI
  3728. ><P
  3729. >       GNU sed
  3730.      </P
  3731. ></LI
  3732. ></UL
  3733. >
  3734.     In addition, you will need to install (and possibly compile) any
  3735.     additional software specific to your configuration, such as Oracle
  3736.     or MySQL.
  3737.   </P
  3738. ></DIV
  3739. ><DIV
  3740. CLASS="sect2"
  3741. ><HR><H3
  3742. CLASS="sect2"
  3743. ><A
  3744. NAME="install.solaris.packages"
  3745. ></A
  3746. >Using Packages</H3
  3747. ><P
  3748. >    You can simplify the Solaris install process by using pkgadd to
  3749.    install most of your needed components. 
  3750.   </P
  3751. ></DIV
  3752. ></DIV
  3753. ><DIV
  3754. CLASS="sect1"
  3755. ><HR><H2
  3756. CLASS="sect1"
  3757. ><A
  3758. NAME="install.unix"
  3759. ></A
  3760. >Installation on Unix systems</H2
  3761. ><P
  3762. >     This section will guide you through the general configuration and
  3763.     installation of PHP on Unix systems. Be sure to investigate any
  3764.     sections specific to your platform or web server before you begin
  3765.     the process.
  3766.    </P
  3767. ><P
  3768. >     Prerequisite knowledge and software:
  3769.     <P
  3770. ></P
  3771. ><UL
  3772. ><LI
  3773. ><P
  3774. >        Basic Unix skills (being able to operate "make" and a C
  3775.        compiler, if compiling)
  3776.       </P
  3777. ></LI
  3778. ><LI
  3779. ><P
  3780. >        An ANSI C compiler (if compiling)
  3781.       </P
  3782. ></LI
  3783. ><LI
  3784. ><P
  3785. >        flex (for compiling)
  3786.       </P
  3787. ></LI
  3788. ><LI
  3789. ><P
  3790. >        bison (for compiling)
  3791.       </P
  3792. ></LI
  3793. ><LI
  3794. ><P
  3795. >        A web server
  3796.       </P
  3797. ></LI
  3798. ><LI
  3799. ><P
  3800. >        Any module specific components (such as gd, pdf libs, etc.)
  3801.       </P
  3802. ></LI
  3803. ></UL
  3804. >
  3805.    </P
  3806. ><P
  3807. >     There are several ways to install PHP for the Unix platform, either
  3808.     with a compile and configure process, or through various
  3809.     pre-packaged methods. This documentation is mainly focused around
  3810.     the process of compiling and configuring PHP.
  3811.    </P
  3812. ><P
  3813. >     The initial PHP setup and configuration process is controlled by the
  3814.     use of the commandline options of the <TT
  3815. CLASS="filename"
  3816. >configure</TT
  3817. >
  3818.     script. This page outlines the usage of the most common options,
  3819.     but there are many others to play with. Check out the <A
  3820. HREF="#install.configure"
  3821. >Complete list of configure
  3822.      options</A
  3823. > for an exhaustive rundown. There are several ways
  3824.      to install PHP:
  3825.     <P
  3826. ></P
  3827. ><UL
  3828. ><LI
  3829. ><P
  3830. >        As an <A
  3831. HREF="#install.apache"
  3832. >Apache 1.x  module</A
  3833. > or
  3834.        an <A
  3835. HREF="#install.apache2"
  3836. >Apache 2.x  module</A
  3837. >.
  3838.       </P
  3839. ></LI
  3840. ><LI
  3841. ><P
  3842. >        As an <A
  3843. HREF="#install.caudium"
  3844. >Pike module for Caudium</A
  3845. >
  3846.       </P
  3847. ></LI
  3848. ><LI
  3849. ><P
  3850. >        For use with <A
  3851. HREF="#install.otherhttpd"
  3852. >AOLServer, NSAPI,
  3853.        phttpd, Pi3Web, Roxen, thttpd, or Zeus.</A
  3854. >
  3855.       </P
  3856. ></LI
  3857. ><LI
  3858. ><P
  3859. >        As a <A
  3860. HREF="#install.commandline"
  3861. >CGI executable</A
  3862. >
  3863.       </P
  3864. ></LI
  3865. ></UL
  3866. >
  3867.    </P
  3868. ><DIV
  3869. CLASS="sect2"
  3870. ><HR><H3
  3871. CLASS="sect2"
  3872. ><A
  3873. NAME="install.unix.apache-module"
  3874. ></A
  3875. >Apache Module Quick Reference</H3
  3876. ><P
  3877. >      PHP can be compiled in a number of different ways, but one of
  3878.      the most popular is as an Apache module. The following is a quick
  3879.      installation overview.
  3880.     </P
  3881. ><TABLE
  3882. WIDTH="100%"
  3883. BORDER="0"
  3884. CELLPADDING="0"
  3885. CELLSPACING="0"
  3886. CLASS="EXAMPLE"
  3887. ><TR
  3888. ><TD
  3889. ><DIV
  3890. CLASS="example"
  3891. ><A
  3892. NAME="install.unix.apache-module.quick"
  3893. ></A
  3894. ><P
  3895. ><B
  3896. >P°φklad 3-2. 
  3897.       Quick Installation Instructions for PHP 4 (Apache Module Version)
  3898.      </B
  3899. ></P
  3900. ><TABLE
  3901. BORDER="0"
  3902. BGCOLOR="#E0E0E0"
  3903. CELLPADDING="5"
  3904. ><TR
  3905. ><TD
  3906. ><PRE
  3907. CLASS="shell"
  3908. >1.  gunzip apache_1.3.x.tar.gz
  3909. 2.  tar xvf apache_1.3.x.tar
  3910. 3.  gunzip php-x.x.x.tar.gz
  3911. 4.  tar xvf php-x.x.x.tar
  3912. 5.  cd apache_1.3.x
  3913. 6.  ./configure --prefix=/www
  3914. 7.  cd ../php-x.x.x
  3915. 8.  ./configure --with-mysql --with-apache=../apache_1.3.x --enable-ftp
  3916. 9.  make
  3917. 10. make install
  3918. 11. cd ../apache_1.3.x
  3919. 12. ./configure --activate-module=src/modules/php4/libphp4.a
  3920. 13. make
  3921. 14. make install
  3922. 15. cd ../php-x.x.x
  3923. 16. cp php.ini-dist /usr/local/lib/php.ini
  3924. 17. Edit your httpd.conf or srm.conf file and add: 
  3925.       AddType application/x-httpd-php .php
  3926.  
  3927. 18. Use your normal procedure for restarting the Apache server. (You must
  3928.     stop and restart the server, not just cause the server to reload by
  3929.     use a HUP or USR1 signal.)</PRE
  3930. ></TD
  3931. ></TR
  3932. ></TABLE
  3933. ></DIV
  3934. ></TD
  3935. ></TR
  3936. ></TABLE
  3937. ></DIV
  3938. ><DIV
  3939. CLASS="sect2"
  3940. ><HR><H3
  3941. CLASS="sect2"
  3942. ><A
  3943. NAME="install.building"
  3944. ></A
  3945. >Building</H3
  3946. ><P
  3947. >      When PHP is configured, you are ready to build the CGI executable.
  3948.      The command <B
  3949. CLASS="command"
  3950. >make</B
  3951. > should
  3952.      take care of this.  If it fails and you can't figure out why, see
  3953.      the <A
  3954. HREF="#install.problems"
  3955. >Problems section</A
  3956. >.
  3957.     </P
  3958. ></DIV
  3959. ></DIV
  3960. ><DIV
  3961. CLASS="sect1"
  3962. ><HR><H2
  3963. CLASS="sect1"
  3964. ><A
  3965. NAME="install.windows"
  3966. ></A
  3967. >Installation on Windows systems</H2
  3968. ><P
  3969. >     This section applies to Windows 98/Me and Windows NT/2000/XP.  PHP 
  3970.     will not work on 16 bit platforms such as Windows 3.1 and sometimes 
  3971.     we refer to the supported Windows platforms as Win32. Windows 95
  3972.     is no longer supported as of PHP 4.3.0.
  3973.    </P
  3974. ><P
  3975. >     There are two main ways to install PHP for Windows: either
  3976.     <A
  3977. HREF="#install.windows.manual"
  3978. >manually</A
  3979. >
  3980.     or by using the <A
  3981. HREF="#install.windows.installer"
  3982. >InstallShield</A
  3983. >
  3984.     installer.
  3985.    </P
  3986. ><P
  3987. >     If you have Microsoft Visual Studio, you can also 
  3988.     <A
  3989. HREF="#install.windows.build"
  3990. >build</A
  3991. >
  3992.     PHP from the original source code.
  3993.    </P
  3994. ><P
  3995. >     Once you have PHP installed on your Windows system, you may also
  3996.     want to <A
  3997. HREF="#install.windows.extensions"
  3998. >load various extensions</A
  3999. >
  4000.     for added functionality.
  4001.    </P
  4002. ><DIV
  4003. CLASS="sect2"
  4004. ><HR><H3
  4005. CLASS="sect2"
  4006. ><A
  4007. NAME="install.windows.installer"
  4008. ></A
  4009. >Windows InstallShield</H3
  4010. ><P
  4011. >      The Windows PHP installer is  available from the downloads page at
  4012.      <A
  4013. HREF="http://www.php.net/downloads.php"
  4014. TARGET="_top"
  4015. >http://www.php.net/downloads.php</A
  4016. >. This
  4017.      installs the <SPAN
  4018. CLASS="emphasis"
  4019. ><I
  4020. CLASS="emphasis"
  4021. >CGI version</I
  4022. ></SPAN
  4023. > of <TT
  4024. CLASS="literal"
  4025. >PHP</TT
  4026. >
  4027.      and, for IIS, PWS, and Xitami, configures the web server as well.
  4028.     </P
  4029. ><DIV
  4030. CLASS="note"
  4031. ><BLOCKQUOTE
  4032. CLASS="note"
  4033. ><P
  4034. ><B
  4035. >Poznßmka: </B
  4036. >
  4037.       While the InstallShield installer is an easy way to make
  4038.       <TT
  4039. CLASS="literal"
  4040. >PHP</TT
  4041. > work, it is restricted in many aspects, as
  4042.       automatic setup of extensions for example is not supported. The whole set
  4043.       of supported extensions is only available by downloading the zip binary
  4044.       distribution.
  4045.      </P
  4046. ></BLOCKQUOTE
  4047. ></DIV
  4048. ><P
  4049. >      Install your selected <SPAN
  4050. CLASS="acronym"
  4051. >HTTP</SPAN
  4052. > server on your system and
  4053.      make sure that it works.
  4054.     </P
  4055. ><P
  4056. >      Run the executable installer and follow the instructions provided by the
  4057.      installation wizard. Two types of installation are supported - standard,
  4058.      which provides sensible defaults for all the settings it can, and advanced,
  4059.      which asks questions as it goes along.
  4060.     </P
  4061. ><P
  4062. >      The installation wizard gathers enough information to set up the <TT
  4063. CLASS="filename"
  4064. >php.ini</TT
  4065. >
  4066.      file and configure the web server to use PHP. For IIS and also PWS on NT
  4067.      Workstation, a list of all the nodes on the server with script map settings
  4068.      is displayed, and you can choose those nodes to which you wish to add the
  4069.      PHP script mappings.
  4070.     </P
  4071. ><P
  4072. >      Once the installation has completed the installer will inform you if you
  4073.      need to restart your system, restart the server, or just start using PHP.
  4074.     </P
  4075. ><DIV
  4076. CLASS="warning"
  4077. ><P
  4078. ></P
  4079. ><TABLE
  4080. CLASS="warning"
  4081. BORDER="1"
  4082. WIDTH="100%"
  4083. ><TR
  4084. ><TD
  4085. ALIGN="CENTER"
  4086. ><B
  4087. >Varovßnφ</B
  4088. ></TD
  4089. ></TR
  4090. ><TR
  4091. ><TD
  4092. ALIGN="LEFT"
  4093. ><P
  4094. >       Be aware, that this setup of PHP is not secure. If you would like to have
  4095.       a secure PHP setup, you'd better go on the manual way, and set every
  4096.       option carefully. This automatically working setup gives you an instantly
  4097.       working PHP installation, but it is not meant to be used on online servers.
  4098.      </P
  4099. ></TD
  4100. ></TR
  4101. ></TABLE
  4102. ></DIV
  4103. ></DIV
  4104. ><DIV
  4105. CLASS="sect2"
  4106. ><HR><H3
  4107. CLASS="sect2"
  4108. ><A
  4109. NAME="install.windows.manual"
  4110. ></A
  4111. >Manual Installation Steps</H3
  4112. ><P
  4113. >      This install guide will help you manually install and configure PHP on your
  4114.      Windows webserver. The original version of this guide was compiled by
  4115.      <A
  4116. HREF="mailto:bob_silva@mail.umesd.k12.or.us"
  4117. TARGET="_top"
  4118. >Bob Silva</A
  4119. >, and can be found at
  4120.      <A
  4121. HREF="http://www.umesd.k12.or.us/php/win32install.html"
  4122. TARGET="_top"
  4123. >http://www.umesd.k12.or.us/php/win32install.html</A
  4124. >.
  4125.      You need to download the zip binary distribution from the downloads page at 
  4126.      <A
  4127. HREF="http://www.php.net/downloads.php"
  4128. TARGET="_top"
  4129. >http://www.php.net/downloads.php</A
  4130. >. 
  4131.     </P
  4132. ><P
  4133. >      PHP 4 for Windows comes in three flavours - a CGI executable (php.exe), a
  4134.      CLI executable (sapi/php.exe) and some other SAPI modules:
  4135.      <P
  4136. ></P
  4137. ><TABLE
  4138. BORDER="0"
  4139. ><TBODY
  4140. ><TR
  4141. ><TD
  4142. >        <TT
  4143. CLASS="filename"
  4144. >php4apache.dll</TT
  4145. > - Apache 1.3.x module
  4146.       </TD
  4147. ></TR
  4148. ><TR
  4149. ><TD
  4150. >        <TT
  4151. CLASS="filename"
  4152. >php4apache2.dll</TT
  4153. > - Apache 2.0.x module
  4154.       </TD
  4155. ></TR
  4156. ><TR
  4157. ><TD
  4158. >        <TT
  4159. CLASS="filename"
  4160. >php4isapi.dll</TT
  4161. > - ISAPI Module for ISAPI compliant
  4162.        webservers like IIS 4.0/PWS 4.0 or newer.
  4163.       </TD
  4164. ></TR
  4165. ><TR
  4166. ><TD
  4167. >        <TT
  4168. CLASS="filename"
  4169. >php4nsapi.dll</TT
  4170. > - Netscape/iPlanet module
  4171.       </TD
  4172. ></TR
  4173. ></TBODY
  4174. ></TABLE
  4175. ><P
  4176. ></P
  4177. >
  4178.      The latter form is new to PHP 4, and provides significantly improved
  4179.      performance and some new functionality. The CLI version is designed to use
  4180.      PHP for command line scripting. More information about CLI is available in
  4181.      the chapter about
  4182.      <A
  4183. HREF="#features.commandline"
  4184. >using PHP from the command line</A
  4185. >
  4186.     </P
  4187. ><DIV
  4188. CLASS="warning"
  4189. ><P
  4190. ></P
  4191. ><TABLE
  4192. CLASS="warning"
  4193. BORDER="1"
  4194. WIDTH="100%"
  4195. ><TR
  4196. ><TD
  4197. ALIGN="CENTER"
  4198. ><B
  4199. >Varovßnφ</B
  4200. ></TD
  4201. ></TR
  4202. ><TR
  4203. ><TD
  4204. ALIGN="LEFT"
  4205. ><P
  4206. >       The SAPI modules have been significantly improved in the 4.1 release, 
  4207.       however, you may find that you encounter possible server errors or 
  4208.       other server modules such as ASP failing, in older systems.
  4209.      </P
  4210. ></TD
  4211. ></TR
  4212. ></TABLE
  4213. ></DIV
  4214. ><DIV
  4215. CLASS="note"
  4216. ><BLOCKQUOTE
  4217. CLASS="note"
  4218. ><P
  4219. ><B
  4220. >DCOM and MDAC requirements: </B
  4221. >
  4222.        If you choose one of the SAPI modules and use
  4223.        <SPAN
  4224. CLASS="emphasis"
  4225. ><I
  4226. CLASS="emphasis"
  4227. >Windows 95</I
  4228. ></SPAN
  4229. >, be sure to download and install the DCOM
  4230.        update from the <A
  4231. HREF="http://download.microsoft.com/msdownload/dcom/95/x86/en/dcom95.exe"
  4232. TARGET="_top"
  4233. >Microsoft DCOM pages</A
  4234. >.
  4235.        If you use Microsoft <SPAN
  4236. CLASS="emphasis"
  4237. ><I
  4238. CLASS="emphasis"
  4239. >Windows 9x/NT4</I
  4240. ></SPAN
  4241. > download the
  4242.        latest version of the Microsoft Data Access Components (MDAC) for your
  4243.        platform. MDAC is available at <A
  4244. HREF="http://www.microsoft.com/data/"
  4245. TARGET="_top"
  4246. >http://www.microsoft.com/data/</A
  4247. >.
  4248.      </P
  4249. ></BLOCKQUOTE
  4250. ></DIV
  4251. ><P
  4252. >      The following steps should be performed on all installations before any
  4253.      server specific instructions.
  4254.      <P
  4255. ></P
  4256. ><UL
  4257. ><LI
  4258. ><P
  4259. >         Extract the distribution file to a directory of your choice,
  4260.         <TT
  4261. CLASS="filename"
  4262. >c:\</TT
  4263. > is a good start. The zip package expands to a
  4264.         foldername like <TT
  4265. CLASS="filename"
  4266. >php-4.3.1-Win32</TT
  4267. > which is assumed to
  4268.         be renamed to <TT
  4269. CLASS="filename"
  4270. >php</TT
  4271. >. For the sake of convenience and
  4272.         to be version independent the following steps assume your extracted
  4273.         version of PHP lives in <TT
  4274. CLASS="filename"
  4275. >c:\php</TT
  4276. >. You might choose
  4277.         any other location but you probably do not want to use a path in which
  4278.         spaces are included (for example:
  4279.         <TT
  4280. CLASS="filename"
  4281. >C:\Program Files\PHP</TT
  4282. > is not a good idea). Some web
  4283.         servers will crash if you do. The structure of your directory you
  4284.         extracted the zip file will look like:
  4285.        </P
  4286. ></LI
  4287. ></UL
  4288. >
  4289.      <DIV
  4290. CLASS="informalexample"
  4291. ><A
  4292. NAME="AEN668"
  4293. ></A
  4294. ><P
  4295. ></P
  4296. ><TABLE
  4297. BORDER="0"
  4298. BGCOLOR="#E0E0E0"
  4299. CELLPADDING="5"
  4300. ><TR
  4301. ><TD
  4302. ><PRE
  4303. CLASS="programlisting"
  4304. >c:\php
  4305.    |
  4306.    +--cli
  4307.    |  |
  4308.    |  |-php.exe           -- CLI executable - ONLY for commandline scripting
  4309.    |
  4310.    |
  4311.    +--dlls                -- support dlls for extensions --> Windows system directory
  4312.    |  |
  4313.    |  |-expat.dll
  4314.    |  |
  4315.    |  |-fdftk.dll
  4316.    |  |
  4317.    |  |-...
  4318.    |
  4319.    +--extensions          -- extension dlls for PHP
  4320.    |  |
  4321.    |  |-php_bz2.dll
  4322.    |  |
  4323.    |  |-php_cpdf.dll
  4324.    |  |
  4325.    |  |-..
  4326.    |
  4327.    +--mibs                -- support files for SNMP
  4328.    |
  4329.    |
  4330.    +--openssl             -- support files for Openssl
  4331.    |
  4332.    |
  4333.    +--pdf-related         -- support files for PDF
  4334.    |
  4335.    |
  4336.    +--sapi                -- SAPI dlls
  4337.    |  |
  4338.    |  |-php4apache.dll
  4339.    |  |
  4340.    |  |-php4apache2.dll
  4341.    |  |
  4342.    |  |-php4isapi.dll
  4343.    |  |
  4344.    |  |-..
  4345.    |
  4346.    |-install.txt
  4347.    |
  4348.    |-..
  4349.    |
  4350.    |-php.exe              -- CGI executable
  4351.    |
  4352.    |-..
  4353.    |
  4354.    |-php.ini-dist
  4355.    |
  4356.    |-php.ini-recommended
  4357.    | 
  4358.    |-php4ts.dll           -- main dll --> Windows system directory
  4359.    | 
  4360.    |-...</PRE
  4361. ></TD
  4362. ></TR
  4363. ></TABLE
  4364. ><P
  4365. ></P
  4366. ></DIV
  4367.     </P
  4368. ><P
  4369. >      The  CGI binary - <TT
  4370. CLASS="filename"
  4371. >c:\php\php.exe</TT
  4372. > -, the CLI binary
  4373.      - <TT
  4374. CLASS="filename"
  4375. >c:\php\cli\php.exe</TT
  4376. > -, and the SAPI modules
  4377.      - <TT
  4378. CLASS="filename"
  4379. >c:\php\sapi\*.dll</TT
  4380. > -  rely on the main dll
  4381.      <TT
  4382. CLASS="filename"
  4383. >c:\php\php4ts.dll</TT
  4384. >. You have to make sure, that this
  4385.      dll can be found by your PHP installation. The search order for this dll
  4386.      is as follows:
  4387.      <P
  4388. ></P
  4389. ><TABLE
  4390. BORDER="0"
  4391. ><TBODY
  4392. ><TR
  4393. ><TD
  4394. >        The same directory from where <TT
  4395. CLASS="filename"
  4396. >php.exe</TT
  4397. > is called.
  4398.        In case you use a SAPI module the same directory from where your 
  4399.        webserver loads the dll (e.g. <TT
  4400. CLASS="filename"
  4401. >php4apache.dll</TT
  4402. >).
  4403.       </TD
  4404. ></TR
  4405. ><TR
  4406. ><TD
  4407. >        Any directory in your Windows PATH environment variable.
  4408.       </TD
  4409. ></TR
  4410. ></TBODY
  4411. ></TABLE
  4412. ><P
  4413. ></P
  4414. >
  4415.      <P
  4416. ></P
  4417. ><UL
  4418. ><LI
  4419. ><P
  4420. >         The best bet is to make <TT
  4421. CLASS="filename"
  4422. >php4ts.dll</TT
  4423. > available,
  4424.         regardless which interface (CGI or SAPI module) you plan to use. To do so,
  4425.         you have to copy this dll to a directory on your Windows path. The best
  4426.         place is your Windows system directory:
  4427.         <P
  4428. ></P
  4429. ><TABLE
  4430. BORDER="0"
  4431. ><TBODY
  4432. ><TR
  4433. ><TD
  4434. >           <TT
  4435. CLASS="filename"
  4436. >C:\Windows\System</TT
  4437. > for Windows 9x/ME
  4438.          </TD
  4439. ></TR
  4440. ><TR
  4441. ><TD
  4442. >           <TT
  4443. CLASS="filename"
  4444. >C:\WINNT\System32</TT
  4445. > for Windows NT/2000 or
  4446.           <TT
  4447. CLASS="filename"
  4448. >C:\WINNT40\System32</TT
  4449. > for NT/2000 server
  4450.          </TD
  4451. ></TR
  4452. ><TR
  4453. ><TD
  4454. >           <TT
  4455. CLASS="filename"
  4456. >C:\Windows\System32</TT
  4457. > for Windows XP
  4458.          </TD
  4459. ></TR
  4460. ></TBODY
  4461. ></TABLE
  4462. ><P
  4463. ></P
  4464. >
  4465.         If you plan to use a SAPI module from <TT
  4466. CLASS="filename"
  4467. >c:\php\sapi</TT
  4468. >
  4469.         and do not like to copy dlls to your Windows system directory, you have
  4470.         the alternative choice to simply copy <TT
  4471. CLASS="filename"
  4472. >php4ts.dll</TT
  4473. > to
  4474.         the sapi folder of your extracted zip package,
  4475.         <TT
  4476. CLASS="filename"
  4477. >c:\php\sapi</TT
  4478. >.
  4479.        </P
  4480. ></LI
  4481. ><LI
  4482. ><P
  4483. >         The next step is to set up a valid configuration file for PHP, <TT
  4484. CLASS="filename"
  4485. >php.ini</TT
  4486. >.
  4487.         There are two ini files distributed in the zip file,
  4488.         <TT
  4489. CLASS="filename"
  4490. >php.ini-dist</TT
  4491. > and
  4492.         <TT
  4493. CLASS="filename"
  4494. >php.ini-recommended</TT
  4495. >. We advise you to use
  4496.         <TT
  4497. CLASS="filename"
  4498. >php.ini-recommended</TT
  4499. >, because we optimized the
  4500.         default settings in this file for performance, and security. Read this
  4501.         well documented file carefully and in addition study the
  4502.         <A
  4503. HREF="#configuration.file"
  4504. >ini settings</A
  4505. > and set every
  4506.         element manually yourself. If you would like to achieve the best
  4507.         security, then this is the way for you, although PHP works fine with
  4508.         these default ini files. Copy your chosen ini-file to a directory where
  4509.         PHP is able to find and rename it to <TT
  4510. CLASS="filename"
  4511. >php.ini</TT
  4512. >. By default PHP searches
  4513.         <TT
  4514. CLASS="filename"
  4515. >php.ini</TT
  4516. > in your Windows directory:
  4517.         <P
  4518. ></P
  4519. ><TABLE
  4520. BORDER="0"
  4521. ><TBODY
  4522. ><TR
  4523. ><TD
  4524. >           On Windows 9x/ME/XP copy your chosen ini file to your
  4525.          <TT
  4526. CLASS="filename"
  4527. > %WINDIR%</TT
  4528. >, which is typically
  4529.          <TT
  4530. CLASS="filename"
  4531. >C:\Windows</TT
  4532. >.
  4533.          </TD
  4534. ></TR
  4535. ><TR
  4536. ><TD
  4537. >           On Windows NT/2000 copy your chosen ini file to your
  4538.           <TT
  4539. CLASS="filename"
  4540. >%WINDIR%</TT
  4541. > or <TT
  4542. CLASS="filename"
  4543. >%SYSTEMROOT%</TT
  4544. >,
  4545.           which is typically <TT
  4546. CLASS="filename"
  4547. >C:\WINNT</TT
  4548. > or
  4549.          <TT
  4550. CLASS="filename"
  4551. >C:\WINNT40</TT
  4552. > for NT/2000 servers.
  4553.          </TD
  4554. ></TR
  4555. ></TBODY
  4556. ></TABLE
  4557. ><P
  4558. ></P
  4559. >   
  4560.        </P
  4561. ></LI
  4562. ><LI
  4563. ><P
  4564. >         If you're using NTFS on Windows NT, 2000 or XP, make sure that
  4565.         the user running the webserver has read permissions to your
  4566.         <TT
  4567. CLASS="filename"
  4568. >php.ini</TT
  4569. > (e.g. make it readable by Everyone).
  4570.        </P
  4571. ></LI
  4572. ></UL
  4573. >
  4574.     </P
  4575. ><P
  4576. >      The following steps are optional.
  4577.      <P
  4578. ></P
  4579. ><UL
  4580. ><LI
  4581. ><P
  4582. >         Edit your new <TT
  4583. CLASS="filename"
  4584. >php.ini</TT
  4585. > file.       
  4586.         If you plan to use <A
  4587. HREF="#install.omnihttpd"
  4588. >OmniHTTPd</A
  4589. >,
  4590.         do not follow the next step. Set the
  4591.         <A
  4592. HREF="#ini.doc-root"
  4593. >doc_root</A
  4594. > to point to your webservers
  4595.         document_root. For example:
  4596.         <DIV
  4597. CLASS="informalexample"
  4598. ><A
  4599. NAME="AEN723"
  4600. ></A
  4601. ><P
  4602. ></P
  4603. ><TABLE
  4604. BORDER="0"
  4605. BGCOLOR="#E0E0E0"
  4606. CELLPADDING="5"
  4607. ><TR
  4608. ><TD
  4609. ><PRE
  4610. CLASS="ini"
  4611. >doc_root = c:\inetpub        // for IIS/PWS
  4612.  
  4613. doc_root = c:\apache\htdocs // for Apache</PRE
  4614. ></TD
  4615. ></TR
  4616. ></TABLE
  4617. ><P
  4618. ></P
  4619. ></DIV
  4620. >
  4621.        </P
  4622. ></LI
  4623. ><LI
  4624. ><P
  4625. >         Choose which extensions you would like to load when PHP starts. See
  4626.         the section about
  4627.         <A
  4628. HREF="#install.windows.extensions"
  4629. >Windows extensions</A
  4630. >,
  4631.         about how to set up one, and what is already built in. Note that on
  4632.         a new installation it is advisable to first get PHP working and tested
  4633.         without any extensions before enabling them in <TT
  4634. CLASS="filename"
  4635. >php.ini</TT
  4636. >.
  4637.        </P
  4638. ></LI
  4639. ><LI
  4640. ><P
  4641. >         On PWS and IIS, you can set the
  4642.         <A
  4643. HREF="#ini.browscap"
  4644. >browscap</A
  4645. > configuration setting
  4646.         to point to:
  4647.         <TT
  4648. CLASS="filename"
  4649. >c:\windows\system\inetsrv\browscap.ini</TT
  4650. > on
  4651.         Windows 9x/Me,
  4652.         <TT
  4653. CLASS="filename"
  4654. >c:\winnt\system32\inetsrv\browscap.ini</TT
  4655. > on
  4656.         NT/2000, and
  4657.         <TT
  4658. CLASS="filename"
  4659. >c:\windows\system32\inetsrv\browscap.ini</TT
  4660. >
  4661.         on XP.
  4662.        </P
  4663. ></LI
  4664. ></UL
  4665. >
  4666.     </P
  4667. ><P
  4668. >      Following this instructions you are done with the basic steps to setup PHP
  4669.      on Windows. The next step is to choose a webserver and enable it to run
  4670.      PHP. Installation instructions for the following webservers are available:
  4671.      <P
  4672. ></P
  4673. ><UL
  4674. ><LI
  4675. ><P
  4676. >         .. the <A
  4677. HREF="#install.iis"
  4678. >Windows server family</A
  4679. >, Personal
  4680.         Web server (PWS) 3 and 4 or newer;  Internet Information Server (IIS) 3
  4681.         and 4 or newer.
  4682.        </P
  4683. ></LI
  4684. ><LI
  4685. ><P
  4686. >         .. the Apache servers
  4687.         <A
  4688. HREF="#install.apache.windows"
  4689. >Apache 1.3.x</A
  4690. >, and
  4691.         <A
  4692. HREF="#install.apache2.windows"
  4693. >Apache 2.x</A
  4694. >.        
  4695.        </P
  4696. ></LI
  4697. ><LI
  4698. ><P
  4699. >         .. the
  4700.         <A
  4701. HREF="#install.netscape.windows"
  4702. >Netscape/iPlanet</A
  4703. > servers.      
  4704.        </P
  4705. ></LI
  4706. ><LI
  4707. ><P
  4708. >         .. the <A
  4709. HREF="#install.omnihttpd"
  4710. >OmniHTTPd</A
  4711. > server.
  4712.        </P
  4713. ></LI
  4714. ><LI
  4715. ><P
  4716. >         .. the <A
  4717. HREF="#install.oreilly"
  4718. >Oreilly Website Pro</A
  4719. > server.
  4720.        </P
  4721. ></LI
  4722. ><LI
  4723. ><P
  4724. >         .. the <A
  4725. HREF="#install.sambar"
  4726. >Sambar</A
  4727. > server.
  4728.        </P
  4729. ></LI
  4730. ><LI
  4731. ><P
  4732. >         .. the <A
  4733. HREF="#install.xitami"
  4734. >Xitami</A
  4735. > server.
  4736.        </P
  4737. ></LI
  4738. ></UL
  4739. >
  4740.    </P
  4741. ></DIV
  4742. ><DIV
  4743. CLASS="sect2"
  4744. ><HR><H3
  4745. CLASS="sect2"
  4746. ><A
  4747. NAME="install.windows.build"
  4748. ></A
  4749. >Building from source</H3
  4750. ><P
  4751. >      Before getting started, it is worthwhile answering the question:
  4752.      "Why is building on Windows so hard?" Two reasons come to mind:
  4753.     </P
  4754. ><P
  4755. ></P
  4756. ><OL
  4757. TYPE="1"
  4758. ><LI
  4759. ><P
  4760. >        Windows does not (yet) enjoy a large community of developers
  4761.        who are willing to freely share their source. As a direct
  4762.        result, the necessary investment in infrastructure required
  4763.        to support such development hasn't been made. By and large,
  4764.        what is available has been made possible by the porting of
  4765.        necessary utilities from Unix. Don't be surprised if some of
  4766.        this heritage shows through from time to time.
  4767.       </P
  4768. ></LI
  4769. ><LI
  4770. ><P
  4771. >        Pretty much all of the instructions that follow are of the
  4772.        "set and forget" variety. So sit back and try follow the
  4773.        instructions below as faithfully as you can.
  4774.       </P
  4775. ></LI
  4776. ></OL
  4777. ><DIV
  4778. CLASS="sect3"
  4779. ><HR><H4
  4780. CLASS="sect3"
  4781. ><A
  4782. NAME="install.windows.build.requirement"
  4783. ></A
  4784. >Po╛adavky</H4
  4785. ><P
  4786. >       To compile and build <TT
  4787. CLASS="literal"
  4788. >PHP</TT
  4789. > you need a Microsoft
  4790.       Development Environment. Microsoft Visual C++ 6.0 is recommended.
  4791.       To extract the downloaded files you need a extraction utility
  4792.       (e.g.: Winzip). If you don't already have an unzip utility, you
  4793.       can get a free version from <A
  4794. HREF="http://www.info-zip.org/pub/infozip/"
  4795. TARGET="_top"
  4796. >InfoZip</A
  4797. >.
  4798.      </P
  4799. ><P
  4800. >       Before you get started, you have to download...
  4801.      </P
  4802. ><P
  4803. ></P
  4804. ><UL
  4805. ><LI
  4806. ><P
  4807. >         ..the win32 buildtools from the <TT
  4808. CLASS="literal"
  4809. >PHP</TT
  4810. > site
  4811.         at <A
  4812. HREF="http://www.php.net/extra/win32build.zip"
  4813. TARGET="_top"
  4814. >http://www.php.net/extra/win32build.zip</A
  4815. >.
  4816.        </P
  4817. ></LI
  4818. ><LI
  4819. ><P
  4820. >         ..the source code for the DNS name resolver used by <TT
  4821. CLASS="literal"
  4822. >PHP
  4823.         </TT
  4824. > from <A
  4825. HREF="http://www.php.net/extra/bindlib_w32.zip"
  4826. TARGET="_top"
  4827. >         http://www.php.net/extra/bindlib_w32.zip</A
  4828. >. This is a replacement for the 
  4829.         <TT
  4830. CLASS="filename"
  4831. >resolv.lib</TT
  4832. > library included in <TT
  4833. CLASS="filename"
  4834. >         win32build.zip</TT
  4835. >.
  4836.        </P
  4837. ></LI
  4838. ><LI
  4839. ><P
  4840. >         If you plan to compile <TT
  4841. CLASS="literal"
  4842. >PHP</TT
  4843. > as a Apache
  4844.         module you will also need the <A
  4845. HREF="http://www.apache.org/dist/httpd/"
  4846. TARGET="_top"
  4847. >Apache
  4848.         sources</A
  4849. >.
  4850.        </P
  4851. ></LI
  4852. ></UL
  4853. ><P
  4854. >       Finally, you are going to need the source to PHP 4 itself. You can get
  4855.       the latest development version using <A
  4856. HREF="http://www.php.net/anoncvs.php"
  4857. TARGET="_top"
  4858. >       anonymous CVS</A
  4859. >, a <A
  4860. HREF="http://snaps.php.net/"
  4861. TARGET="_top"
  4862. >       snapshot</A
  4863. > or the most recent released <A
  4864. HREF="http://www.php.net/downloads.php"
  4865. TARGET="_top"
  4866. >       source</A
  4867. > tarball.
  4868.      </P
  4869. ></DIV
  4870. ><DIV
  4871. CLASS="sect3"
  4872. ><HR><H4
  4873. CLASS="sect3"
  4874. ><A
  4875. NAME="install.windows.build.install"
  4876. ></A
  4877. >Putting it all together</H4
  4878. ><P
  4879. >       After downloading the required packages you have to extract them in a
  4880.       proper place.
  4881.       <P
  4882. ></P
  4883. ><UL
  4884. ><LI
  4885. ><P
  4886. >          Create a working directory where all files end up after extracting, e.g:
  4887.          <TT
  4888. CLASS="filename"
  4889. >C:\work</TT
  4890. >.
  4891.         </P
  4892. ></LI
  4893. ><LI
  4894. ><P
  4895. >          Create the directory <TT
  4896. CLASS="filename"
  4897. >win32build</TT
  4898. > under your
  4899.          working directory (<TT
  4900. CLASS="filename"
  4901. >C:\work</TT
  4902. >) and unzip <TT
  4903. CLASS="filename"
  4904. >          win32build.zip</TT
  4905. > into it.
  4906.         </P
  4907. ></LI
  4908. ><LI
  4909. ><P
  4910. >          Create the directory <TT
  4911. CLASS="filename"
  4912. >bindlib_w32</TT
  4913. > under your
  4914.          working directory (<TT
  4915. CLASS="filename"
  4916. >C:\work</TT
  4917. >) and unzip <TT
  4918. CLASS="filename"
  4919. >          bindlib_w32.zip</TT
  4920. > into it.
  4921.         </P
  4922. ></LI
  4923. ><LI
  4924. ><P
  4925. >          Extract the downloaded PHP source code into your working directory
  4926.          (<TT
  4927. CLASS="filename"
  4928. >C:\work</TT
  4929. >).
  4930.         </P
  4931. ></LI
  4932. ></UL
  4933. >
  4934.       Following this steps your directory structure looks like this:
  4935.       <DIV
  4936. CLASS="informalexample"
  4937. ><A
  4938. NAME="AEN812"
  4939. ></A
  4940. ><P
  4941. ></P
  4942. ><TABLE
  4943. BORDER="0"
  4944. BGCOLOR="#E0E0E0"
  4945. CELLPADDING="5"
  4946. ><TR
  4947. ><TD
  4948. ><PRE
  4949. CLASS="programlisting"
  4950. >+--c:\work
  4951. |  |
  4952. |  +--bindlib_w32
  4953. |  |  |
  4954. |  |  +--arpa
  4955. |  |  |
  4956. |  |  +--conf
  4957. |  |  |
  4958. |  |  +--...
  4959. |  |
  4960. |  +--php-4.x.x
  4961. |  |  |
  4962. |  |  +--build
  4963. |  |  |
  4964. |  |  +--...
  4965. |  |  |
  4966. |  |  +--win32
  4967. |  |  |
  4968. |  |  +--...
  4969. |  |
  4970. |  +--win32build
  4971. |  |  |
  4972. |  |  +--bin
  4973. |  |  |
  4974. |  |  +--include
  4975. |  |  |
  4976. |  |  +--lib</PRE
  4977. ></TD
  4978. ></TR
  4979. ></TABLE
  4980. ><P
  4981. ></P
  4982. ></DIV
  4983. >
  4984.       Create the directories <TT
  4985. CLASS="filename"
  4986. >c:\usr\local\lib</TT
  4987. >. Copy
  4988.       <TT
  4989. CLASS="filename"
  4990. >bison.simple</TT
  4991. > from <TT
  4992. CLASS="filename"
  4993. >c:\work\win32build\bin
  4994.       </TT
  4995. > to <TT
  4996. CLASS="filename"
  4997. >c:\usr\local\lib</TT
  4998. >.
  4999.      </P
  5000. ><DIV
  5001. CLASS="note"
  5002. ><BLOCKQUOTE
  5003. CLASS="note"
  5004. ><P
  5005. ><B
  5006. >Poznßmka: </B
  5007. >
  5008.        <A
  5009. HREF="http://www.cygwin.com/"
  5010. TARGET="_top"
  5011. >Cygwin</A
  5012. > users may omit the last
  5013.        step. A properly installed Cygwin environment provides the mandatory
  5014.        files <TT
  5015. CLASS="filename"
  5016. >bison.simple</TT
  5017. > and
  5018.        <TT
  5019. CLASS="filename"
  5020. >bison.exe</TT
  5021. >.
  5022.       </P
  5023. ></BLOCKQUOTE
  5024. ></DIV
  5025. ></DIV
  5026. ><DIV
  5027. CLASS="sect3"
  5028. ><HR><H4
  5029. CLASS="sect3"
  5030. ><A
  5031. NAME="install.windows.build.configure"
  5032. ></A
  5033. >Configure MVC ++</H4
  5034. ><P
  5035. >        The next step is to configure MVC ++ to prepare for compiling.
  5036.        Launch Microsoft Visual C++, and from the menu select
  5037.        Tools => Options. In the dialog, select the
  5038.        directories tab. Sequentially change the dropdown
  5039.        to Executables, Includes, and Library files. Your entries should look
  5040.        like this:
  5041.        <P
  5042. ></P
  5043. ><UL
  5044. ><LI
  5045. ><P
  5046. >           Executable files: <TT
  5047. CLASS="filename"
  5048. >c:\work\win32build\bin</TT
  5049. >,
  5050.           Cygwin users: <TT
  5051. CLASS="filename"
  5052. >cygwin\bin</TT
  5053. >
  5054.          </P
  5055. ></LI
  5056. ><LI
  5057. ><P
  5058. >           Include files: <TT
  5059. CLASS="filename"
  5060. >c:\work\win32build\include</TT
  5061. >
  5062.          </P
  5063. ></LI
  5064. ><LI
  5065. ><P
  5066. >           Library files: <TT
  5067. CLASS="filename"
  5068. >c:\work\win32build\lib</TT
  5069. >
  5070.          </P
  5071. ></LI
  5072. ></UL
  5073. >
  5074.       </P
  5075. ></DIV
  5076. ><DIV
  5077. CLASS="sect3"
  5078. ><HR><H4
  5079. CLASS="sect3"
  5080. ><A
  5081. NAME="install.windows.build.resolvlib"
  5082. ></A
  5083. >Build resolv.lib</H4
  5084. ><P
  5085. >        You must build the <TT
  5086. CLASS="filename"
  5087. >resolv.lib</TT
  5088. > library.
  5089.        Decide whether you want to have debug symbols available
  5090.        (bindlib - Win32 Debug) or not (bindlib - Win32 Release).
  5091.        Build the appropriate configuration: 
  5092.        <P
  5093. ></P
  5094. ><UL
  5095. ><LI
  5096. ><P
  5097. >           For GUI users, launch VC++, and then select File => Open
  5098.           Workspace, navigate to <TT
  5099. CLASS="filename"
  5100. >c:\work\bindlib_w32</TT
  5101. > and
  5102.           select <TT
  5103. CLASS="filename"
  5104. >bindlib.dsw</TT
  5105. >. Then select Build=>Set
  5106.           Active Configuration and select the desired configuration.
  5107.           Finally select Build=>Rebuild All.
  5108.          </P
  5109. ></LI
  5110. ><LI
  5111. ><P
  5112. >           For command line users, make sure that you either have the C++
  5113.           environment variables registered, or have run
  5114.           <B
  5115. CLASS="command"
  5116. >vcvars.bat</B
  5117. >, and then execute one of the following
  5118.           commands:
  5119.          </P
  5120. ><P
  5121. ></P
  5122. ><UL
  5123. ><LI
  5124. ><P
  5125. >             <TT
  5126. CLASS="userinput"
  5127. ><B
  5128. >msdev bindlib.dsp /MAKE "bindlib - Win32 Debug"</B
  5129. ></TT
  5130. >
  5131.            </P
  5132. ></LI
  5133. ><LI
  5134. ><P
  5135. >             <TT
  5136. CLASS="userinput"
  5137. ><B
  5138. >msdev bindlib.dsp /MAKE "bindlib - Win32 Release"</B
  5139. ></TT
  5140. >
  5141.            </P
  5142. ></LI
  5143. ></UL
  5144. ></LI
  5145. ></UL
  5146. >
  5147.        At this point, you should have a usable <TT
  5148. CLASS="filename"
  5149. >resolv.lib</TT
  5150. >
  5151.        in either your <TT
  5152. CLASS="filename"
  5153. >c:\work\bindlib_w32\Debug</TT
  5154. > or
  5155.        <TT
  5156. CLASS="filename"
  5157. >Release</TT
  5158. > subdirectories. Copy this file into your
  5159.        <TT
  5160. CLASS="filename"
  5161. >c:\work\win32build\lib</TT
  5162. > directory over the file
  5163.        by the same name found in there.
  5164.       </P
  5165. ></DIV
  5166. ><DIV
  5167. CLASS="sect3"
  5168. ><HR><H4
  5169. CLASS="sect3"
  5170. ><A
  5171. NAME="install.windows.build.compile"
  5172. ></A
  5173. >Compiling</H4
  5174. ><P
  5175. >       The best way to get started is to build the CGI version.
  5176.      </P
  5177. ><P
  5178. ></P
  5179. ><UL
  5180. ><LI
  5181. ><P
  5182. >         For GUI users, launch VC++, and then select File => Open
  5183.         Workspace and select <TT
  5184. CLASS="filename"
  5185. >c:\work\php-4.x.x\win32\php4ts.dsw
  5186.         </TT
  5187. >. Then select Build=>Set Active
  5188.         Configuration and select the desired configuration, either
  5189.         <TT
  5190. CLASS="literal"
  5191. >php4ts - Win32 Debug_TS</TT
  5192. > or
  5193.         <TT
  5194. CLASS="literal"
  5195. >php4ts - Win32 Release_TS</TT
  5196. >. Finally select
  5197.         Build=>Rebuild All.
  5198.        </P
  5199. ></LI
  5200. ><LI
  5201. ><P
  5202. >         For command line users, make sure that you either have
  5203.         the C++ environment variables registered, or have run
  5204.         <B
  5205. CLASS="command"
  5206. >vcvars.bat</B
  5207. >, and then execute one of the
  5208.         following commands from the <TT
  5209. CLASS="filename"
  5210. >c:\work\php-4.x.x\win32
  5211.         </TT
  5212. > directory:
  5213.        </P
  5214. ><P
  5215. ></P
  5216. ><UL
  5217. ><LI
  5218. ><P
  5219. >           <TT
  5220. CLASS="userinput"
  5221. ><B
  5222. >msdev php4ts.dsp /MAKE "php4ts - Win32 Debug_TS"</B
  5223. ></TT
  5224. >
  5225.          </P
  5226. ></LI
  5227. ><LI
  5228. ><P
  5229. >           <TT
  5230. CLASS="userinput"
  5231. ><B
  5232. >msdev php4ts.dsp /MAKE "php4ts - Win32 Release_TS"</B
  5233. ></TT
  5234. >
  5235.          </P
  5236. ></LI
  5237. ><LI
  5238. ><P
  5239. >           At this point, you should have a usable <TT
  5240. CLASS="filename"
  5241. >php.exe</TT
  5242. >
  5243.           in either your <TT
  5244. CLASS="filename"
  5245. >c:\work\php-4.x.x.\Debug_TS</TT
  5246. > or
  5247.           <TT
  5248. CLASS="filename"
  5249. >Release_TS</TT
  5250. > subdirectories.
  5251.          </P
  5252. ></LI
  5253. ></UL
  5254. ></LI
  5255. ></UL
  5256. ><P
  5257. >       It is possible to do minor customization to the build process by editing
  5258.       the <TT
  5259. CLASS="filename"
  5260. >main/config.win32.h</TT
  5261. > file. For example you can
  5262.       change the default location of <TT
  5263. CLASS="filename"
  5264. >php.ini</TT
  5265. >, the built-in extensions, and the
  5266.       default location for your extensions.
  5267.      </P
  5268. ><P
  5269. >       Next you may want to build the CLI version which is designed to use
  5270.       <A
  5271. HREF="#features.commandline"
  5272. >PHP from the command line</A
  5273. >.
  5274.       The steps are the same as for building the CGI version, except you have
  5275.       to select the <TT
  5276. CLASS="literal"
  5277. >php4ts_cli - Win32 Debug_TS</TT
  5278. > or
  5279.       <TT
  5280. CLASS="literal"
  5281. >php4ts_cli - Win32 Release_TS</TT
  5282. > project file. After a
  5283.       successful compiling run you will find the <TT
  5284. CLASS="filename"
  5285. >php.exe</TT
  5286. >
  5287.       in either the directory <TT
  5288. CLASS="filename"
  5289. >Release_TS\cli\</TT
  5290. > or
  5291.       <TT
  5292. CLASS="filename"
  5293. >Debug_TS\cli\</TT
  5294. >.
  5295.      </P
  5296. ><DIV
  5297. CLASS="note"
  5298. ><BLOCKQUOTE
  5299. CLASS="note"
  5300. ><P
  5301. ><B
  5302. >Poznßmka: </B
  5303. >
  5304.        If you want to use PEAR and the comfortable command line installer,
  5305.        the CLI-SAPI is mandatory. For more information about PEAR and the
  5306.        installer read the documentation at the <A
  5307. HREF="http://pear.php.net/manual/"
  5308. TARGET="_top"
  5309. >        PEAR</A
  5310. > website.
  5311.       </P
  5312. ></BLOCKQUOTE
  5313. ></DIV
  5314. ><P
  5315. >       In order to build the SAPI module (<TT
  5316. CLASS="filename"
  5317. >php4isapi.dll</TT
  5318. >)
  5319.       for integrating PHP with Microsoft IIS, set your active configuration to
  5320.       <TT
  5321. CLASS="filename"
  5322. >php4isapi-whatever-config</TT
  5323. > and build the desired dll.
  5324.      </P
  5325. ></DIV
  5326. ></DIV
  5327. ><DIV
  5328. CLASS="sect2"
  5329. ><HR><H3
  5330. CLASS="sect2"
  5331. ><A
  5332. NAME="install.windows.extensions"
  5333. ></A
  5334. >Installation of Windows extensions</H3
  5335. ><P
  5336. >      After installing PHP and a webserver on Windows, you will probably want to
  5337.      install some extensions for added functionality. You can choose which
  5338.      extensions you would like to load when PHP starts by modifying your
  5339.      <TT
  5340. CLASS="filename"
  5341. >php.ini</TT
  5342. >. You can also load a module dynamically in your script using
  5343.      <A
  5344. HREF="#function.dl"
  5345. ><B
  5346. CLASS="function"
  5347. >dl()</B
  5348. ></A
  5349. >.
  5350.     </P
  5351. ><P
  5352. >      The DLLs for PHP extensions are prefixed with 'php_' in PHP 4 (and 
  5353.      'php3_' in PHP 3). This prevents confusion between PHP extensions 
  5354.      and their supporting libraries. 
  5355.     </P
  5356. ><DIV
  5357. CLASS="note"
  5358. ><BLOCKQUOTE
  5359. CLASS="note"
  5360. ><P
  5361. ><B
  5362. >Poznßmka: </B
  5363. >
  5364.       In PHP 4.3.1 BCMath, Calendar, COM, Ctype, FTP, MySQL, ODBC, Overload,
  5365.       PCRE, Session, Tokenizer, WDDX, XML and Zlib support is
  5366.       <SPAN
  5367. CLASS="emphasis"
  5368. ><I
  5369. CLASS="emphasis"
  5370. >built in</I
  5371. ></SPAN
  5372. >. You don't need to load any additional
  5373.       extensions in order to use these functions. See your distributions
  5374.       <TT
  5375. CLASS="filename"
  5376. >README.txt</TT
  5377. > or <TT
  5378. CLASS="filename"
  5379. >install.txt</TT
  5380. >
  5381.       or <A
  5382. HREF="#install.extensions.overview"
  5383. >this table</A
  5384. >
  5385.       for a list of built in modules.
  5386.      </P
  5387. ></BLOCKQUOTE
  5388. ></DIV
  5389. ><P
  5390. >      The default location <TT
  5391. CLASS="literal"
  5392. >PHP</TT
  5393. > searches for extensions is
  5394.      <TT
  5395. CLASS="filename"
  5396. >c:\php4\extensions</TT
  5397. >. To change this setting to reflect
  5398.      your setup of <TT
  5399. CLASS="literal"
  5400. >PHP</TT
  5401. > edit your <TT
  5402. CLASS="filename"
  5403. >php.ini</TT
  5404. > file:
  5405.      <P
  5406. ></P
  5407. ><UL
  5408. ><LI
  5409. ><P
  5410. >         You will need to change the
  5411.         <A
  5412. HREF="#ini.extension-dir"
  5413. >extension_dir</A
  5414. > setting to
  5415.         point to the directory where your extensions lives, or where you have
  5416.         placed your <TT
  5417. CLASS="filename"
  5418. >php_*.dll</TT
  5419. > files. Please do not
  5420.         forget the last backslash. For example:
  5421.         <DIV
  5422. CLASS="informalexample"
  5423. ><A
  5424. NAME="AEN923"
  5425. ></A
  5426. ><P
  5427. ></P
  5428. ><TABLE
  5429. BORDER="0"
  5430. BGCOLOR="#E0E0E0"
  5431. CELLPADDING="5"
  5432. ><TR
  5433. ><TD
  5434. ><PRE
  5435. CLASS="ini"
  5436. >extension_dir = c:/php/extensions/</PRE
  5437. ></TD
  5438. ></TR
  5439. ></TABLE
  5440. ><P
  5441. ></P
  5442. ></DIV
  5443. >
  5444.        </P
  5445. ></LI
  5446. ><LI
  5447. ><P
  5448. >        Enable the extension(s) in <TT
  5449. CLASS="filename"
  5450. >php.ini</TT
  5451. > you want to use by uncommenting the
  5452.        <TT
  5453. CLASS="literal"
  5454. >extension=php_*.dll</TT
  5455. > lines in <TT
  5456. CLASS="filename"
  5457. >php.ini</TT
  5458. >. This is done
  5459.        by deleting the leading ; form the extension you want to load. 
  5460.        <TABLE
  5461. WIDTH="100%"
  5462. BORDER="0"
  5463. CELLPADDING="0"
  5464. CELLSPACING="0"
  5465. CLASS="EXAMPLE"
  5466. ><TR
  5467. ><TD
  5468. ><DIV
  5469. CLASS="example"
  5470. ><A
  5471. NAME="AEN930"
  5472. ></A
  5473. ><P
  5474. ><B
  5475. >P°φklad 3-3. Enable <A
  5476. HREF="#ref.bzip2"
  5477. >Bzip2</A
  5478. > extension for PHP-Windows</B
  5479. ></P
  5480. ><TABLE
  5481. BORDER="0"
  5482. BGCOLOR="#E0E0E0"
  5483. CELLPADDING="5"
  5484. ><TR
  5485. ><TD
  5486. ><PRE
  5487. CLASS="ini"
  5488. >// change the following line from ...
  5489. ;extension=php_bz2.dll
  5490.  
  5491. // ... to
  5492. extension=php_bz2.dll</PRE
  5493. ></TD
  5494. ></TR
  5495. ></TABLE
  5496. ></DIV
  5497. ></TD
  5498. ></TR
  5499. ></TABLE
  5500. >      
  5501.        </P
  5502. ></LI
  5503. ><LI
  5504. ><P
  5505. >         Some of the extensions need extra DLLs to work. Couple of them can be
  5506.         found in the distribution package, in the
  5507.         <TT
  5508. CLASS="filename"
  5509. >c:\php\dlls\</TT
  5510. > folder but some, for example Oracle
  5511.         (<TT
  5512. CLASS="filename"
  5513. >php_oci8.dll</TT
  5514. >) require DLLs which are not bundled
  5515.         with the distribution package. Copy the bundled DLLs from
  5516.         <TT
  5517. CLASS="filename"
  5518. >c:\php\dlls</TT
  5519. > folder to your Windows PATH, safe
  5520.         places are:
  5521.         <P
  5522. ></P
  5523. ><TABLE
  5524. BORDER="0"
  5525. ><TBODY
  5526. ><TR
  5527. ><TD
  5528. >c:\windows\system for Windows 9x/Me</TD
  5529. ></TR
  5530. ><TR
  5531. ><TD
  5532. >c:\winnt\system32 for Windows NT/2000</TD
  5533. ></TR
  5534. ><TR
  5535. ><TD
  5536. >c:\windows\system32 for Windows XP</TD
  5537. ></TR
  5538. ></TBODY
  5539. ></TABLE
  5540. ><P
  5541. ></P
  5542. >       
  5543.         If you have them already installed on your system, overwrite them only
  5544.         if something doesn't work correctly (Before overwriting them, it is a
  5545.         good idea to make a backup of them, or move them to another folder -
  5546.         just in case something goes wrong).
  5547.        </P
  5548. ></LI
  5549. ></UL
  5550. >
  5551.    <DIV
  5552. CLASS="note"
  5553. ><BLOCKQUOTE
  5554. CLASS="note"
  5555. ><P
  5556. ><B
  5557. >Poznßmka: </B
  5558. >
  5559.      If you are running a server module version of <TT
  5560. CLASS="literal"
  5561. >PHP</TT
  5562. >
  5563.      remember to restart your webserver to reflect your changes to <TT
  5564. CLASS="filename"
  5565. >php.ini</TT
  5566. >.
  5567.     </P
  5568. ></BLOCKQUOTE
  5569. ></DIV
  5570. >
  5571.    </P
  5572. ><P
  5573. >     The following table describes some of the extensions available and required
  5574.     additional dlls.   
  5575.     <DIV
  5576. CLASS="table"
  5577. ><A
  5578. NAME="install.extensions.overview"
  5579. ></A
  5580. ><P
  5581. ><B
  5582. >Tabulka 3-1. PHP Extensions</B
  5583. ></P
  5584. ><TABLE
  5585. BORDER="1"
  5586. CLASS="CALSTABLE"
  5587. ><THEAD
  5588. ><TR
  5589. ><TH
  5590. ALIGN="LEFT"
  5591. VALIGN="MIDDLE"
  5592. >Extension</TH
  5593. ><TH
  5594. ALIGN="LEFT"
  5595. VALIGN="MIDDLE"
  5596. >Description</TH
  5597. ><TH
  5598. ALIGN="LEFT"
  5599. VALIGN="MIDDLE"
  5600. >Notes</TH
  5601. ></TR
  5602. ></THEAD
  5603. ><TBODY
  5604. ><TR
  5605. ><TD
  5606. ALIGN="LEFT"
  5607. VALIGN="MIDDLE"
  5608. >php_bz2.dll</TD
  5609. ><TD
  5610. ALIGN="LEFT"
  5611. VALIGN="MIDDLE"
  5612. ><A
  5613. HREF="#ref.bzip2"
  5614. >bzip2</A
  5615. > compression functions</TD
  5616. ><TD
  5617. ALIGN="LEFT"
  5618. VALIGN="MIDDLE"
  5619. >None</TD
  5620. ></TR
  5621. ><TR
  5622. ><TD
  5623. ALIGN="LEFT"
  5624. VALIGN="MIDDLE"
  5625. >php_calendar.dll</TD
  5626. ><TD
  5627. ALIGN="LEFT"
  5628. VALIGN="MIDDLE"
  5629. ><A
  5630. HREF="#ref.calendar"
  5631. >Calendar</A
  5632. > conversion functions</TD
  5633. ><TD
  5634. ALIGN="LEFT"
  5635. VALIGN="MIDDLE"
  5636. >Built in since PHP 4.0.3</TD
  5637. ></TR
  5638. ><TR
  5639. ><TD
  5640. ALIGN="LEFT"
  5641. VALIGN="MIDDLE"
  5642. >php_cpdf.dll</TD
  5643. ><TD
  5644. ALIGN="LEFT"
  5645. VALIGN="MIDDLE"
  5646. ><A
  5647. HREF="#ref.cpdf"
  5648. >ClibPDF</A
  5649. > functions</TD
  5650. ><TD
  5651. ALIGN="LEFT"
  5652. VALIGN="MIDDLE"
  5653. >None</TD
  5654. ></TR
  5655. ><TR
  5656. ><TD
  5657. ALIGN="LEFT"
  5658. VALIGN="MIDDLE"
  5659. >php_crack.dll</TD
  5660. ><TD
  5661. ALIGN="LEFT"
  5662. VALIGN="MIDDLE"
  5663. ><A
  5664. HREF="#ref.crack"
  5665. >Crack</A
  5666. > functions</TD
  5667. ><TD
  5668. ALIGN="LEFT"
  5669. VALIGN="MIDDLE"
  5670. >None</TD
  5671. ></TR
  5672. ><TR
  5673. ><TD
  5674. ALIGN="LEFT"
  5675. VALIGN="MIDDLE"
  5676. >php3_crypt.dll</TD
  5677. ><TD
  5678. ALIGN="LEFT"
  5679. VALIGN="MIDDLE"
  5680. >Crypt functions</TD
  5681. ><TD
  5682. ALIGN="LEFT"
  5683. VALIGN="MIDDLE"
  5684. >unknown</TD
  5685. ></TR
  5686. ><TR
  5687. ><TD
  5688. ALIGN="LEFT"
  5689. VALIGN="MIDDLE"
  5690. >php_ctype.dll</TD
  5691. ><TD
  5692. ALIGN="LEFT"
  5693. VALIGN="MIDDLE"
  5694. ><A
  5695. HREF="#ref.ctype"
  5696. >ctype</A
  5697. > family functions</TD
  5698. ><TD
  5699. ALIGN="LEFT"
  5700. VALIGN="MIDDLE"
  5701. >Built in since PHP 4.3.0</TD
  5702. ></TR
  5703. ><TR
  5704. ><TD
  5705. ALIGN="LEFT"
  5706. VALIGN="MIDDLE"
  5707. >php_curl.dll</TD
  5708. ><TD
  5709. ALIGN="LEFT"
  5710. VALIGN="MIDDLE"
  5711. ><A
  5712. HREF="#ref.curl"
  5713. >CURL</A
  5714. >, Client URL library functions</TD
  5715. ><TD
  5716. ALIGN="LEFT"
  5717. VALIGN="MIDDLE"
  5718. >Requires: <TT
  5719. CLASS="filename"
  5720. >libeay32.dll</TT
  5721. >, 
  5722.    <TT
  5723. CLASS="filename"
  5724. >ssleay32.dll</TT
  5725. > (bundled)</TD
  5726. ></TR
  5727. ><TR
  5728. ><TD
  5729. ALIGN="LEFT"
  5730. VALIGN="MIDDLE"
  5731. >php_cybercash.dll</TD
  5732. ><TD
  5733. ALIGN="LEFT"
  5734. VALIGN="MIDDLE"
  5735. ><A
  5736. HREF="#ref.cybercash"
  5737. >Cybercash</A
  5738. > payment functions</TD
  5739. ><TD
  5740. ALIGN="LEFT"
  5741. VALIGN="MIDDLE"
  5742. >PHP <= 4.2.0</TD
  5743. ></TR
  5744. ><TR
  5745. ><TD
  5746. ALIGN="LEFT"
  5747. VALIGN="MIDDLE"
  5748. >php_db.dll</TD
  5749. ><TD
  5750. ALIGN="LEFT"
  5751. VALIGN="MIDDLE"
  5752. ><A
  5753. HREF="#ref.dbm"
  5754. >DBM</A
  5755. > functions</TD
  5756. ><TD
  5757. ALIGN="LEFT"
  5758. VALIGN="MIDDLE"
  5759. >Deprecated. Use DBA instead (<TT
  5760. CLASS="filename"
  5761. >php_dba.dll</TT
  5762. >)</TD
  5763. ></TR
  5764. ><TR
  5765. ><TD
  5766. ALIGN="LEFT"
  5767. VALIGN="MIDDLE"
  5768. >php_dba.dll</TD
  5769. ><TD
  5770. ALIGN="LEFT"
  5771. VALIGN="MIDDLE"
  5772. ><A
  5773. HREF="#ref.dba"
  5774. >DBA</A
  5775. >: DataBase (dbm-style) 
  5776.    Abstraction layer functions</TD
  5777. ><TD
  5778. ALIGN="LEFT"
  5779. VALIGN="MIDDLE"
  5780. >None</TD
  5781. ></TR
  5782. ><TR
  5783. ><TD
  5784. ALIGN="LEFT"
  5785. VALIGN="MIDDLE"
  5786. >php_dbase.dll</TD
  5787. ><TD
  5788. ALIGN="LEFT"
  5789. VALIGN="MIDDLE"
  5790. ><A
  5791. HREF="#ref.dbase"
  5792. >dBase</A
  5793. > functions</TD
  5794. ><TD
  5795. ALIGN="LEFT"
  5796. VALIGN="MIDDLE"
  5797. >None</TD
  5798. ></TR
  5799. ><TR
  5800. ><TD
  5801. ALIGN="LEFT"
  5802. VALIGN="MIDDLE"
  5803. >php3_dbm.dll</TD
  5804. ><TD
  5805. ALIGN="LEFT"
  5806. VALIGN="MIDDLE"
  5807. >Berkeley DB2 library</TD
  5808. ><TD
  5809. ALIGN="LEFT"
  5810. VALIGN="MIDDLE"
  5811. >unknown</TD
  5812. ></TR
  5813. ><TR
  5814. ><TD
  5815. ALIGN="LEFT"
  5816. VALIGN="MIDDLE"
  5817. >php_dbx.dll</TD
  5818. ><TD
  5819. ALIGN="LEFT"
  5820. VALIGN="MIDDLE"
  5821. ><A
  5822. HREF="#ref.dbx"
  5823. >dbx</A
  5824. > functions</TD
  5825. ><TD
  5826. ALIGN="LEFT"
  5827. VALIGN="MIDDLE"
  5828. > </TD
  5829. ></TR
  5830. ><TR
  5831. ><TD
  5832. ALIGN="LEFT"
  5833. VALIGN="MIDDLE"
  5834. >php_domxml.dll</TD
  5835. ><TD
  5836. ALIGN="LEFT"
  5837. VALIGN="MIDDLE"
  5838. ><A
  5839. HREF="#ref.domxml"
  5840. >DOM XML</A
  5841. > functions</TD
  5842. ><TD
  5843. ALIGN="LEFT"
  5844. VALIGN="MIDDLE"
  5845. >     PHP <= 4.2.0 requires: <TT
  5846. CLASS="filename"
  5847. >libxml2.dll</TT
  5848. > (bundled)
  5849.     PHP >= 4.3.0 requires: <TT
  5850. CLASS="filename"
  5851. >iconv.dll</TT
  5852. > (bundled)
  5853.    </TD
  5854. ></TR
  5855. ><TR
  5856. ><TD
  5857. ALIGN="LEFT"
  5858. VALIGN="MIDDLE"
  5859. >php_dotnet.dll</TD
  5860. ><TD
  5861. ALIGN="LEFT"
  5862. VALIGN="MIDDLE"
  5863. ><A
  5864. HREF="#ref.dotnet"
  5865. >.NET</A
  5866. > functions</TD
  5867. ><TD
  5868. ALIGN="LEFT"
  5869. VALIGN="MIDDLE"
  5870. >PHP <= 4.1.1</TD
  5871. ></TR
  5872. ><TR
  5873. ><TD
  5874. ALIGN="LEFT"
  5875. VALIGN="MIDDLE"
  5876. >php_exif.dll</TD
  5877. ><TD
  5878. ALIGN="LEFT"
  5879. VALIGN="MIDDLE"
  5880. ><A
  5881. HREF="#function.read-exif-data"
  5882. >Read EXIF</A
  5883. > headers from JPEG</TD
  5884. ><TD
  5885. ALIGN="LEFT"
  5886. VALIGN="MIDDLE"
  5887. >None</TD
  5888. ></TR
  5889. ><TR
  5890. ><TD
  5891. ALIGN="LEFT"
  5892. VALIGN="MIDDLE"
  5893. >php_fbsql.dll</TD
  5894. ><TD
  5895. ALIGN="LEFT"
  5896. VALIGN="MIDDLE"
  5897. ><A
  5898. HREF="#ref.fbsql"
  5899. >FrontBase</A
  5900. > functions</TD
  5901. ><TD
  5902. ALIGN="LEFT"
  5903. VALIGN="MIDDLE"
  5904. >PHP <= 4.2.0</TD
  5905. ></TR
  5906. ><TR
  5907. ><TD
  5908. ALIGN="LEFT"
  5909. VALIGN="MIDDLE"
  5910. >php_fdf.dll</TD
  5911. ><TD
  5912. ALIGN="LEFT"
  5913. VALIGN="MIDDLE"
  5914. ><A
  5915. HREF="#ref.fdf"
  5916. >FDF</A
  5917. >: Forms Data Format functions.</TD
  5918. ><TD
  5919. ALIGN="LEFT"
  5920. VALIGN="MIDDLE"
  5921. >Requires: <TT
  5922. CLASS="filename"
  5923. >fdftk.dll</TT
  5924. > (bundled)</TD
  5925. ></TR
  5926. ><TR
  5927. ><TD
  5928. ALIGN="LEFT"
  5929. VALIGN="MIDDLE"
  5930. >php_filepro.dll</TD
  5931. ><TD
  5932. ALIGN="LEFT"
  5933. VALIGN="MIDDLE"
  5934. ><A
  5935. HREF="#ref.filepro"
  5936. >filePro</A
  5937. > functions</TD
  5938. ><TD
  5939. ALIGN="LEFT"
  5940. VALIGN="MIDDLE"
  5941. >Read-only access</TD
  5942. ></TR
  5943. ><TR
  5944. ><TD
  5945. ALIGN="LEFT"
  5946. VALIGN="MIDDLE"
  5947. >php_ftp.dll</TD
  5948. ><TD
  5949. ALIGN="LEFT"
  5950. VALIGN="MIDDLE"
  5951. ><A
  5952. HREF="#ref.ftp"
  5953. >FTP</A
  5954. > functions</TD
  5955. ><TD
  5956. ALIGN="LEFT"
  5957. VALIGN="MIDDLE"
  5958. >Built-in since PHP 4.0.3</TD
  5959. ></TR
  5960. ><TR
  5961. ><TD
  5962. ALIGN="LEFT"
  5963. VALIGN="MIDDLE"
  5964. >php_gd.dll</TD
  5965. ><TD
  5966. ALIGN="LEFT"
  5967. VALIGN="MIDDLE"
  5968. ><A
  5969. HREF="#ref.image"
  5970. >GD</A
  5971. > library image functions</TD
  5972. ><TD
  5973. ALIGN="LEFT"
  5974. VALIGN="MIDDLE"
  5975. >     Removed in PHP 4.3.2.  Also note that truecolor functions are not
  5976.     available in GD1, instead, use <TT
  5977. CLASS="filename"
  5978. >php_gd2.dll</TT
  5979. >.
  5980.    </TD
  5981. ></TR
  5982. ><TR
  5983. ><TD
  5984. ALIGN="LEFT"
  5985. VALIGN="MIDDLE"
  5986. >php_gd2.dll</TD
  5987. ><TD
  5988. ALIGN="LEFT"
  5989. VALIGN="MIDDLE"
  5990. ><A
  5991. HREF="#ref.image"
  5992. >GD</A
  5993. > library image functions</TD
  5994. ><TD
  5995. ALIGN="LEFT"
  5996. VALIGN="MIDDLE"
  5997. >GD2</TD
  5998. ></TR
  5999. ><TR
  6000. ><TD
  6001. ALIGN="LEFT"
  6002. VALIGN="MIDDLE"
  6003. >php_gettext.dll</TD
  6004. ><TD
  6005. ALIGN="LEFT"
  6006. VALIGN="MIDDLE"
  6007. ><A
  6008. HREF="#ref.gettext"
  6009. >Gettext</A
  6010. > functions</TD
  6011. ><TD
  6012. ALIGN="LEFT"
  6013. VALIGN="MIDDLE"
  6014. >     PHP <= 4.2.0 requires <TT
  6015. CLASS="filename"
  6016. >gnu_gettext.dll</TT
  6017. > (bundled), 
  6018.     PHP >= 4.2.3 requires <TT
  6019. CLASS="filename"
  6020. >libintl-1.dll</TT
  6021. >,
  6022.     <TT
  6023. CLASS="filename"
  6024. >iconv.dll</TT
  6025. > (bundled).
  6026.    </TD
  6027. ></TR
  6028. ><TR
  6029. ><TD
  6030. ALIGN="LEFT"
  6031. VALIGN="MIDDLE"
  6032. >php_hyperwave.dll</TD
  6033. ><TD
  6034. ALIGN="LEFT"
  6035. VALIGN="MIDDLE"
  6036. ><A
  6037. HREF="#ref.hyperwave"
  6038. >HyperWave</A
  6039. > functions</TD
  6040. ><TD
  6041. ALIGN="LEFT"
  6042. VALIGN="MIDDLE"
  6043. >None</TD
  6044. ></TR
  6045. ><TR
  6046. ><TD
  6047. ALIGN="LEFT"
  6048. VALIGN="MIDDLE"
  6049. >php_iconv.dll</TD
  6050. ><TD
  6051. ALIGN="LEFT"
  6052. VALIGN="MIDDLE"
  6053. ><A
  6054. HREF="#ref.iconv"
  6055. >ICONV</A
  6056. > characterset conversion</TD
  6057. ><TD
  6058. ALIGN="LEFT"
  6059. VALIGN="MIDDLE"
  6060. >Requires: <TT
  6061. CLASS="filename"
  6062. >iconv-1.3.dll</TT
  6063. > (bundled), 
  6064.    PHP >=4.2.1 <TT
  6065. CLASS="filename"
  6066. >iconv.dll</TT
  6067. ></TD
  6068. ></TR
  6069. ><TR
  6070. ><TD
  6071. ALIGN="LEFT"
  6072. VALIGN="MIDDLE"
  6073. >php_ifx.dll</TD
  6074. ><TD
  6075. ALIGN="LEFT"
  6076. VALIGN="MIDDLE"
  6077. ><A
  6078. HREF="#ref.ifx"
  6079. >Informix</A
  6080. > functions</TD
  6081. ><TD
  6082. ALIGN="LEFT"
  6083. VALIGN="MIDDLE"
  6084. >Requires: Informix libraries</TD
  6085. ></TR
  6086. ><TR
  6087. ><TD
  6088. ALIGN="LEFT"
  6089. VALIGN="MIDDLE"
  6090. >php_iisfunc.dll</TD
  6091. ><TD
  6092. ALIGN="LEFT"
  6093. VALIGN="MIDDLE"
  6094. >IIS management functions</TD
  6095. ><TD
  6096. ALIGN="LEFT"
  6097. VALIGN="MIDDLE"
  6098. >None</TD
  6099. ></TR
  6100. ><TR
  6101. ><TD
  6102. ALIGN="LEFT"
  6103. VALIGN="MIDDLE"
  6104. >php_imap.dll</TD
  6105. ><TD
  6106. ALIGN="LEFT"
  6107. VALIGN="MIDDLE"
  6108. ><A
  6109. HREF="#ref.imap"
  6110. >IMAP</A
  6111. > POP3 and NNTP functions</TD
  6112. ><TD
  6113. ALIGN="LEFT"
  6114. VALIGN="MIDDLE"
  6115. >PHP 3: <TT
  6116. CLASS="filename"
  6117. >php3_imap4r1.dll</TT
  6118. ></TD
  6119. ></TR
  6120. ><TR
  6121. ><TD
  6122. ALIGN="LEFT"
  6123. VALIGN="MIDDLE"
  6124. >php_ingres.dll</TD
  6125. ><TD
  6126. ALIGN="LEFT"
  6127. VALIGN="MIDDLE"
  6128. ><A
  6129. HREF="#ref.ingres"
  6130. >Ingres II</A
  6131. > functions</TD
  6132. ><TD
  6133. ALIGN="LEFT"
  6134. VALIGN="MIDDLE"
  6135. >Requires: Ingres II libraries</TD
  6136. ></TR
  6137. ><TR
  6138. ><TD
  6139. ALIGN="LEFT"
  6140. VALIGN="MIDDLE"
  6141. >php_interbase.dll</TD
  6142. ><TD
  6143. ALIGN="LEFT"
  6144. VALIGN="MIDDLE"
  6145. ><A
  6146. HREF="#ref.ibase"
  6147. >InterBase</A
  6148. > functions</TD
  6149. ><TD
  6150. ALIGN="LEFT"
  6151. VALIGN="MIDDLE"
  6152. >Requires: <TT
  6153. CLASS="filename"
  6154. >gds32.dll</TT
  6155. > (bundled)</TD
  6156. ></TR
  6157. ><TR
  6158. ><TD
  6159. ALIGN="LEFT"
  6160. VALIGN="MIDDLE"
  6161. >php_java.dll</TD
  6162. ><TD
  6163. ALIGN="LEFT"
  6164. VALIGN="MIDDLE"
  6165. ><A
  6166. HREF="#ref.java"
  6167. >Java</A
  6168. > functions</TD
  6169. ><TD
  6170. ALIGN="LEFT"
  6171. VALIGN="MIDDLE"
  6172. >PHP <= 4.0.6 requires: <TT
  6173. CLASS="filename"
  6174. >jvm.dll</TT
  6175. > (bundled)</TD
  6176. ></TR
  6177. ><TR
  6178. ><TD
  6179. ALIGN="LEFT"
  6180. VALIGN="MIDDLE"
  6181. >php_ldap.dll</TD
  6182. ><TD
  6183. ALIGN="LEFT"
  6184. VALIGN="MIDDLE"
  6185. ><A
  6186. HREF="#ref.ldap"
  6187. >LDAP</A
  6188. > functions</TD
  6189. ><TD
  6190. ALIGN="LEFT"
  6191. VALIGN="MIDDLE"
  6192. >     PHP <= 4.2.0 requires <TT
  6193. CLASS="filename"
  6194. >libsasl.dll</TT
  6195. > (bundled), 
  6196.     PHP >= 4.3.0 requires <TT
  6197. CLASS="filename"
  6198. >libeay32.dll</TT
  6199. >, 
  6200.     <TT
  6201. CLASS="filename"
  6202. >ssleay32.dll</TT
  6203. > (bundled)
  6204.    </TD
  6205. ></TR
  6206. ><TR
  6207. ><TD
  6208. ALIGN="LEFT"
  6209. VALIGN="MIDDLE"
  6210. >php_mbstring.dll</TD
  6211. ><TD
  6212. ALIGN="LEFT"
  6213. VALIGN="MIDDLE"
  6214. ><A
  6215. HREF="#ref.mbstring"
  6216. >Multi-Byte String</A
  6217. > functions</TD
  6218. ><TD
  6219. ALIGN="LEFT"
  6220. VALIGN="MIDDLE"
  6221. >None</TD
  6222. ></TR
  6223. ><TR
  6224. ><TD
  6225. ALIGN="LEFT"
  6226. VALIGN="MIDDLE"
  6227. >php_mcrypt.dll</TD
  6228. ><TD
  6229. ALIGN="LEFT"
  6230. VALIGN="MIDDLE"
  6231. ><A
  6232. HREF="#ref.mcrypt"
  6233. >Mcrypt Encryption</A
  6234. > functions</TD
  6235. ><TD
  6236. ALIGN="LEFT"
  6237. VALIGN="MIDDLE"
  6238. >Requires: <TT
  6239. CLASS="filename"
  6240. >libmcrypt.dll</TT
  6241. ></TD
  6242. ></TR
  6243. ><TR
  6244. ><TD
  6245. ALIGN="LEFT"
  6246. VALIGN="MIDDLE"
  6247. >php_mhash.dll</TD
  6248. ><TD
  6249. ALIGN="LEFT"
  6250. VALIGN="MIDDLE"
  6251. ><A
  6252. HREF="#ref.mhash"
  6253. >Mhash</A
  6254. > functions</TD
  6255. ><TD
  6256. ALIGN="LEFT"
  6257. VALIGN="MIDDLE"
  6258. >PHP >= 4.3.0 requires: <TT
  6259. CLASS="filename"
  6260. >libmhash.dll</TT
  6261. > (bundled)</TD
  6262. ></TR
  6263. ><TR
  6264. ><TD
  6265. ALIGN="LEFT"
  6266. VALIGN="MIDDLE"
  6267. >php_mime_magic.dll</TD
  6268. ><TD
  6269. ALIGN="LEFT"
  6270. VALIGN="MIDDLE"
  6271. ><A
  6272. HREF="#ref.mime-magic"
  6273. >Mimetype</A
  6274. > functions</TD
  6275. ><TD
  6276. ALIGN="LEFT"
  6277. VALIGN="MIDDLE"
  6278. >Requires: <TT
  6279. CLASS="filename"
  6280. >magic.mime</TT
  6281. > (bundled)</TD
  6282. ></TR
  6283. ><TR
  6284. ><TD
  6285. ALIGN="LEFT"
  6286. VALIGN="MIDDLE"
  6287. >php_ming.dll</TD
  6288. ><TD
  6289. ALIGN="LEFT"
  6290. VALIGN="MIDDLE"
  6291. ><A
  6292. HREF="#ref.ming"
  6293. >Ming</A
  6294. > functions for Flash</TD
  6295. ><TD
  6296. ALIGN="LEFT"
  6297. VALIGN="MIDDLE"
  6298. >None</TD
  6299. ></TR
  6300. ><TR
  6301. ><TD
  6302. ALIGN="LEFT"
  6303. VALIGN="MIDDLE"
  6304. >php_msql.dll</TD
  6305. ><TD
  6306. ALIGN="LEFT"
  6307. VALIGN="MIDDLE"
  6308. ><A
  6309. HREF="#ref.msql"
  6310. >mSQL</A
  6311. > functions</TD
  6312. ><TD
  6313. ALIGN="LEFT"
  6314. VALIGN="MIDDLE"
  6315. >Requires: <TT
  6316. CLASS="filename"
  6317. >msql.dll</TT
  6318. > (bundled)</TD
  6319. ></TR
  6320. ><TR
  6321. ><TD
  6322. ALIGN="LEFT"
  6323. VALIGN="MIDDLE"
  6324. >php3_msql1.dll</TD
  6325. ><TD
  6326. ALIGN="LEFT"
  6327. VALIGN="MIDDLE"
  6328. >mSQL 1 client</TD
  6329. ><TD
  6330. ALIGN="LEFT"
  6331. VALIGN="MIDDLE"
  6332. >unknown</TD
  6333. ></TR
  6334. ><TR
  6335. ><TD
  6336. ALIGN="LEFT"
  6337. VALIGN="MIDDLE"
  6338. >php3_msql2.dll</TD
  6339. ><TD
  6340. ALIGN="LEFT"
  6341. VALIGN="MIDDLE"
  6342. >mSQL 2 client</TD
  6343. ><TD
  6344. ALIGN="LEFT"
  6345. VALIGN="MIDDLE"
  6346. >unknown</TD
  6347. ></TR
  6348. ><TR
  6349. ><TD
  6350. ALIGN="LEFT"
  6351. VALIGN="MIDDLE"
  6352. >php_mssql.dll</TD
  6353. ><TD
  6354. ALIGN="LEFT"
  6355. VALIGN="MIDDLE"
  6356. ><A
  6357. HREF="#ref.mssql"
  6358. >MSSQL</A
  6359. > functions</TD
  6360. ><TD
  6361. ALIGN="LEFT"
  6362. VALIGN="MIDDLE"
  6363. >Requires: <TT
  6364. CLASS="filename"
  6365. >ntwdblib.dll</TT
  6366. > (bundled)</TD
  6367. ></TR
  6368. ><TR
  6369. ><TD
  6370. ALIGN="LEFT"
  6371. VALIGN="MIDDLE"
  6372. >php3_mysql.dll</TD
  6373. ><TD
  6374. ALIGN="LEFT"
  6375. VALIGN="MIDDLE"
  6376. ><A
  6377. HREF="#ref.mysql"
  6378. >MySQL</A
  6379. > functions</TD
  6380. ><TD
  6381. ALIGN="LEFT"
  6382. VALIGN="MIDDLE"
  6383. >Built-in in PHP 4</TD
  6384. ></TR
  6385. ><TR
  6386. ><TD
  6387. ALIGN="LEFT"
  6388. VALIGN="MIDDLE"
  6389. >php3_nsmail.dll</TD
  6390. ><TD
  6391. ALIGN="LEFT"
  6392. VALIGN="MIDDLE"
  6393. >Netscape mail functions</TD
  6394. ><TD
  6395. ALIGN="LEFT"
  6396. VALIGN="MIDDLE"
  6397. >unknown</TD
  6398. ></TR
  6399. ><TR
  6400. ><TD
  6401. ALIGN="LEFT"
  6402. VALIGN="MIDDLE"
  6403. >php3_oci73.dll</TD
  6404. ><TD
  6405. ALIGN="LEFT"
  6406. VALIGN="MIDDLE"
  6407. >Oracle functions</TD
  6408. ><TD
  6409. ALIGN="LEFT"
  6410. VALIGN="MIDDLE"
  6411. >unknown</TD
  6412. ></TR
  6413. ><TR
  6414. ><TD
  6415. ALIGN="LEFT"
  6416. VALIGN="MIDDLE"
  6417. >php_oci8.dll</TD
  6418. ><TD
  6419. ALIGN="LEFT"
  6420. VALIGN="MIDDLE"
  6421. ><A
  6422. HREF="#ref.oci8"
  6423. >Oracle 8</A
  6424. > functions</TD
  6425. ><TD
  6426. ALIGN="LEFT"
  6427. VALIGN="MIDDLE"
  6428. >Requires: Oracle 8.1+ client libraries</TD
  6429. ></TR
  6430. ><TR
  6431. ><TD
  6432. ALIGN="LEFT"
  6433. VALIGN="MIDDLE"
  6434. >php_openssl.dll</TD
  6435. ><TD
  6436. ALIGN="LEFT"
  6437. VALIGN="MIDDLE"
  6438. ><A
  6439. HREF="#ref.openssl"
  6440. >OpenSSL</A
  6441. > functions</TD
  6442. ><TD
  6443. ALIGN="LEFT"
  6444. VALIGN="MIDDLE"
  6445. >Requires: <TT
  6446. CLASS="filename"
  6447. >libeay32.dll</TT
  6448. > (bundled)</TD
  6449. ></TR
  6450. ><TR
  6451. ><TD
  6452. ALIGN="LEFT"
  6453. VALIGN="MIDDLE"
  6454. >php_oracle.dll</TD
  6455. ><TD
  6456. ALIGN="LEFT"
  6457. VALIGN="MIDDLE"
  6458. ><A
  6459. HREF="#ref.oracle"
  6460. >Oracle</A
  6461. > functions</TD
  6462. ><TD
  6463. ALIGN="LEFT"
  6464. VALIGN="MIDDLE"
  6465. >Requires: Oracle 7 client libraries</TD
  6466. ></TR
  6467. ><TR
  6468. ><TD
  6469. ALIGN="LEFT"
  6470. VALIGN="MIDDLE"
  6471. >php_overload.dll</TD
  6472. ><TD
  6473. ALIGN="LEFT"
  6474. VALIGN="MIDDLE"
  6475. ><A
  6476. HREF="#ref.overload"
  6477. >Object overloading</A
  6478. > functions</TD
  6479. ><TD
  6480. ALIGN="LEFT"
  6481. VALIGN="MIDDLE"
  6482. >Built in since PHP 4.3.0</TD
  6483. ></TR
  6484. ><TR
  6485. ><TD
  6486. ALIGN="LEFT"
  6487. VALIGN="MIDDLE"
  6488. >php_pdf.dll</TD
  6489. ><TD
  6490. ALIGN="LEFT"
  6491. VALIGN="MIDDLE"
  6492. ><A
  6493. HREF="#ref.pdf"
  6494. >PDF</A
  6495. > functions</TD
  6496. ><TD
  6497. ALIGN="LEFT"
  6498. VALIGN="MIDDLE"
  6499. >None</TD
  6500. ></TR
  6501. ><TR
  6502. ><TD
  6503. ALIGN="LEFT"
  6504. VALIGN="MIDDLE"
  6505. >php_pgsql.dll</TD
  6506. ><TD
  6507. ALIGN="LEFT"
  6508. VALIGN="MIDDLE"
  6509. ><A
  6510. HREF="#ref.pgsql"
  6511. >PostgreSQL</A
  6512. > functions</TD
  6513. ><TD
  6514. ALIGN="LEFT"
  6515. VALIGN="MIDDLE"
  6516. >None</TD
  6517. ></TR
  6518. ><TR
  6519. ><TD
  6520. ALIGN="LEFT"
  6521. VALIGN="MIDDLE"
  6522. >php_printer.dll</TD
  6523. ><TD
  6524. ALIGN="LEFT"
  6525. VALIGN="MIDDLE"
  6526. ><A
  6527. HREF="#ref.printer"
  6528. >Printer</A
  6529. > functions</TD
  6530. ><TD
  6531. ALIGN="LEFT"
  6532. VALIGN="MIDDLE"
  6533. >None</TD
  6534. ></TR
  6535. ><TR
  6536. ><TD
  6537. ALIGN="LEFT"
  6538. VALIGN="MIDDLE"
  6539. >php_shmop.dll</TD
  6540. ><TD
  6541. ALIGN="LEFT"
  6542. VALIGN="MIDDLE"
  6543. ><A
  6544. HREF="#ref.shmop"
  6545. >Shared Memory</A
  6546. > functions</TD
  6547. ><TD
  6548. ALIGN="LEFT"
  6549. VALIGN="MIDDLE"
  6550. >None</TD
  6551. ></TR
  6552. ><TR
  6553. ><TD
  6554. ALIGN="LEFT"
  6555. VALIGN="MIDDLE"
  6556. >php_snmp.dll</TD
  6557. ><TD
  6558. ALIGN="LEFT"
  6559. VALIGN="MIDDLE"
  6560. ><A
  6561. HREF="#ref.snmp"
  6562. >SNMP</A
  6563. > get and walk functions</TD
  6564. ><TD
  6565. ALIGN="LEFT"
  6566. VALIGN="MIDDLE"
  6567. >NT only!</TD
  6568. ></TR
  6569. ><TR
  6570. ><TD
  6571. ALIGN="LEFT"
  6572. VALIGN="MIDDLE"
  6573. >php_sockets.dll</TD
  6574. ><TD
  6575. ALIGN="LEFT"
  6576. VALIGN="MIDDLE"
  6577. ><A
  6578. HREF="#ref.sockets"
  6579. >Socket</A
  6580. > functions</TD
  6581. ><TD
  6582. ALIGN="LEFT"
  6583. VALIGN="MIDDLE"
  6584. >None</TD
  6585. ></TR
  6586. ><TR
  6587. ><TD
  6588. ALIGN="LEFT"
  6589. VALIGN="MIDDLE"
  6590. >php_sybase_ct.dll</TD
  6591. ><TD
  6592. ALIGN="LEFT"
  6593. VALIGN="MIDDLE"
  6594. ><A
  6595. HREF="#ref.sybase"
  6596. >Sybase</A
  6597. > functions</TD
  6598. ><TD
  6599. ALIGN="LEFT"
  6600. VALIGN="MIDDLE"
  6601. >Requires: Sybase client libraries</TD
  6602. ></TR
  6603. ><TR
  6604. ><TD
  6605. ALIGN="LEFT"
  6606. VALIGN="MIDDLE"
  6607. >php_tokenizer.dll</TD
  6608. ><TD
  6609. ALIGN="LEFT"
  6610. VALIGN="MIDDLE"
  6611. ><A
  6612. HREF="#ref.tokenizer"
  6613. >Tokenizer</A
  6614. > functions</TD
  6615. ><TD
  6616. ALIGN="LEFT"
  6617. VALIGN="MIDDLE"
  6618. >Built in since PHP 4.3.0</TD
  6619. ></TR
  6620. ><TR
  6621. ><TD
  6622. ALIGN="LEFT"
  6623. VALIGN="MIDDLE"
  6624. >php_w32api.dll</TD
  6625. ><TD
  6626. ALIGN="LEFT"
  6627. VALIGN="MIDDLE"
  6628. ><A
  6629. HREF="#ref.w32api"
  6630. >W32api</A
  6631. > functions</TD
  6632. ><TD
  6633. ALIGN="LEFT"
  6634. VALIGN="MIDDLE"
  6635. >None</TD
  6636. ></TR
  6637. ><TR
  6638. ><TD
  6639. ALIGN="LEFT"
  6640. VALIGN="MIDDLE"
  6641. >php_xmlrpc.dll</TD
  6642. ><TD
  6643. ALIGN="LEFT"
  6644. VALIGN="MIDDLE"
  6645. ><A
  6646. HREF="#ref.xmlrpc"
  6647. >XML-RPC</A
  6648. > functions</TD
  6649. ><TD
  6650. ALIGN="LEFT"
  6651. VALIGN="MIDDLE"
  6652. >PHP >= 4.2.1 requires: <TT
  6653. CLASS="filename"
  6654. >iconv.dll</TT
  6655. > (bundled)</TD
  6656. ></TR
  6657. ><TR
  6658. ><TD
  6659. ALIGN="LEFT"
  6660. VALIGN="MIDDLE"
  6661. >php_xslt.dll</TD
  6662. ><TD
  6663. ALIGN="LEFT"
  6664. VALIGN="MIDDLE"
  6665. ><A
  6666. HREF="#ref.xslt"
  6667. >XSLT</A
  6668. > functions</TD
  6669. ><TD
  6670. ALIGN="LEFT"
  6671. VALIGN="MIDDLE"
  6672. >     PHP <= 4.2.0 requires <TT
  6673. CLASS="filename"
  6674. >sablot.dll</TT
  6675. >,
  6676.     <TT
  6677. CLASS="filename"
  6678. >expat.dll</TT
  6679. > (bundled). PHP >= 4.2.1 requires
  6680.     <TT
  6681. CLASS="filename"
  6682. >sablot.dll</TT
  6683. >, <TT
  6684. CLASS="filename"
  6685. >expat.dll</TT
  6686. >,
  6687.     <TT
  6688. CLASS="filename"
  6689. >iconv.dll</TT
  6690. > (bundled).
  6691.    </TD
  6692. ></TR
  6693. ><TR
  6694. ><TD
  6695. ALIGN="LEFT"
  6696. VALIGN="MIDDLE"
  6697. >php_yaz.dll</TD
  6698. ><TD
  6699. ALIGN="LEFT"
  6700. VALIGN="MIDDLE"
  6701. ><A
  6702. HREF="#ref.yaz"
  6703. >YAZ</A
  6704. > functions</TD
  6705. ><TD
  6706. ALIGN="LEFT"
  6707. VALIGN="MIDDLE"
  6708. >Requires: <TT
  6709. CLASS="filename"
  6710. >yaz.dll</TT
  6711. > (bundled)</TD
  6712. ></TR
  6713. ><TR
  6714. ><TD
  6715. ALIGN="LEFT"
  6716. VALIGN="MIDDLE"
  6717. >php_zib.dll</TD
  6718. ><TD
  6719. ALIGN="LEFT"
  6720. VALIGN="MIDDLE"
  6721. ><A
  6722. HREF="#ref.zip"
  6723. >Zip File</A
  6724. > functions</TD
  6725. ><TD
  6726. ALIGN="LEFT"
  6727. VALIGN="MIDDLE"
  6728. >Read only access</TD
  6729. ></TR
  6730. ><TR
  6731. ><TD
  6732. ALIGN="LEFT"
  6733. VALIGN="MIDDLE"
  6734. >php_zlib.dll</TD
  6735. ><TD
  6736. ALIGN="LEFT"
  6737. VALIGN="MIDDLE"
  6738. ><A
  6739. HREF="#ref.zlib"
  6740. >ZLib</A
  6741. > compression functions</TD
  6742. ><TD
  6743. ALIGN="LEFT"
  6744. VALIGN="MIDDLE"
  6745. >Built in since PHP 4.3.0</TD
  6746. ></TR
  6747. ></TBODY
  6748. ></TABLE
  6749. ></DIV
  6750. >
  6751.     </P
  6752. ></DIV
  6753. ></DIV
  6754. ><DIV
  6755. CLASS="sect1"
  6756. ><HR><H2
  6757. CLASS="sect1"
  6758. ><A
  6759. NAME="install.commandline"
  6760. ></A
  6761. >Servers-CGI/Commandline</H2
  6762. ><P
  6763. >     The default is to build PHP as a CGI program.  This creates a
  6764.     commandline interpreter, which can be used for CGI processing, or
  6765.     for non-web-related PHP scripting.  If you are running a web
  6766.     server PHP has module support for, you should generally go for
  6767.     that solution for performance reasons.  However, the CGI version
  6768.     enables Apache users to run different PHP-enabled pages under
  6769.     different user-ids.  Please make sure you read through the <A
  6770. HREF="#security.index"
  6771. >Security chapter</A
  6772. > if you are going to
  6773.     run PHP as a CGI.
  6774.    </P
  6775. ><P
  6776. >     As of PHP 4.3.0, some important additions have happened to PHP.  A new
  6777.     SAPI named CLI also exists and it has the same name as the CGI binary.
  6778.     What is installed at <TT
  6779. CLASS="literal"
  6780. >{PREFIX}/bin/php</TT
  6781. > depends on your
  6782.     configure line and this is described in detail in the manual section
  6783.     named <A
  6784. HREF="#features.commandline"
  6785. >Using PHP from the command
  6786.     line</A
  6787. >. For further details please read that section of the manual.
  6788.    </P
  6789. ><DIV
  6790. CLASS="sect2"
  6791. ><HR><H3
  6792. CLASS="sect2"
  6793. ><A
  6794. NAME="install.commandline.testing"
  6795. ></A
  6796. >Testing</H3
  6797. ><P
  6798. >      If you have built PHP as a CGI program, you may test your build
  6799.      by typing <B
  6800. CLASS="command"
  6801. >make test</B
  6802. >.  It is always a good idea
  6803.      to test your build.  This way you may catch a problem with PHP on
  6804.      your platform early instead of having to struggle with it later.
  6805.     </P
  6806. ></DIV
  6807. ><DIV
  6808. CLASS="sect2"
  6809. ><HR><H3
  6810. CLASS="sect2"
  6811. ><A
  6812. NAME="install.commandline.benchmarking"
  6813. ></A
  6814. >Benchmarking</H3
  6815. ><P
  6816. >      If you have built PHP 3 as a CGI program, you may benchmark your
  6817.      build by typing <B
  6818. CLASS="command"
  6819. >make bench</B
  6820. >. Note that if 
  6821.      <A
  6822. HREF="#ini.safe-mode"
  6823. >bezpeΦn² re╛im</A
  6824. > is on by default, the benchmark may not be able to finish if
  6825.      it takes longer then the 30 seconds allowed. This is because the
  6826.      <A
  6827. HREF="#function.set-time-limit"
  6828. ><B
  6829. CLASS="function"
  6830. >set_time_limit()</B
  6831. ></A
  6832. > can not be used in 
  6833.      <A
  6834. HREF="#ini.safe-mode"
  6835. >bezpeΦn² re╛im</A
  6836. >. Use the <A
  6837. HREF="#ini.max-execution-time"
  6838. >max_execution_time</A
  6839. >
  6840.      configuration setting to control this time for your own
  6841.      scripts. <B
  6842. CLASS="command"
  6843. >make bench</B
  6844. > ignores the <A
  6845. HREF="#configuration.file"
  6846. >configuration file</A
  6847. >.
  6848.     </P
  6849. ><DIV
  6850. CLASS="note"
  6851. ><BLOCKQUOTE
  6852. CLASS="note"
  6853. ><P
  6854. ><B
  6855. >Poznßmka: </B
  6856. >
  6857.         <B
  6858. CLASS="command"
  6859. >make bench</B
  6860. > is only available for PHP 3.
  6861.      </P
  6862. ></BLOCKQUOTE
  6863. ></DIV
  6864. ></DIV
  6865. ><DIV
  6866. CLASS="sect2"
  6867. ><HR><H3
  6868. CLASS="sect2"
  6869. ><A
  6870. NAME="install.commandline.using-variables"
  6871. ></A
  6872. >Using Variables</H3
  6873. ><P
  6874. >       Some server supplied environment variables are not defined in the
  6875.       current <A
  6876. HREF="http://hoohoo.ncsa.uiuc.edu/cgi/env.html"
  6877. TARGET="_top"
  6878. >CGI/1.1 specification</A
  6879. >.
  6880.       Only the following variables are defined there; everything else 
  6881.       should be treated as 'vendor extensions': AUTH_TYPE, CONTENT_LENGTH, CONTENT_TYPE,
  6882.       GATEWAY_INTERFACE, PATH_INFO, PATH_TRANSLATED, QUERY_STRING,
  6883.       REMOTE_ADDR, REMOTE_HOST, REMOTE_IDENT, REMOTE_USER,
  6884.       REQUEST_METHOD, SCRIPT_NAME, SERVER_NAME, SERVER_PORT,
  6885.       SERVER_PROTOCOL and SERVER_SOFTWARE
  6886.     </P
  6887. ></DIV
  6888. ></DIV
  6889. ><DIV
  6890. CLASS="sect1"
  6891. ><HR><H2
  6892. CLASS="sect1"
  6893. ><A
  6894. NAME="install.apache"
  6895. ></A
  6896. >Servers-Apache</H2
  6897. ><P
  6898. >     This section contains notes and hints specific to Apache installs
  6899.     of PHP, both for <A
  6900. HREF="#install.apache.unix"
  6901. >Unix</A
  6902. > and
  6903.     <A
  6904. HREF="#install.apache.windows"
  6905. >Windows</A
  6906. > versions. We also
  6907.     have <A
  6908. HREF="#install.apache2"
  6909. >instructions and notes for Apache 2
  6910.     on a separate page</A
  6911. >.
  6912.    </P
  6913. ><DIV
  6914. CLASS="sect2"
  6915. ><HR><H3
  6916. CLASS="sect2"
  6917. ><A
  6918. NAME="install.apache.unix"
  6919. ></A
  6920. >Details of installing PHP with Apache on Unix</H3
  6921. ><P
  6922. >      You can select arguments to add to the
  6923.      <B
  6924. CLASS="command"
  6925. >configure</B
  6926. > on line 10 below from the <A
  6927. HREF="#install.configure"
  6928. >Complete list of configure
  6929.      options</A
  6930. >. The version numbers have been omitted here, to
  6931.      ensure the instructions are not incorrect. You will need to replace
  6932.      the 'xxx' here with the correct values from your files.
  6933.     </P
  6934. ><TABLE
  6935. WIDTH="100%"
  6936. BORDER="0"
  6937. CELLPADDING="0"
  6938. CELLSPACING="0"
  6939. CLASS="EXAMPLE"
  6940. ><TR
  6941. ><TD
  6942. ><DIV
  6943. CLASS="example"
  6944. ><A
  6945. NAME="install.apache.unix.longer"
  6946. ></A
  6947. ><P
  6948. ><B
  6949. >P°φklad 3-4. 
  6950.       Installation Instructions (Apache Shared Module Version) for PHP
  6951.      </B
  6952. ></P
  6953. ><TABLE
  6954. BORDER="0"
  6955. BGCOLOR="#E0E0E0"
  6956. CELLPADDING="5"
  6957. ><TR
  6958. ><TD
  6959. ><PRE
  6960. CLASS="screen"
  6961. >1.  gunzip apache_xxx.tar.gz
  6962. 2.  tar -xvf apache_xxx.tar
  6963. 3.  gunzip php-xxx.tar.gz
  6964. 4.  tar -xvf php-xxx.tar
  6965. 5.  cd apache_xxx
  6966. 6.  ./configure --prefix=/www --enable-module=so
  6967. 7.  make
  6968. 8.  make install
  6969. 9.  cd ../php-xxx
  6970.  
  6971. 10. Now, configure your PHP.  This is where you customize your PHP
  6972.     with various options, like which extensions will be enabled.  Do a
  6973.     ./configure --help for a list of available options.  In our example
  6974.     we'll do a simple configure with Apache 1 and MySQL support.  Your
  6975.     path to apxs may differ from our example.
  6976.  
  6977.       ./configure --with-mysql --with-apxs=/www/bin/apxs
  6978.  
  6979. 11. make
  6980. 12. make install
  6981.  
  6982.     If you decide to change your configure options after installation,
  6983.     you only need to repeat the last three steps. You only need to 
  6984.     restart apache for the new module to take effect. A recompile of
  6985.     Apache is not needed.
  6986.   
  6987.     Note that unless told otherwise, 'make install' will also install PEAR,
  6988.     various PHP tools such as phpize, install the PHP CLI, and more.
  6989.  
  6990. 13. Setup your php.ini file:
  6991.  
  6992.       cp php.ini-dist /usr/local/lib/php.ini
  6993.  
  6994.     You may edit your .ini file to set PHP options.  If you prefer your
  6995.     php.ini in another location, use --with-config-file-path=/some/path in
  6996.     step 10. 
  6997.     
  6998.     If you instead choose php.ini-recommended, be certain to read the list
  6999.     of changes within, as they affect how PHP behaves.
  7000.  
  7001. 14. Edit your httpd.conf to load the PHP module.  The path on the right hand
  7002.     side of the LoadModule statement must point to the path of the PHP
  7003.     module on your system.  The make install from above may have already
  7004.     added this for you, but be sure to check.
  7005.         
  7006.     For PHP 4:
  7007.             
  7008.       LoadModule php4_module libexec/libphp4.so
  7009.  
  7010.     For PHP 5:
  7011.                       
  7012.       LoadModule php5_module libexec/libphp5.so
  7013.       
  7014. 15. And in the AddModule section of httpd.conf, somewhere under the
  7015.     ClearModuleList, add this:
  7016.     
  7017.     For PHP 4:
  7018.     
  7019.       AddModule mod_php4.c
  7020.       
  7021.     For PHP 5:
  7022.     
  7023.       AddModule mod_php5.c
  7024.  
  7025. 16. Tell Apache to parse certain extensions as PHP.  For example,
  7026.     let's have Apache parse the .php extension as PHP.  You could
  7027.     have any extension(s) parse as PHP by simply adding more, with
  7028.     each separated by a space.  We'll add .phtml to demonstrate.
  7029.  
  7030.       AddType application/x-httpd-php .php .phtml
  7031.  
  7032.     It's also common to setup the .phps extension to show highlighted PHP
  7033.     source, this can be done with:
  7034.     
  7035.       AddType application/x-httpd-php-source .phps
  7036.  
  7037. 17. Use your normal procedure for starting the Apache server. (You must
  7038.     stop and restart the server, not just cause the server to reload by
  7039.     use a HUP or USR1 signal.)</PRE
  7040. ></TD
  7041. ></TR
  7042. ></TABLE
  7043. ></DIV
  7044. ></TD
  7045. ></TR
  7046. ></TABLE
  7047. ><P
  7048. >       Depending on your Apache install and Unix variant, there are many
  7049.       possible ways to stop and restart the server. Below are some typical
  7050.       lines used in restarting the server, for different apache/unix
  7051.       installations. You should replace <TT
  7052. CLASS="literal"
  7053. >/path/to/</TT
  7054. > with
  7055.       the path to these applications on your systems.
  7056.      </P
  7057. ><P
  7058. >       <TABLE
  7059. WIDTH="100%"
  7060. BORDER="0"
  7061. CELLPADDING="0"
  7062. CELLSPACING="0"
  7063. CLASS="EXAMPLE"
  7064. ><TR
  7065. ><TD
  7066. ><DIV
  7067. CLASS="example"
  7068. ><A
  7069. NAME="AEN1336"
  7070. ></A
  7071. ><P
  7072. ><B
  7073. >P°φklad 3-5. Example commands for restarting Apache</B
  7074. ></P
  7075. ><TABLE
  7076. BORDER="0"
  7077. BGCOLOR="#E0E0E0"
  7078. CELLPADDING="5"
  7079. ><TR
  7080. ><TD
  7081. ><PRE
  7082. CLASS="shell"
  7083. >1. Several Linux and SysV variants:
  7084. /etc/rc.d/init.d/httpd restart
  7085.  
  7086. 2. Using apachectl scripts:
  7087. /path/to/apachectl stop
  7088. /path/to/apachectl start
  7089.  
  7090. 3. httpdctl and httpsdctl (Using OpenSSL), similar to apachectl:
  7091. /path/to/httpsdctl stop
  7092. /path/to/httpsdctl start
  7093.  
  7094. 4. Using mod_ssl, or another SSL server, you may want to manually
  7095. stop and start:
  7096. /path/to/apachectl stop
  7097. /path/to/apachectl startssl</PRE
  7098. ></TD
  7099. ></TR
  7100. ></TABLE
  7101. ></DIV
  7102. ></TD
  7103. ></TR
  7104. ></TABLE
  7105. >
  7106.      </P
  7107. ><P
  7108. >       The locations of the apachectl and http(s)dctl binaries often
  7109.       vary. If your system has <TT
  7110. CLASS="literal"
  7111. >locate</TT
  7112. > or
  7113.       <TT
  7114. CLASS="literal"
  7115. >whereis</TT
  7116. > or <TT
  7117. CLASS="literal"
  7118. >which</TT
  7119. > commands,
  7120.       these can assist you in finding your server control programs.
  7121.      </P
  7122. ><P
  7123. >       Different examples of compiling PHP for apache are as follows:
  7124.       <DIV
  7125. CLASS="informalexample"
  7126. ><A
  7127. NAME="AEN1344"
  7128. ></A
  7129. ><P
  7130. ></P
  7131. ><TABLE
  7132. BORDER="0"
  7133. BGCOLOR="#E0E0E0"
  7134. CELLPADDING="5"
  7135. ><TR
  7136. ><TD
  7137. ><PRE
  7138. CLASS="shell"
  7139. >./configure --with-apxs --with-pgsql</PRE
  7140. ></TD
  7141. ></TR
  7142. ></TABLE
  7143. ><P
  7144. ></P
  7145. ></DIV
  7146. >
  7147.      </P
  7148. ><P
  7149. >       This will create a <TT
  7150. CLASS="filename"
  7151. >libphp4.so</TT
  7152. > shared
  7153.       library that is loaded into Apache using a LoadModule line in
  7154.       Apache's <TT
  7155. CLASS="filename"
  7156. >httpd.conf</TT
  7157. > file. The PostgreSQL
  7158.       support is embedded into this <TT
  7159. CLASS="filename"
  7160. >libphp4.so</TT
  7161. >
  7162.       library.
  7163.      </P
  7164. ><P
  7165. >       <DIV
  7166. CLASS="informalexample"
  7167. ><A
  7168. NAME="AEN1351"
  7169. ></A
  7170. ><P
  7171. ></P
  7172. ><TABLE
  7173. BORDER="0"
  7174. BGCOLOR="#E0E0E0"
  7175. CELLPADDING="5"
  7176. ><TR
  7177. ><TD
  7178. ><PRE
  7179. CLASS="programlisting"
  7180. >./configure --with-apxs --with-pgsql=shared</PRE
  7181. ></TD
  7182. ></TR
  7183. ></TABLE
  7184. ><P
  7185. ></P
  7186. ></DIV
  7187. >
  7188.      </P
  7189. ><P
  7190. >       This will create a <TT
  7191. CLASS="filename"
  7192. >libphp4.so</TT
  7193. > shared
  7194.       library for Apache, but it will also create a
  7195.       <TT
  7196. CLASS="filename"
  7197. >pgsql.so</TT
  7198. > shared library that is loaded into
  7199.       PHP either by using the extension directive in
  7200.       <TT
  7201. CLASS="filename"
  7202. >php.ini</TT
  7203. > file or by loading it explicitly in
  7204.       a script using the <A
  7205. HREF="#function.dl"
  7206. ><B
  7207. CLASS="function"
  7208. >dl()</B
  7209. ></A
  7210. > function.
  7211.      </P
  7212. ><P
  7213. >       <DIV
  7214. CLASS="informalexample"
  7215. ><A
  7216. NAME="AEN1359"
  7217. ></A
  7218. ><P
  7219. ></P
  7220. ><TABLE
  7221. BORDER="0"
  7222. BGCOLOR="#E0E0E0"
  7223. CELLPADDING="5"
  7224. ><TR
  7225. ><TD
  7226. ><PRE
  7227. CLASS="programlisting"
  7228. >./configure --with-apache=/path/to/apache_source --with-pgsql</PRE
  7229. ></TD
  7230. ></TR
  7231. ></TABLE
  7232. ><P
  7233. ></P
  7234. ></DIV
  7235. >
  7236.      </P
  7237. ><P
  7238. >       This will create a <TT
  7239. CLASS="filename"
  7240. >libmodphp4.a</TT
  7241. > library, a
  7242.       <TT
  7243. CLASS="filename"
  7244. >mod_php4.c</TT
  7245. > and some accompanying files and
  7246.       copy this into the <TT
  7247. CLASS="literal"
  7248. >src/modules/php4</TT
  7249. > directory
  7250.       in the Apache source tree. Then you compile Apache using
  7251.       <TT
  7252. CLASS="literal"
  7253. >--activate-module=src/modules/php4/libphp4.a</TT
  7254. >
  7255.       and the Apache build system will create
  7256.       <TT
  7257. CLASS="filename"
  7258. >libphp4.a</TT
  7259. > and link it statically into the
  7260.       <TT
  7261. CLASS="filename"
  7262. >httpd</TT
  7263. > binary. The PostgreSQL support is
  7264.       included directly into this <TT
  7265. CLASS="filename"
  7266. >httpd</TT
  7267. > binary,
  7268.       so the final result here is a single <TT
  7269. CLASS="filename"
  7270. >httpd</TT
  7271. >
  7272.       binary that includes all of Apache and all of PHP.
  7273.      </P
  7274. ><P
  7275. >       <DIV
  7276. CLASS="informalexample"
  7277. ><A
  7278. NAME="AEN1371"
  7279. ></A
  7280. ><P
  7281. ></P
  7282. ><TABLE
  7283. BORDER="0"
  7284. BGCOLOR="#E0E0E0"
  7285. CELLPADDING="5"
  7286. ><TR
  7287. ><TD
  7288. ><PRE
  7289. CLASS="programlisting"
  7290. >./configure --with-apache=/path/to/apache_source --with-pgsql=shared</PRE
  7291. ></TD
  7292. ></TR
  7293. ></TABLE
  7294. ><P
  7295. ></P
  7296. ></DIV
  7297. >
  7298.      </P
  7299. ><P
  7300. >       Same as before, except instead of including PostgreSQL support
  7301.       directly into the final <TT
  7302. CLASS="filename"
  7303. >httpd</TT
  7304. > you will get
  7305.       a <TT
  7306. CLASS="filename"
  7307. >pgsql.so</TT
  7308. > shared library that you can load
  7309.       into PHP from either the <TT
  7310. CLASS="filename"
  7311. >php.ini</TT
  7312. > file or
  7313.       directly using <A
  7314. HREF="#function.dl"
  7315. ><B
  7316. CLASS="function"
  7317. >dl()</B
  7318. ></A
  7319. >.
  7320.      </P
  7321. ><P
  7322. >       When choosing to build PHP in different ways, you should consider
  7323.       the advantages and drawbacks of each method. Building as a shared
  7324.       object will mean that you can compile apache separately, and don't
  7325.       have to recompile everything as you add to, or change, PHP.
  7326.       Building PHP into apache (static method) means that PHP will
  7327.       load and run faster. For more information, see the Apache
  7328.       <A
  7329. HREF="http://httpd.apache.org/docs/dso.html"
  7330. TARGET="_top"
  7331. >webpage on DSO support</A
  7332. >.
  7333.      </P
  7334. ><DIV
  7335. CLASS="note"
  7336. ><BLOCKQUOTE
  7337. CLASS="note"
  7338. ><P
  7339. ><B
  7340. >Poznßmka: </B
  7341. >
  7342.       Apache's default <TT
  7343. CLASS="filename"
  7344. >httpd.conf</TT
  7345. > currently ships with a section that looks
  7346.       like this:
  7347.       <DIV
  7348. CLASS="informalexample"
  7349. ><A
  7350. NAME="AEN1383"
  7351. ></A
  7352. ><P
  7353. ></P
  7354. ><TABLE
  7355. BORDER="0"
  7356. BGCOLOR="#E0E0E0"
  7357. CELLPADDING="5"
  7358. ><TR
  7359. ><TD
  7360. ><PRE
  7361. CLASS="programlisting"
  7362. >User nobody
  7363. Group "#-1"</PRE
  7364. ></TD
  7365. ></TR
  7366. ></TABLE
  7367. ><P
  7368. ></P
  7369. ></DIV
  7370. >
  7371.       Unless you change that to "Group nogroup" or something like that ("Group daemon" is
  7372.       also very common) PHP will not be able to open files.
  7373.      </P
  7374. ></BLOCKQUOTE
  7375. ></DIV
  7376. ><DIV
  7377. CLASS="note"
  7378. ><BLOCKQUOTE
  7379. CLASS="note"
  7380. ><P
  7381. ><B
  7382. >Poznßmka: </B
  7383. >
  7384.      Make sure you specify the installed version of apxs when using
  7385.      <TT
  7386. CLASS="option"
  7387. >--with-apxs=/path/to/apxs</TT
  7388. >.
  7389.      You must NOT use the apxs version that is in the apache sources but the one
  7390.      that is actually installed on your system.
  7391.      </P
  7392. ></BLOCKQUOTE
  7393. ></DIV
  7394. ></DIV
  7395. ><DIV
  7396. CLASS="sect2"
  7397. ><HR><H3
  7398. CLASS="sect2"
  7399. ><A
  7400. NAME="install.apache.windows"
  7401. ></A
  7402. >Installing PHP on Windows with Apache 1.3.x</H3
  7403. ><P
  7404. >      There are two ways to set up PHP to work with Apache 1.3.x
  7405.      on Windows. One is to use the CGI binary (php.exe),
  7406.      the other is to use the Apache module DLL. In either case
  7407.      you need to stop the Apache server, and edit your
  7408.      <TT
  7409. CLASS="filename"
  7410. >httpd.conf</TT
  7411. > to configure Apache to work with PHP.
  7412.     </P
  7413. ><P
  7414. >      It is worth noting here that now the SAPI module has been 
  7415.      made more stable under Windows, we recommend it's use above
  7416.      the CGI binary, since it is more transparent and secure.
  7417.     </P
  7418. ><P
  7419. >      Although there can be a few variations of configuring PHP
  7420.      under Apache, these are simple enough to be used by the
  7421.      newcomer. Please consult the Apache Docs for further
  7422.      configuration directives.
  7423.     </P
  7424. ><P
  7425. >      If you unziped the PHP package to <TT
  7426. CLASS="filename"
  7427. >c:\php\</TT
  7428. > as described
  7429.      in the <A
  7430. HREF="#install.windows.manual"
  7431. >Manual
  7432.      Installation Steps</A
  7433. > section, you need to insert
  7434.      these lines to your Apache configuration file to set
  7435.      up the CGI binary:
  7436.      <P
  7437. ></P
  7438. ><UL
  7439. ><LI
  7440. ><P
  7441. >         <TT
  7442. CLASS="literal"
  7443. >          ScriptAlias /php/ "c:/php/"
  7444.         </TT
  7445. >
  7446.        </P
  7447. ></LI
  7448. ><LI
  7449. ><P
  7450. >         <TT
  7451. CLASS="literal"
  7452. >          AddType application/x-httpd-php .php .phtml
  7453.         </TT
  7454. >
  7455.        </P
  7456. ></LI
  7457. ><LI
  7458. ><P
  7459. >         <TT
  7460. CLASS="literal"
  7461. >          Action application/x-httpd-php "/php/php.exe"
  7462.         </TT
  7463. >
  7464.        </P
  7465. ></LI
  7466. ></UL
  7467. >
  7468.      Note that the second line in the list above can be found
  7469.      in the actual versions of <TT
  7470. CLASS="filename"
  7471. >httpd.conf</TT
  7472. >, but it is commented out. Remember
  7473.      also to substitute the <TT
  7474. CLASS="filename"
  7475. >c:/php/</TT
  7476. > for your actual path to
  7477.      PHP.
  7478.      </P
  7479. ><DIV
  7480. CLASS="warning"
  7481. ><P
  7482. ></P
  7483. ><TABLE
  7484. CLASS="warning"
  7485. BORDER="1"
  7486. WIDTH="100%"
  7487. ><TR
  7488. ><TD
  7489. ALIGN="CENTER"
  7490. ><B
  7491. >Varovßnφ</B
  7492. ></TD
  7493. ></TR
  7494. ><TR
  7495. ><TD
  7496. ALIGN="LEFT"
  7497. ><P
  7498. >       By using the CGI setup, your server is open
  7499.       to several possible attacks. Please read
  7500.       our <A
  7501. HREF="#security.cgi-bin"
  7502. >CGI security 
  7503.       section</A
  7504. > to learn how to defend yourself from attacks.
  7505.      </P
  7506. ></TD
  7507. ></TR
  7508. ></TABLE
  7509. ></DIV
  7510. ><P
  7511. >      If you would like to use PHP as a module in Apache, be sure to copy
  7512.      <TT
  7513. CLASS="filename"
  7514. >php4ts.dll</TT
  7515. > to the <TT
  7516. CLASS="filename"
  7517. >windows/system</TT
  7518. >
  7519.      (for Windows 9x/Me), <TT
  7520. CLASS="filename"
  7521. >winnt/system32</TT
  7522. > (for Windows
  7523.      NT/2000) or <TT
  7524. CLASS="filename"
  7525. >windows/system32</TT
  7526. > (for Windows XP)
  7527.      directory, overwriting any older file. Then you should add the following
  7528.      lines to your Apache <TT
  7529. CLASS="filename"
  7530. >httpd.conf</TT
  7531. > file:
  7532.      <P
  7533. ></P
  7534. ><UL
  7535. ><LI
  7536. ><P
  7537. >         Open <TT
  7538. CLASS="filename"
  7539. >httpd.conf</TT
  7540. > with your favorite editor and locate the
  7541.         <TT
  7542. CLASS="literal"
  7543. >LoadModule</TT
  7544. > directive and add the following line
  7545.         <SPAN
  7546. CLASS="emphasis"
  7547. ><I
  7548. CLASS="emphasis"
  7549. >at the end</I
  7550. ></SPAN
  7551. > of the list for PHP 4:
  7552.         <TT
  7553. CLASS="literal"
  7554. >LoadModule php4_module "c:/php/sapi/php4apache.dll"</TT
  7555. >
  7556.         or the following for PHP 5:
  7557.         <TT
  7558. CLASS="literal"
  7559. >LoadModule php5_module "c:/php/sapi/php5apache.dll"</TT
  7560. >
  7561.        </P
  7562. ></LI
  7563. ><LI
  7564. ><P
  7565. >         You may find after using the Windows installer for Apache that you need
  7566.         to define the <TT
  7567. CLASS="literal"
  7568. >AddModule</TT
  7569. > directive for
  7570.         <TT
  7571. CLASS="filename"
  7572. >mod_php4.c</TT
  7573. >. This is especially important if the
  7574.         <TT
  7575. CLASS="literal"
  7576. >ClearModuleList</TT
  7577. > directive is defined, which you will
  7578.         find by scrolling down a few lines. You will see a list of
  7579.         <TT
  7580. CLASS="literal"
  7581. >AddModule</TT
  7582. > entries, add the following line
  7583.         <SPAN
  7584. CLASS="emphasis"
  7585. ><I
  7586. CLASS="emphasis"
  7587. >at the end</I
  7588. ></SPAN
  7589. > of the list:      
  7590.         <TT
  7591. CLASS="literal"
  7592. >AddModule mod_php4.c</TT
  7593. >  For PHP 5, instead use
  7594.         <TT
  7595. CLASS="literal"
  7596. >AddModule mod_php5.c</TT
  7597. >
  7598.        </P
  7599. ></LI
  7600. ><LI
  7601. ><P
  7602. >          Search for a phrase similar to
  7603.          <TT
  7604. CLASS="literal"
  7605. ># AddType allows you to tweak mime.types</TT
  7606. >. You will
  7607.          see some <TT
  7608. CLASS="literal"
  7609. >AddType</TT
  7610. > entries, add the following line
  7611.          <SPAN
  7612. CLASS="emphasis"
  7613. ><I
  7614. CLASS="emphasis"
  7615. >at the end</I
  7616. ></SPAN
  7617. > of the list: 
  7618.          <TT
  7619. CLASS="literal"
  7620. >AddType application/x-httpd-php .php</TT
  7621. >.
  7622.          You can choose any extension you want to parse through PHP here. .php
  7623.          is simply the one we suggest. You can even include .html, and .php3
  7624.          can be added for backwards compatibility.
  7625.        </P
  7626. ></LI
  7627. ></UL
  7628. >
  7629.     </P
  7630. ><P
  7631. >      After changing the configuration file, remember to restart the server, for
  7632.      example, <B
  7633. CLASS="command"
  7634. >NET STOP APACHE</B
  7635. > followed by
  7636.      <B
  7637. CLASS="command"
  7638. >NET START APACHE</B
  7639. >, if you run Apache as a Windows
  7640.      Service, or use your regular shortcuts.
  7641.     </P
  7642. ><P
  7643. >      There are two ways you can use the source code highlighting feature,
  7644.      however their ability to work depends on your installation. If you have
  7645.      configured Apache to use PHP as an SAPI module, then by adding the
  7646.      following line to your <TT
  7647. CLASS="filename"
  7648. >httpd.conf</TT
  7649. > (at the same place you inserted
  7650.      <TT
  7651. CLASS="literal"
  7652. >AddType application/x-httpd-php .php</TT
  7653. >, see above) you can
  7654.      use this feature:
  7655.      <TT
  7656. CLASS="literal"
  7657. >AddType application/x-httpd-php-source .phps</TT
  7658. >.
  7659.     </P
  7660. ><P
  7661. >      If you chose to configure Apache to use PHP as a CGI binary, you
  7662.      will need to use the <A
  7663. HREF="#function.show-source"
  7664. ><B
  7665. CLASS="function"
  7666. >show_source()</B
  7667. ></A
  7668. > function. To
  7669.      do this simply create a PHP script file and add this code: 
  7670.      <TT
  7671. CLASS="literal"
  7672. ><?php show_source ("original_php_script.php"); ?></TT
  7673. >. 
  7674.      Substitute <TT
  7675. CLASS="literal"
  7676. >original_php_script.php</TT
  7677. > with 
  7678.      the name of the file you wish to show the source of. 
  7679.     </P
  7680. ><DIV
  7681. CLASS="note"
  7682. ><BLOCKQUOTE
  7683. CLASS="note"
  7684. ><P
  7685. ><B
  7686. >Poznßmka: </B
  7687. >
  7688.       On Win-Apache all backslashes in a path statement such
  7689.       as "c:\directory\file.ext", must be converted to
  7690.       forward slashes, as "c:/directory/file.ext".
  7691.      </P
  7692. ></BLOCKQUOTE
  7693. ></DIV
  7694. ></DIV
  7695. ></DIV
  7696. ><DIV
  7697. CLASS="sect1"
  7698. ><HR><H2
  7699. CLASS="sect1"
  7700. ><A
  7701. NAME="install.apache2"
  7702. ></A
  7703. >Servers-Apache 2.0</H2
  7704. ><P
  7705. >     This section contains notes and hints specific to Apache 2.0 installs
  7706.     of <TT
  7707. CLASS="literal"
  7708. >PHP</TT
  7709. >, both for
  7710.     <A
  7711. HREF="#install.apache2.unix"
  7712. >Unix</A
  7713. >
  7714.     and <A
  7715. HREF="#install.apache2.windows"
  7716. >Windows</A
  7717. > versions.
  7718.    </P
  7719. ><DIV
  7720. CLASS="warning"
  7721. ><P
  7722. ></P
  7723. ><TABLE
  7724. CLASS="warning"
  7725. BORDER="1"
  7726. WIDTH="100%"
  7727. ><TR
  7728. ><TD
  7729. ALIGN="CENTER"
  7730. ><B
  7731. >Varovßnφ</B
  7732. ></TD
  7733. ></TR
  7734. ><TR
  7735. ><TD
  7736. ALIGN="LEFT"
  7737. ><P
  7738. >      Do not use Apache 2.0 and <TT
  7739. CLASS="literal"
  7740. >PHP</TT
  7741. > in a production
  7742.      environment neither on Unix nor on Windows.
  7743.     </P
  7744. ></TD
  7745. ></TR
  7746. ></TABLE
  7747. ></DIV
  7748. ><P
  7749. >      You are highly encouraged to take a look at the
  7750.      <A
  7751. HREF="http://httpd.apache.org/docs-2.0/"
  7752. TARGET="_top"
  7753. >Apache Documentation</A
  7754. > to get
  7755.      a basic understanding of the Apache 2.0 Server.
  7756.     </P
  7757. ><DIV
  7758. CLASS="sect2"
  7759. ><HR><H3
  7760. CLASS="sect2"
  7761. ><A
  7762. NAME="compat.apache2"
  7763. ></A
  7764. >PHP and Apache 2.0 compatibility notes</H3
  7765. ><P
  7766. >      The following versions of PHP are known to work with the most recent
  7767.      version of Apache 2.0:
  7768.      <P
  7769. ></P
  7770. ><UL
  7771. COMPACT="COMPACT"
  7772. ><LI
  7773. ><SPAN
  7774. >         PHP 4.3.0 or later available at
  7775.         <A
  7776. HREF="http://www.php.net/downloads.php"
  7777. TARGET="_top"
  7778. >http://www.php.net/downloads.php</A
  7779. >.
  7780.        </SPAN
  7781. ></LI
  7782. ><LI
  7783. ><SPAN
  7784. >         the latest stable development version.
  7785.         Get the source code <A
  7786. HREF="http://snaps.php.net/php4-latest.tar.gz"
  7787. TARGET="_top"
  7788. >         http://snaps.php.net/php4-latest.tar.gz</A
  7789. > or download binaries
  7790.         for Windows <A
  7791. HREF="http://snaps.php.net/win32/php4-win32-latest.zip"
  7792. TARGET="_top"
  7793. >         http://snaps.php.net/win32/php4-win32-latest.zip</A
  7794. >.
  7795.        </SPAN
  7796. ></LI
  7797. ><LI
  7798. ><SPAN
  7799. >         a prerelease version downloadable from
  7800.         <A
  7801. HREF="http://qa.php.net/"
  7802. TARGET="_top"
  7803. >http://qa.php.net/</A
  7804. >.
  7805.        </SPAN
  7806. ></LI
  7807. ><LI
  7808. ><SPAN
  7809. >         you have always the option to obtain <TT
  7810. CLASS="literal"
  7811. >PHP</TT
  7812. > through
  7813.         <A
  7814. HREF="http://www.php.net/anoncvs.php"
  7815. TARGET="_top"
  7816. >anonymous CVS</A
  7817. >.
  7818.        </SPAN
  7819. ></LI
  7820. ></UL
  7821. >
  7822.       These versions of <TT
  7823. CLASS="literal"
  7824. >PHP</TT
  7825. > are compatible to Apache 2.0.40 and later.
  7826.     </P
  7827. ><DIV
  7828. CLASS="note"
  7829. ><BLOCKQUOTE
  7830. CLASS="note"
  7831. ><P
  7832. ><B
  7833. >Poznßmka: </B
  7834. >
  7835.       Apache 2.0 <TT
  7836. CLASS="literal"
  7837. >SAPI</TT
  7838. >-support started with PHP 4.2.0.
  7839.       PHP 4.2.3 works with Apache 2.0.39, don't use any other version of Apache with
  7840.       PHP 4.2.3. However, the recommended setup is to use PHP 4.3.0 or later with
  7841.       the most recent version of Apache2.
  7842.      </P
  7843. ><P
  7844. >       All mentioned versions of <TT
  7845. CLASS="literal"
  7846. >PHP</TT
  7847. > will work still with
  7848.       Apache 1.3.x.
  7849.      </P
  7850. ></BLOCKQUOTE
  7851. ></DIV
  7852. ></DIV
  7853. ><DIV
  7854. CLASS="sect2"
  7855. ><HR><H3
  7856. CLASS="sect2"
  7857. ><A
  7858. NAME="install.apache2.unix"
  7859. ></A
  7860. >PHP and Apache 2 on Linux</H3
  7861. ><P
  7862. >      Download the most recent version of <A
  7863. HREF="http://www.apache.org/"
  7864. TARGET="_top"
  7865. >      Apache 2.0</A
  7866. > and a fitting PHP version from the above mentioned places.
  7867.      This quick guide covers only the basics to get started with Apache 2.0
  7868.      and <TT
  7869. CLASS="literal"
  7870. >PHP</TT
  7871. >. For more information read the
  7872.      <A
  7873. HREF="http://httpd.apache.org/docs-2.0/"
  7874. TARGET="_top"
  7875. >Apache Documentation</A
  7876. >.
  7877.      The version numbers have been omitted here, to ensure the
  7878.      instructions are not incorrect. You will need to replace the 'NN' here with the
  7879.      correct values from your files.
  7880.     </P
  7881. ><TABLE
  7882. WIDTH="100%"
  7883. BORDER="0"
  7884. CELLPADDING="0"
  7885. CELLSPACING="0"
  7886. CLASS="EXAMPLE"
  7887. ><TR
  7888. ><TD
  7889. ><DIV
  7890. CLASS="example"
  7891. ><A
  7892. NAME="AEN1495"
  7893. ></A
  7894. ><P
  7895. ><B
  7896. >P°φklad 3-6. 
  7897.       Installation Instructions (Apache 2 Shared Module Version)
  7898.      </B
  7899. ></P
  7900. ><TABLE
  7901. BORDER="0"
  7902. BGCOLOR="#E0E0E0"
  7903. CELLPADDING="5"
  7904. ><TR
  7905. ><TD
  7906. ><PRE
  7907. CLASS="screen"
  7908. >1.  gzip -d httpd-2_0_NN.tar.gz
  7909. 2.  tar xvf httpd-2_0_NN.tar
  7910. 3.  gunzip php-NN.tar.gz
  7911. 4.  tar -xvf php-NN.tar
  7912. 5.  cd httpd-2_0_NN
  7913. 6.  ./configure --enable-so
  7914. 7.  make
  7915. 8.  make install
  7916.  
  7917.     Now you have Apache 2.0.NN available under /usr/local/apache2,
  7918.     configured with loadable module support and the standard MPM prefork.
  7919.     To test the installation use your normal procedure for starting
  7920.     the Apache server, e.g.:
  7921.     /usr/local/apache2/bin/apachectl start
  7922.     and stop the server to go on with the configuration for PHP:
  7923.     /usr/local/apache2/bin/apachectl stop.
  7924.  
  7925. 9.  cd ../php-NN
  7926.  
  7927. 10. Now, configure your PHP.  This is where you customize your PHP
  7928.     with various options, like which extensions will be enabled.  Do a
  7929.     ./configure --help for a list of available options.  In our example
  7930.     we'll do a simple configure with Apache 2 and MySQL support.  Your
  7931.     path to apxs may differ, in fact, the binary may even be named apxs2 on
  7932.     your system. 
  7933.     
  7934.       ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
  7935.  
  7936. 11. make
  7937. 12. make install
  7938.  
  7939.     If you decide to change your configure options after installation,
  7940.     you only need to repeat the last three steps. You only need to
  7941.     restart apache for the new module to take effect. A recompile of
  7942.     Apache is not needed.
  7943.                 
  7944.     Note that unless told otherwise, 'make install' will also install PEAR,
  7945.     various PHP tools such as phpize, install the PHP CLI, and more.
  7946.     
  7947. 13. Setup your php.ini 
  7948.     
  7949.     cp php.ini-dist /usr/local/lib/php.ini
  7950.           
  7951.     You may edit your .ini file to set PHP options.  If you prefer having
  7952.     php.ini in another location, use --with-config-file-path=/some/path in
  7953.     step 10.
  7954.     
  7955.     If you instead choose php.ini-recommended, be certain to read the list
  7956.     of changes within, as they affect how PHP behaves.
  7957.  
  7958. 14. Edit your httpd.conf to load the PHP module.  The path on the right hand
  7959.     side of the LoadModule statement must point to the path of the PHP
  7960.     module on your system.  The make install from above may have already
  7961.     added this for you, but be sure to check.
  7962.  
  7963.     For PHP 4:
  7964.   
  7965.       LoadModule php4_module libexec/libphp4.so
  7966.       
  7967.     For PHP 5:
  7968.     
  7969.       LoadModule php5_module libexec/libphp5.so
  7970.  
  7971. 15. Tell Apache to parse certain extensions as PHP.  For example,
  7972.     let's have Apache parse the .php extension as PHP.  You could
  7973.     have any extension(s) parse as PHP by simply adding more, with
  7974.     each separated by a space.  We'll add .phtml to demonstrate.
  7975.             
  7976.       AddType application/x-httpd-php .php .phtml
  7977.                   
  7978.     It's also common to setup the .phps extension to show highlighted PHP
  7979.     source, this can be done with:
  7980.     
  7981.       AddType application/x-httpd-php-source .phps
  7982.  
  7983. 16. Use your normal procedure for starting the Apache server, e.g.:
  7984.    
  7985.       /usr/local/apache2/bin/apachectl start</PRE
  7986. ></TD
  7987. ></TR
  7988. ></TABLE
  7989. ></DIV
  7990. ></TD
  7991. ></TR
  7992. ></TABLE
  7993. ><P
  7994. >      Following the steps above you will have a running Apache 2.0 with
  7995.      support for <TT
  7996. CLASS="literal"
  7997. >PHP</TT
  7998. > as <TT
  7999. CLASS="literal"
  8000. >SAPI</TT
  8001. > module.
  8002.      Of course there are many more configuration options available for both,
  8003.      Apache and <TT
  8004. CLASS="literal"
  8005. >PHP</TT
  8006. >. For more information use
  8007.      <B
  8008. CLASS="command"
  8009. >./configure --help</B
  8010. > in the corresponding source
  8011.      tree. In case you wish to build a multithreaded version of Apache 2.0
  8012.      you must overwrite the standard MPM-Module <TT
  8013. CLASS="filename"
  8014. >prefork</TT
  8015. >
  8016.      either with <TT
  8017. CLASS="filename"
  8018. >worker</TT
  8019. > or <TT
  8020. CLASS="filename"
  8021. >perchild</TT
  8022. >.
  8023.      To do so append to your configure line in step 6 above either the option
  8024.      <TT
  8025. CLASS="option"
  8026. >--with-mpm=worker</TT
  8027. > or
  8028.      <TT
  8029. CLASS="option"
  8030. >--with-mpm=perchild</TT
  8031. >. Take care about
  8032.      the consequences and understand what you are doing. For more information
  8033.      read the Apache documentation about the <A
  8034. HREF="http://httpd.apache.org/docs-2.0/mpm.html"
  8035. TARGET="_top"
  8036. >      MPM-Modules</A
  8037. >.
  8038.     </P
  8039. ><DIV
  8040. CLASS="note"
  8041. ><BLOCKQUOTE
  8042. CLASS="note"
  8043. ><P
  8044. ><B
  8045. >Poznßmka: </B
  8046. >
  8047.       To build a multithreaded version of Apache your system must support threads.
  8048.       This also implies to build <TT
  8049. CLASS="literal"
  8050. >PHP</TT
  8051. > with experimental
  8052.       Zend Thread Safety (ZTS). Therefore not all extensions might be available.
  8053.       The recommended setup is to build Apache with the standard
  8054.       <TT
  8055. CLASS="filename"
  8056. >prefork</TT
  8057. > MPM-Module.
  8058.      </P
  8059. ></BLOCKQUOTE
  8060. ></DIV
  8061. ></DIV
  8062. ><DIV
  8063. CLASS="sect2"
  8064. ><HR><H3
  8065. CLASS="sect2"
  8066. ><A
  8067. NAME="install.apache2.windows"
  8068. ></A
  8069. >PHP and Apache 2.0 on Windows</H3
  8070. ><P
  8071. >      Consider to read the <A
  8072. HREF="http://httpd.apache.org/docs-2.0/platform/windows.html"
  8073. TARGET="_top"
  8074. >      Windows specific notes</A
  8075. > for Apache 2.0.
  8076.     </P
  8077. ><DIV
  8078. CLASS="warning"
  8079. ><P
  8080. ></P
  8081. ><TABLE
  8082. CLASS="warning"
  8083. BORDER="1"
  8084. WIDTH="100%"
  8085. ><TR
  8086. ><TD
  8087. ALIGN="CENTER"
  8088. ><B
  8089. >Varovßnφ</B
  8090. ></TD
  8091. ></TR
  8092. ><TR
  8093. ><TD
  8094. ALIGN="LEFT"
  8095. ><P
  8096. >       Apache 2.0 is designed to run on Windows NT 4.0, Windows 2000 or
  8097.       Windows XP. At this time, support for Windows 9x is incomplete.
  8098.       Apache 2.0 is not expected to work on those platforms at this time.
  8099.      </P
  8100. ></TD
  8101. ></TR
  8102. ></TABLE
  8103. ></DIV
  8104. ><P
  8105. >      Download the most recent version of <A
  8106. HREF="http://www.apache.org/"
  8107. TARGET="_top"
  8108. >      Apache 2.0</A
  8109. > and a fitting PHP version from the above mentioned places.
  8110.      Follow the <A
  8111. HREF="#install.windows.manual"
  8112. >Manual Installation Steps</A
  8113. >
  8114.      and come back to go on with the integration of <TT
  8115. CLASS="literal"
  8116. >PHP</TT
  8117. >
  8118.      and Apache.
  8119.     </P
  8120. ><P
  8121. >      There are two ways to set up <TT
  8122. CLASS="literal"
  8123. >PHP</TT
  8124. > to work with
  8125.      Apache 2.0 on Windows. One is to use the CGI binary the other is to
  8126.      use the Apache module DLL. In either case you need to stop the Apache
  8127.      server, and edit your <TT
  8128. CLASS="filename"
  8129. >httpd.conf</TT
  8130. > to configure Apache
  8131.      to work with <TT
  8132. CLASS="literal"
  8133. >PHP</TT
  8134. >.
  8135.     </P
  8136. ><P
  8137. >      You need to insert these three lines to your Apache <TT
  8138. CLASS="filename"
  8139. >httpd.conf</TT
  8140. >
  8141.      configuration file to set up the <SPAN
  8142. CLASS="emphasis"
  8143. ><I
  8144. CLASS="emphasis"
  8145. >CGI binary</I
  8146. ></SPAN
  8147. >:
  8148.      <TABLE
  8149. WIDTH="100%"
  8150. BORDER="0"
  8151. CELLPADDING="0"
  8152. CELLSPACING="0"
  8153. CLASS="EXAMPLE"
  8154. ><TR
  8155. ><TD
  8156. ><DIV
  8157. CLASS="example"
  8158. ><A
  8159. NAME="AEN1530"
  8160. ></A
  8161. ><P
  8162. ><B
  8163. >P°φklad 3-7. PHP and Apache 2.0 as CGI</B
  8164. ></P
  8165. ><TABLE
  8166. BORDER="0"
  8167. BGCOLOR="#E0E0E0"
  8168. CELLPADDING="5"
  8169. ><TR
  8170. ><TD
  8171. ><PRE
  8172. CLASS="apache"
  8173. >ScriptAlias /php/ "c:/php/"
  8174. AddType application/x-httpd-php .php
  8175. Action application/x-httpd-php "/php/php.exe"</PRE
  8176. ></TD
  8177. ></TR
  8178. ></TABLE
  8179. ></DIV
  8180. ></TD
  8181. ></TR
  8182. ></TABLE
  8183. >
  8184.     </P
  8185. ><P
  8186. >      If you would like to use <TT
  8187. CLASS="literal"
  8188. >PHP</TT
  8189. > as a module in Apache 2.0,
  8190.      be sure to move <TT
  8191. CLASS="filename"
  8192. >php4ts.dll</TT
  8193. > for PHP 4, or
  8194.      <TT
  8195. CLASS="filename"
  8196. >php5ts.dll</TT
  8197. > for PHP 5, to
  8198.      <TT
  8199. CLASS="filename"
  8200. >winnt/system32</TT
  8201. > (for Windows NT/2000) or
  8202.      <TT
  8203. CLASS="filename"
  8204. >windows/system32</TT
  8205. > (for Windows XP),
  8206.      overwriting any older file. You need to insert these two lines to your
  8207.      Apache <TT
  8208. CLASS="filename"
  8209. >httpd.conf</TT
  8210. > configuration file to set up the
  8211.      <SPAN
  8212. CLASS="emphasis"
  8213. ><I
  8214. CLASS="emphasis"
  8215. >PHP-Module</I
  8216. ></SPAN
  8217. > for Apache 2.0:
  8218.      <TABLE
  8219. WIDTH="100%"
  8220. BORDER="0"
  8221. CELLPADDING="0"
  8222. CELLSPACING="0"
  8223. CLASS="EXAMPLE"
  8224. ><TR
  8225. ><TD
  8226. ><DIV
  8227. CLASS="example"
  8228. ><A
  8229. NAME="AEN1541"
  8230. ></A
  8231. ><P
  8232. ><B
  8233. >P°φklad 3-8. PHP and Apache 2.0 as Module</B
  8234. ></P
  8235. ><TABLE
  8236. BORDER="0"
  8237. BGCOLOR="#E0E0E0"
  8238. CELLPADDING="5"
  8239. ><TR
  8240. ><TD
  8241. ><PRE
  8242. CLASS="apache"
  8243. >; For PHP 4 do something like this:
  8244. LoadModule php4_module "c:/php/sapi/php4apache2.dll"
  8245. AddType application/x-httpd-php .php
  8246.  
  8247. ; For PHP 5 do something like this:
  8248. LoadModule php5_module "c:/php/sapi/php5apache2.dll"
  8249. AddType application/x-httpd-php .php</PRE
  8250. ></TD
  8251. ></TR
  8252. ></TABLE
  8253. ></DIV
  8254. ></TD
  8255. ></TR
  8256. ></TABLE
  8257. >
  8258.     </P
  8259. ><DIV
  8260. CLASS="note"
  8261. ><BLOCKQUOTE
  8262. CLASS="note"
  8263. ><P
  8264. ><B
  8265. >Poznßmka: </B
  8266. >
  8267.       Remember to substitute the <TT
  8268. CLASS="filename"
  8269. >c:/php/</TT
  8270. > for your actual
  8271.       path to <TT
  8272. CLASS="literal"
  8273. >PHP</TT
  8274. > in the above examples. Take care to use
  8275.       either <TT
  8276. CLASS="filename"
  8277. >php4apache2.dll</TT
  8278. > or 
  8279.       <TT
  8280. CLASS="filename"
  8281. >php5apache2.dll</TT
  8282. > in your LoadModule directive and
  8283.       <SPAN
  8284. CLASS="emphasis"
  8285. ><I
  8286. CLASS="emphasis"
  8287. >not</I
  8288. ></SPAN
  8289. ><TT
  8290. CLASS="filename"
  8291. >php4apache.dll</TT
  8292. > or 
  8293.       <TT
  8294. CLASS="filename"
  8295. >php5apache.dll</TT
  8296. > as the latter ones are designed to
  8297.       run with <A
  8298. HREF="#install.apache.windows"
  8299. >Apache 1.3.x</A
  8300. >.
  8301.      </P
  8302. ></BLOCKQUOTE
  8303. ></DIV
  8304. ><DIV
  8305. CLASS="warning"
  8306. ><P
  8307. ></P
  8308. ><TABLE
  8309. CLASS="warning"
  8310. BORDER="1"
  8311. WIDTH="100%"
  8312. ><TR
  8313. ><TD
  8314. ALIGN="CENTER"
  8315. ><B
  8316. >Varovßnφ</B
  8317. ></TD
  8318. ></TR
  8319. ><TR
  8320. ><TD
  8321. ALIGN="LEFT"
  8322. ><P
  8323. >       Don't mix up your installation with dll files from
  8324.       <SPAN
  8325. CLASS="emphasis"
  8326. ><I
  8327. CLASS="emphasis"
  8328. >different PHP versions </I
  8329. ></SPAN
  8330. >. You have the only choice
  8331.       to use the dll's and extensions that ship with your downloaded PHP version.
  8332.      </P
  8333. ></TD
  8334. ></TR
  8335. ></TABLE
  8336. ></DIV
  8337. ></DIV
  8338. ></DIV
  8339. ><DIV
  8340. CLASS="sect1"
  8341. ><HR><H2
  8342. CLASS="sect1"
  8343. ><A
  8344. NAME="install.caudium"
  8345. ></A
  8346. >Servers-Caudium</H2
  8347. ><P
  8348. >     PHP 4 can be built as a Pike module for the
  8349.     <A
  8350. HREF="http://caudium.net/"
  8351. TARGET="_top"
  8352. >Caudium webserver</A
  8353. >.
  8354.     Note that this is not supported with PHP 3. Follow the simple
  8355.     instructions below to install PHP 4 for Caudium.
  8356.    </P
  8357. ><TABLE
  8358. WIDTH="100%"
  8359. BORDER="0"
  8360. CELLPADDING="0"
  8361. CELLSPACING="0"
  8362. CLASS="EXAMPLE"
  8363. ><TR
  8364. ><TD
  8365. ><DIV
  8366. CLASS="example"
  8367. ><A
  8368. NAME="install.caudium.instructions"
  8369. ></A
  8370. ><P
  8371. ><B
  8372. >P°φklad 3-9. Caudium Installation Instructions</B
  8373. ></P
  8374. ><TABLE
  8375. BORDER="0"
  8376. BGCOLOR="#E0E0E0"
  8377. CELLPADDING="5"
  8378. ><TR
  8379. ><TD
  8380. ><PRE
  8381. CLASS="screen"
  8382. >1.  Make sure you have Caudium installed prior to attempting to
  8383.     install PHP 4. For PHP 4 to work correctly, you will need Pike
  8384.     7.0.268 or newer. For the sake of this example we assume that
  8385.     Caudium is installed in /opt/caudium/server/.
  8386. 2.  Change directory to php-x.y.z (where x.y.z is the version number).
  8387. 3.  ./configure --with-caudium=/opt/caudium/server
  8388. 4.  make
  8389. 5.  make install
  8390. 6.  Restart Caudium if it's currently running.
  8391. 7.  Log into the graphical configuration interface and go to the
  8392.     virtual server where you want to add PHP 4 support.
  8393. 8.  Click Add Module and locate and then add the PHP 4 Script Support module.
  8394. 9.  If the documentation says that the 'PHP 4 interpreter isn't
  8395.     available', make sure that you restarted the server. If you did
  8396.     check /opt/caudium/logs/debug/default.1 for any errors related to
  8397.     <filename>PHP4.so</filename>. Also make sure that 
  8398.     <filename>caudium/server/lib/[pike-version]/PHP4.so</filename>
  8399.     is present.
  8400. 10. Configure the PHP Script Support module if needed.</PRE
  8401. ></TD
  8402. ></TR
  8403. ></TABLE
  8404. ></DIV
  8405. ></TD
  8406. ></TR
  8407. ></TABLE
  8408. ><P
  8409. >     You can of course compile your Caudium module with support for the
  8410.     various extensions available in PHP 4. See the 
  8411.     <A
  8412. HREF="#install.configure"
  8413. >complete list of configure
  8414.     options</A
  8415. > for an exhaustive rundown. 
  8416.    </P
  8417. ><DIV
  8418. CLASS="note"
  8419. ><BLOCKQUOTE
  8420. CLASS="note"
  8421. ><P
  8422. ><B
  8423. >Poznßmka: </B
  8424. >
  8425.      When compiling PHP 4 with MySQL support you must make sure that
  8426.      the normal MySQL client code is used. Otherwise there might be
  8427.      conflicts if your Pike already has MySQL support. You do this by
  8428.      specifying a MySQL install directory the 
  8429.      <TT
  8430. CLASS="option"
  8431. > --with-mysql</TT
  8432. > option.
  8433.     </P
  8434. ></BLOCKQUOTE
  8435. ></DIV
  8436. ></DIV
  8437. ><DIV
  8438. CLASS="sect1"
  8439. ><HR><H2
  8440. CLASS="sect1"
  8441. ><A
  8442. NAME="install.fhttpd"
  8443. ></A
  8444. >Servers-fhttpd</H2
  8445. ><P
  8446. >     To build PHP as an fhttpd module, answer "yes" to "Build as an
  8447.     fhttpd module?" (the <A
  8448. HREF="#install.configure.with-fhttpd"
  8449. >     --with-fhttpd</A
  8450. >=<TT
  8451. CLASS="replaceable"
  8452. ><I
  8453. >DIR</I
  8454. ></TT
  8455. >
  8456.     option to configure) and specify the fhttpd source base
  8457.     directory.  The default directory is <TT
  8458. CLASS="filename"
  8459. >/usr/local/src/fhttpd</TT
  8460. >. If you are
  8461.     running fhttpd, building PHP as a module will give better
  8462.     performance, more control and remote execution capability.
  8463.    </P
  8464. ><DIV
  8465. CLASS="note"
  8466. ><BLOCKQUOTE
  8467. CLASS="note"
  8468. ><P
  8469. ><B
  8470. >Poznßmka: </B
  8471. >
  8472.     Support for fhttpd is no longer available as of PHP 4.3.0.
  8473.    </P
  8474. ></BLOCKQUOTE
  8475. ></DIV
  8476. ></DIV
  8477. ><DIV
  8478. CLASS="sect1"
  8479. ><HR><H2
  8480. CLASS="sect1"
  8481. ><A
  8482. NAME="install.iis"
  8483. ></A
  8484. >Servers-IIS/PWS</H2
  8485. ><P
  8486. >     This section contains notes and hints specific to IIS (Microsoft
  8487.     Internet Information Server). Installing PHP for
  8488.     <A
  8489. HREF="#install.iis.iis3"
  8490. >PWS/IIS 3</A
  8491. >,
  8492.     <A
  8493. HREF="#install.iis.pws4"
  8494. >PWS 4 or newer</A
  8495. > and
  8496.     <A
  8497. HREF="#install.iis.iis4"
  8498. >IIS 4 or newer</A
  8499. > versions.
  8500.    </P
  8501. ><DIV
  8502. CLASS="note"
  8503. ><BLOCKQUOTE
  8504. CLASS="note"
  8505. ><P
  8506. ><B
  8507. >Important for CGI users: </B
  8508. >
  8509.      Read the <A
  8510. HREF="#faq.installation.forceredirect"
  8511. >faq
  8512.      on cgi.force_redirect</A
  8513. > for important details.  This
  8514.      directive needs to be set to <TT
  8515. CLASS="literal"
  8516. >0</TT
  8517. >.
  8518.     </P
  8519. ></BLOCKQUOTE
  8520. ></DIV
  8521. ><DIV
  8522. CLASS="sect2"
  8523. ><HR><H3
  8524. CLASS="sect2"
  8525. ><A
  8526. NAME="install.iis.iis3"
  8527. ></A
  8528. >Windows and PWS/IIS 3</H3
  8529. ><P
  8530. >      The recommended method for configuring these servers is to use
  8531.      the REG file included with the distribution
  8532.      (pws-php4cgi.reg). You may want to edit this file and make sure
  8533.      the extensions and PHP install directories match your
  8534.      configuration. Or you can follow the steps below to do it
  8535.      manually.
  8536.     </P
  8537. ><DIV
  8538. CLASS="warning"
  8539. ><P
  8540. ></P
  8541. ><TABLE
  8542. CLASS="warning"
  8543. BORDER="1"
  8544. WIDTH="100%"
  8545. ><TR
  8546. ><TD
  8547. ALIGN="CENTER"
  8548. ><B
  8549. >Varovßnφ</B
  8550. ></TD
  8551. ></TR
  8552. ><TR
  8553. ><TD
  8554. ALIGN="LEFT"
  8555. ><P
  8556. >       These steps involve working directly with the Windows
  8557.       registry. One error here can leave your system in an unstable
  8558.       state. We highly recommend that you back up your registry
  8559.       first. The PHP Development team will not be held responsible if
  8560.       you damage your registry.
  8561.      </P
  8562. ></TD
  8563. ></TR
  8564. ></TABLE
  8565. ></DIV
  8566. ><P
  8567. >      <P
  8568. ></P
  8569. ><UL
  8570. ><LI
  8571. ><P
  8572. >         Run Regedit.
  8573.        </P
  8574. ></LI
  8575. ><LI
  8576. ><P
  8577. >         Navigate to: <TT
  8578. CLASS="literal"
  8579. >HKEY_LOCAL_MACHINE /System
  8580.          /CurrentControlSet /Services /W3Svc /Parameters
  8581.          /ScriptMap</TT
  8582. >.
  8583.        </P
  8584. ></LI
  8585. ><LI
  8586. ><P
  8587. >         On the edit menu select: <TT
  8588. CLASS="literal"
  8589. >New->String Value</TT
  8590. >.
  8591.        </P
  8592. ></LI
  8593. ><LI
  8594. ><P
  8595. >         Type in the extension you wish to use for your php
  8596.         scripts. For example <TT
  8597. CLASS="literal"
  8598. >.php</TT
  8599. >
  8600.        </P
  8601. ></LI
  8602. ><LI
  8603. ><P
  8604. >         Double click on the new string value and enter the path to
  8605.         <TT
  8606. CLASS="literal"
  8607. >php.exe</TT
  8608. > in the value data field. ex:
  8609.         <TT
  8610. CLASS="literal"
  8611. >c:\php\php.exe</TT
  8612. >.
  8613.        </P
  8614. ></LI
  8615. ><LI
  8616. ><P
  8617. >         Repeat these steps for each extension you wish to associate
  8618.         with PHP scripts.
  8619.        </P
  8620. ></LI
  8621. ></UL
  8622. >
  8623.     </P
  8624. ><P
  8625. >      The following steps do not affect the web server installation
  8626.      and only apply if you want your PHP scripts to be executed when
  8627.      they are run from the command line (ex. run
  8628.      <TT
  8629. CLASS="filename"
  8630. >c:\myscripts\test.php</TT
  8631. >) or by double clicking
  8632.      on them in a directory viewer window. You may wish to skip these
  8633.      steps as you might prefer the PHP files to load into a text
  8634.      editor when you double click on them.
  8635.     </P
  8636. ><P
  8637. >      <P
  8638. ></P
  8639. ><UL
  8640. ><LI
  8641. ><P
  8642. >         Navigate to: <TT
  8643. CLASS="literal"
  8644. >HKEY_CLASSES_ROOT</TT
  8645. >
  8646.        </P
  8647. ></LI
  8648. ><LI
  8649. ><P
  8650. >         On the edit menu select: <TT
  8651. CLASS="literal"
  8652. >New->Key</TT
  8653. >.
  8654.        </P
  8655. ></LI
  8656. ><LI
  8657. ><P
  8658. >         Name the key to the extension you setup in the previous
  8659.         section. ex: <TT
  8660. CLASS="literal"
  8661. >.php</TT
  8662. >
  8663.        </P
  8664. ></LI
  8665. ><LI
  8666. ><P
  8667. >         Highlight the new key and in the right side pane, double click 
  8668.         the "default value" and enter <TT
  8669. CLASS="literal"
  8670. >phpfile</TT
  8671. >.
  8672.        </P
  8673. ></LI
  8674. ><LI
  8675. ><P
  8676. >         Repeat the last step for each extension you set up in the
  8677.         previous section.
  8678.        </P
  8679. ></LI
  8680. ><LI
  8681. ><P
  8682. >         Now create another <TT
  8683. CLASS="literal"
  8684. >New->Key</TT
  8685. > under
  8686.         <TT
  8687. CLASS="literal"
  8688. >HKEY_CLASSES_ROOT</TT
  8689. > and name it
  8690.         <TT
  8691. CLASS="literal"
  8692. >phpfile</TT
  8693. >.
  8694.        </P
  8695. ></LI
  8696. ><LI
  8697. ><P
  8698. >         Highlight the new key <TT
  8699. CLASS="literal"
  8700. >phpfile</TT
  8701. > and in the
  8702.         right side pane, double click the "default value" and enter
  8703.         <TT
  8704. CLASS="literal"
  8705. >PHP Script</TT
  8706. >.
  8707.        </P
  8708. ></LI
  8709. ><LI
  8710. ><P
  8711. >         Right click on the <TT
  8712. CLASS="literal"
  8713. >phpfile</TT
  8714. > key and select
  8715.         <TT
  8716. CLASS="literal"
  8717. >New->Key</TT
  8718. >, name it <TT
  8719. CLASS="literal"
  8720. >Shell</TT
  8721. >.
  8722.        </P
  8723. ></LI
  8724. ><LI
  8725. ><P
  8726. >         Right click on the <TT
  8727. CLASS="literal"
  8728. >Shell</TT
  8729. > key and select
  8730.         <TT
  8731. CLASS="literal"
  8732. >New->Key</TT
  8733. >, name it <TT
  8734. CLASS="literal"
  8735. >open</TT
  8736. >.
  8737.        </P
  8738. ></LI
  8739. ><LI
  8740. ><P
  8741. >         Right click on the <TT
  8742. CLASS="literal"
  8743. >open</TT
  8744. > key and select
  8745.         <TT
  8746. CLASS="literal"
  8747. >New->Key</TT
  8748. >, name it
  8749.         <TT
  8750. CLASS="literal"
  8751. >command</TT
  8752. >. 
  8753.        </P
  8754. ></LI
  8755. ><LI
  8756. ><P
  8757. >         Highlight the new key <TT
  8758. CLASS="literal"
  8759. >command</TT
  8760. > and in the
  8761.         right side pane, double click the "default value" and enter
  8762.         the path to <TT
  8763. CLASS="literal"
  8764. >php.exe</TT
  8765. >. ex:
  8766.         <TT
  8767. CLASS="literal"
  8768. >c:\php\php.exe -q %1</TT
  8769. >. (don't forget the
  8770.         <TT
  8771. CLASS="literal"
  8772. >%1</TT
  8773. >). 
  8774.        </P
  8775. ></LI
  8776. ><LI
  8777. ><P
  8778. >         Exit Regedit.
  8779.        </P
  8780. ></LI
  8781. ><LI
  8782. ><P
  8783. >         If using PWS on Windows, reboot to reload the registry.
  8784.        </P
  8785. ></LI
  8786. ></UL
  8787. >
  8788.     </P
  8789. ><P
  8790. >      PWS and IIS 3 users now have a fully operational system. IIS 3
  8791.      users can use a nifty <A
  8792. HREF="http://www.genusa.com/iis/iiscfg.html"
  8793. TARGET="_top"
  8794. >tool</A
  8795. >
  8796.      from Steven Genusa to configure their script maps.
  8797.     </P
  8798. ></DIV
  8799. ><DIV
  8800. CLASS="sect2"
  8801. ><HR><H3
  8802. CLASS="sect2"
  8803. ><A
  8804. NAME="install.iis.pws4"
  8805. ></A
  8806. >Windows and PWS 4 or newer</H3
  8807. ><P
  8808. >      When installing PHP on Windows with PWS 4 or newer version,
  8809.      you have two options. One to set up the PHP CGI binary,
  8810.      the other is to use the ISAPI module DLL.
  8811.     </P
  8812. ><P
  8813. >      If you choose the CGI binary, do the following:
  8814.      <P
  8815. ></P
  8816. ><UL
  8817. ><LI
  8818. ><P
  8819. >         Edit the enclosed <TT
  8820. CLASS="filename"
  8821. >pws-php4cgi.reg</TT
  8822. >
  8823.         file (look into the SAPI dir) to reflect the location of
  8824.         your <TT
  8825. CLASS="filename"
  8826. >php.exe</TT
  8827. >.  Backslashes should be 
  8828.         escaped, for example:
  8829.         <TT
  8830. CLASS="literal"
  8831. >[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map] ".php"="c:\\php\\php.exe"</TT
  8832. >
  8833.         Now merge this registery file into your system; you may do 
  8834.         this by double-clicking it.
  8835.        </P
  8836. ></LI
  8837. ><LI
  8838. ><P
  8839. >         In the PWS Manager, right click on a given directory you want
  8840.         to add PHP support to, and select Properties. Check the 'Execute'
  8841.         checkbox, and confirm.
  8842.        </P
  8843. ></LI
  8844. ></UL
  8845. >
  8846.     </P
  8847. ><P
  8848. >      If you choose the ISAPI module, do the following:
  8849.      <P
  8850. ></P
  8851. ><UL
  8852. ><LI
  8853. ><P
  8854. >         Edit the enclosed <TT
  8855. CLASS="filename"
  8856. >pws-php4isapi.reg</TT
  8857. >
  8858.         file (look into the SAPI dir) to reflect the location of
  8859.         your <TT
  8860. CLASS="filename"
  8861. >php4isapi.dll</TT
  8862. >.  Backslashes should 
  8863.         be escaped, for example:
  8864.         <TT
  8865. CLASS="literal"
  8866. >[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map] ".php"="c:\\php\\sapi\\php4isapi.dll"</TT
  8867. >
  8868.         Now merge this registery file into your system; you may do 
  8869.         this by double-clicking it.
  8870.        </P
  8871. ></LI
  8872. ><LI
  8873. ><P
  8874. >         In the PWS Manager, right click on a given directory you want to
  8875.         add PHP support to, and select Properties. Check the 'Execute'
  8876.         checkbox, and confirm. 
  8877.        </P
  8878. ></LI
  8879. ></UL
  8880. >
  8881.     </P
  8882. ></DIV
  8883. ><DIV
  8884. CLASS="sect2"
  8885. ><HR><H3
  8886. CLASS="sect2"
  8887. ><A
  8888. NAME="install.iis.iis4"
  8889. ></A
  8890. >Windows NT/2000/XP and IIS 4 or newer</H3
  8891. ><P
  8892. >      To install PHP on an NT/2000/XP Server running IIS 4 or newer,
  8893.      follow these instructions. You have two options to set up
  8894.      PHP, using the CGI binary (php.exe) or with the ISAPI module.
  8895.     </P
  8896. ><P
  8897. >      In either case, you need to start the Microsoft Management
  8898.      Console (may appear as 'Internet Services Manager', either
  8899.      in your Windows NT 4.0 Option Pack branch or the Control
  8900.      Panel=>Administrative Tools under Windows 2000/XP). Then 
  8901.      right click on your Web server node (this will most probably
  8902.      appear as 'Default Web Server'), and select 'Properties'.
  8903.     </P
  8904. ><P
  8905. >      If you want to use the CGI binary, do the following:
  8906.      <P
  8907. ></P
  8908. ><UL
  8909. ><LI
  8910. ><P
  8911. >         Under 'Home Directory', 'Virtual Directory', or
  8912.         'Directory', click on the 'Configuration' button,
  8913.         and then enter the App Mappings tab.
  8914.        </P
  8915. ></LI
  8916. ><LI
  8917. ><P
  8918. >         Click Add, and in the Executable box, type:
  8919.         <TT
  8920. CLASS="literal"
  8921. >c:\php\php.exe</TT
  8922. > (assuming
  8923.         that you have unziped PHP in c:\php\).
  8924.         </P
  8925. ></LI
  8926. ><LI
  8927. ><P
  8928. >         In the Extension box, type the file name extension you want
  8929.         associated with PHP scripts. Leave 'Method exclusions'
  8930.         blank, and check the Script engine checkbox. You may also
  8931.         like to check the 'check that file exists' box - for a small
  8932.         performance penalty, IIS (or PWS) will check that the script
  8933.         file exists and sort out authentication before firing up php.
  8934.         This means that you will get sensible 404 style error messages
  8935.         instead of cgi errors complaining that PHP did not output any data.
  8936.        </P
  8937. ><P
  8938. >         You must start over from the previous step for each
  8939.         extension you want associated with PHP scripts.
  8940.         <TT
  8941. CLASS="literal"
  8942. >.php</TT
  8943. > and <TT
  8944. CLASS="literal"
  8945. >.phtml</TT
  8946. >
  8947.         are common, although <TT
  8948. CLASS="literal"
  8949. >.php3</TT
  8950. > may be
  8951.         required for legacy applications.
  8952.        </P
  8953. ></LI
  8954. ><LI
  8955. ><P
  8956. >         Set up the appropriate security. (This is done in Internet
  8957.         Service Manager), and if your NT Server uses NTFS file system,
  8958.         add execute rights for I_USR_ to the directory that contains
  8959.         <TT
  8960. CLASS="literal"
  8961. >php.exe</TT
  8962. >.
  8963.        </P
  8964. ></LI
  8965. ></UL
  8966. >
  8967.     </P
  8968. ><P
  8969. >      To use the ISAPI module, do the following:
  8970.      <P
  8971. ></P
  8972. ><UL
  8973. ><LI
  8974. ><P
  8975. >         If you don't want to perform HTTP Authentication using PHP,
  8976.         you can (and should) skip this step. Under ISAPI Filters,
  8977.         add a new ISAPI filter. Use PHP as the filter name, and
  8978.         supply a path to the php4isapi.dll.
  8979.        </P
  8980. ></LI
  8981. ><LI
  8982. ><P
  8983. >         Under 'Home Directory', click on the 'Configuration' button.
  8984.         Add a new entry to the Application Mappings. Use the path
  8985.         to the php4isapi.dll as the Executable, supply
  8986.         <TT
  8987. CLASS="literal"
  8988. >.php</TT
  8989. > as the extension, leave Method
  8990.         exclusions blank, and check the Script engine checkbox.
  8991.        </P
  8992. ></LI
  8993. ><LI
  8994. ><P
  8995. >         Stop IIS completely (NET STOP iisadmin)
  8996.        </P
  8997. ></LI
  8998. ><LI
  8999. ><P
  9000. >         Start IIS again (NET START w3svc)
  9001.        </P
  9002. ></LI
  9003. ></UL
  9004. >
  9005.     </P
  9006. ></DIV
  9007. ></DIV
  9008. ><DIV
  9009. CLASS="sect1"
  9010. ><HR><H2
  9011. CLASS="sect1"
  9012. ><A
  9013. NAME="install.netscape-enterprise"
  9014. ></A
  9015. >Servers-Netscape, iPlanet and SunONE</H2
  9016. ><P
  9017. >     This section contains notes and hints specific to Netscape, iPlanet and SunONE webserver
  9018.     installs of PHP, both for <A
  9019. HREF="#install.netscape.sun"
  9020. >Sun Solaris</A
  9021. >
  9022.     and <A
  9023. HREF="#install.netscape.windows"
  9024. >Windows</A
  9025. > versions.
  9026.    </P
  9027. ><P
  9028. >     From PHP 4.3.3 on you can use PHP scripts with the <A
  9029. HREF="#ref.nsapi"
  9030. >NSAPI module</A
  9031. > to 
  9032.     <A
  9033. HREF="#install.netscape.specialpages"
  9034. >generate custom directory listings and
  9035.     error pages</A
  9036. >. Additional functions for Apache compatibility are also available.
  9037.     For support in current webservers read the
  9038.     <A
  9039. HREF="#install.netscape.notes"
  9040. >note about subrequests</A
  9041. >.
  9042.    </P
  9043. ><P
  9044. >     You can find more information about setting up PHP for the Netscape
  9045.     Enterprise Server (NES) here:
  9046.     <A
  9047. HREF="http://benoit.noss.free.fr/php/install-php4.html"
  9048. TARGET="_top"
  9049. >http://benoit.noss.free.fr/php/install-php4.html</A
  9050. >
  9051.    </P
  9052. ><DIV
  9053. CLASS="sect2"
  9054. ><HR><H3
  9055. CLASS="sect2"
  9056. ><A
  9057. NAME="install.netscape.sun"
  9058. ></A
  9059. >Installing PHP with NES/iPlanet/SunONE Webserver on Sun Solaris</H3
  9060. ><P
  9061. >      To build PHP with NES/iPlanet/SunONE webservers, enter the proper install
  9062.      directory for the
  9063.      <A
  9064. HREF="#install.configure.with-nsapi"
  9065. >--with-nsapi=[DIR]</A
  9066. >
  9067.      option. The default directory is usually
  9068.      <TT
  9069. CLASS="filename"
  9070. >/opt/netscape/suitespot/</TT
  9071. >.
  9072.      Please also read <TT
  9073. CLASS="filename"
  9074. >/php-xxx-version/sapi/nsapi/nsapi-readme.txt</TT
  9075. >.
  9076.     </P
  9077. ><P
  9078. >      <P
  9079. ></P
  9080. ><OL
  9081. TYPE="1"
  9082. ><LI
  9083. ><P
  9084. >         Install the following packages from <A
  9085. HREF="http://www.sunfreeware.com/"
  9086. TARGET="_top"
  9087. >         http://www.sunfreeware.com/</A
  9088. > or another download site:
  9089.         <P
  9090. ></P
  9091. ><TABLE
  9092. BORDER="0"
  9093. ><TBODY
  9094. ><TR
  9095. ><TD
  9096. ><TT
  9097. CLASS="filename"
  9098. >autoconf-2.13</TT
  9099. ></TD
  9100. ></TR
  9101. ><TR
  9102. ><TD
  9103. ><TT
  9104. CLASS="filename"
  9105. >automake-1.4</TT
  9106. ></TD
  9107. ></TR
  9108. ><TR
  9109. ><TD
  9110. ><TT
  9111. CLASS="filename"
  9112. >bison-1_25-sol26-sparc-local</TT
  9113. ></TD
  9114. ></TR
  9115. ><TR
  9116. ><TD
  9117. ><TT
  9118. CLASS="filename"
  9119. >flex-2_5_4a-sol26-sparc-local</TT
  9120. ></TD
  9121. ></TR
  9122. ><TR
  9123. ><TD
  9124. ><TT
  9125. CLASS="filename"
  9126. >gcc-2_95_2-sol26-sparc-local</TT
  9127. ></TD
  9128. ></TR
  9129. ><TR
  9130. ><TD
  9131. ><TT
  9132. CLASS="filename"
  9133. >gzip-1.2.4-sol26-sparc-local</TT
  9134. ></TD
  9135. ></TR
  9136. ><TR
  9137. ><TD
  9138. ><TT
  9139. CLASS="filename"
  9140. >m4-1_4-sol26-sparc-local</TT
  9141. ></TD
  9142. ></TR
  9143. ><TR
  9144. ><TD
  9145. ><TT
  9146. CLASS="filename"
  9147. >make-3_76_1-sol26-sparc-local</TT
  9148. ></TD
  9149. ></TR
  9150. ><TR
  9151. ><TD
  9152. >           <TT
  9153. CLASS="filename"
  9154. >mysql-3.23.24-beta</TT
  9155. > (if you want mysql support)
  9156.          </TD
  9157. ></TR
  9158. ><TR
  9159. ><TD
  9160. ><TT
  9161. CLASS="filename"
  9162. >perl-5_005_03-sol26-sparc-local</TT
  9163. ></TD
  9164. ></TR
  9165. ><TR
  9166. ><TD
  9167. ><TT
  9168. CLASS="filename"
  9169. >tar-1.13</TT
  9170. > (GNU tar)</TD
  9171. ></TR
  9172. ></TBODY
  9173. ></TABLE
  9174. ><P
  9175. ></P
  9176. >
  9177.        </P
  9178. ></LI
  9179. ><LI
  9180. ><P
  9181. >         Make sure your path includes the proper directories
  9182.         <TT
  9183. CLASS="literal"
  9184. >PATH=.:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ccs/bin</TT
  9185. >
  9186.         and make it available to your system <TT
  9187. CLASS="userinput"
  9188. ><B
  9189. >export PATH</B
  9190. ></TT
  9191. >.
  9192.        </P
  9193. ></LI
  9194. ><LI
  9195. ><P
  9196. >         <TT
  9197. CLASS="userinput"
  9198. ><B
  9199. >gunzip php-x.x.x.tar.gz</B
  9200. ></TT
  9201. > (if you have a .gz dist,
  9202.         otherwise go to 4).
  9203.        </P
  9204. ></LI
  9205. ><LI
  9206. ><P
  9207. >         <TT
  9208. CLASS="userinput"
  9209. ><B
  9210. >tar xvf php-x.x.x.tar</B
  9211. ></TT
  9212. >
  9213.        </P
  9214. ></LI
  9215. ><LI
  9216. ><P
  9217. >         Change to your extracted PHP directory:
  9218.         <TT
  9219. CLASS="userinput"
  9220. ><B
  9221. >cd ../php-x.x.x </B
  9222. ></TT
  9223. >
  9224.        </P
  9225. ></LI
  9226. ><LI
  9227. ><P
  9228. >         For the following step, make sure
  9229.         <TT
  9230. CLASS="filename"
  9231. >/opt/netscape/suitespot/</TT
  9232. > is
  9233.         where your netscape server is installed. Otherwise, change to the
  9234.         correct path and run:
  9235.         <TABLE
  9236. BORDER="0"
  9237. BGCOLOR="#E0E0E0"
  9238. CELLPADDING="5"
  9239. ><TR
  9240. ><TD
  9241. ><PRE
  9242. CLASS="shell"
  9243. >./configure --with-mysql=/usr/local/mysql \
  9244. --with-nsapi=/opt/netscape/suitespot/ \
  9245. --enable-libgcc</PRE
  9246. ></TD
  9247. ></TR
  9248. ></TABLE
  9249. >
  9250.        </P
  9251. ></LI
  9252. ><LI
  9253. ><P
  9254. >         Run <B
  9255. CLASS="command"
  9256. >make</B
  9257. > followed by <B
  9258. CLASS="command"
  9259. >make install</B
  9260. >.
  9261.        </P
  9262. ></LI
  9263. ></OL
  9264. >
  9265.     </P
  9266. ><P
  9267. >      After performing the base install and reading the appropriate readme file,
  9268.      you may need to perform some additional configuration steps.
  9269.     </P
  9270. ><DIV
  9271. CLASS="formalpara"
  9272. ><P
  9273. ><B
  9274. >Configuration Instructions for NES/iPlanet/SunONE. </B
  9275. >
  9276.       Firstly you may need to add some paths to the LD_LIBRARY_PATH environment
  9277.       for SunONE to find all the shared libs. This can best done in the start
  9278.       script for your SunONE webserver. Windows users can probably skip this
  9279.       step. The start script is often located in: <TT
  9280. CLASS="filename"
  9281. >/path/to/server/https-servername/start</TT
  9282. >.
  9283.       You may also need to edit the configuration files that are
  9284.       located in: <TT
  9285. CLASS="filename"
  9286. >/path/to/server/https-servername/config/</TT
  9287. >.
  9288.       <P
  9289. ></P
  9290. ><OL
  9291. TYPE="1"
  9292. ><LI
  9293. ><P
  9294. >          Add the following line to <TT
  9295. CLASS="filename"
  9296. >mime.types</TT
  9297. > (you can do
  9298.          that by the administration server):
  9299.          <TABLE
  9300. BORDER="0"
  9301. BGCOLOR="#E0E0E0"
  9302. CELLPADDING="5"
  9303. ><TR
  9304. ><TD
  9305. ><PRE
  9306. CLASS="screen"
  9307. >type=magnus-internal/x-httpd-php exts=php</PRE
  9308. ></TD
  9309. ></TR
  9310. ></TABLE
  9311. >
  9312.         </P
  9313. ></LI
  9314. ><LI
  9315. ><P
  9316. >          Edit <TT
  9317. CLASS="filename"
  9318. >magnus.conf</TT
  9319. > (for servers >= 6) or
  9320.          <TT
  9321. CLASS="filename"
  9322. >obj.conf</TT
  9323. > (for servers < 6) and add the following, shlib will
  9324.          vary depending on your OS, for Unix it will be something like
  9325.          <TT
  9326. CLASS="filename"
  9327. >/opt/netscape/suitespot/bin/libphp4.so</TT
  9328. >. You should
  9329.          place the following lines after <TT
  9330. CLASS="literal"
  9331. >mime types init</TT
  9332. >.
  9333.          <TABLE
  9334. BORDER="0"
  9335. BGCOLOR="#E0E0E0"
  9336. CELLPADDING="5"
  9337. ><TR
  9338. ><TD
  9339. ><PRE
  9340. CLASS="programlisting"
  9341. >Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="/opt/netscape/suitespot/bin/libphp4.so"
  9342. Init fn="php4_init" LateInit="yes" errorString="Failed to initialize PHP!" [php_ini="/path/to/php.ini"]</PRE
  9343. ></TD
  9344. ></TR
  9345. ></TABLE
  9346. >
  9347.          (PHP >= 4.3.3) The <TT
  9348. CLASS="literal"
  9349. >php_ini</TT
  9350. > parameter is optional but with it you can place your
  9351.          <TT
  9352. CLASS="filename"
  9353. >php.ini</TT
  9354. > in your webserver config directory.
  9355.         </P
  9356. ></LI
  9357. ><LI
  9358. ><P
  9359. >          Configure the default object in <TT
  9360. CLASS="filename"
  9361. >obj.conf</TT
  9362. >
  9363.          (for virtual server classes [SunONE 6.0+] in their <TT
  9364. CLASS="filename"
  9365. >vserver.obj.conf</TT
  9366. >):
  9367.          <TABLE
  9368. BORDER="0"
  9369. BGCOLOR="#E0E0E0"
  9370. CELLPADDING="5"
  9371. ><TR
  9372. ><TD
  9373. ><PRE
  9374. CLASS="programlisting"
  9375. ><Object name="default">
  9376. .
  9377. .
  9378. .
  9379. .#NOTE this next line should happen after all 'ObjectType' and before all 'AddLog' lines
  9380. Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...]
  9381. .
  9382. .
  9383. </Object></PRE
  9384. ></TD
  9385. ></TR
  9386. ></TABLE
  9387. >
  9388.          (PHP >= 4.3.3) As additional parameters you can add some special <TT
  9389. CLASS="filename"
  9390. >php.ini</TT
  9391. >-values, for example you
  9392.          can set a <TT
  9393. CLASS="literal"
  9394. >docroot="/path/to/docroot"</TT
  9395. > specific to the context <TT
  9396. CLASS="literal"
  9397. >php4_execute</TT
  9398. >
  9399.          is called. For boolean ini-keys please use 0/1 as value, not <TT
  9400. CLASS="literal"
  9401. >"On","Off",...</TT
  9402. >
  9403.          (this will not work correctly), e.g. <TT
  9404. CLASS="literal"
  9405. >zlib.output_compression=1</TT
  9406. > instead of
  9407.          <TT
  9408. CLASS="literal"
  9409. >zlib.output_compression="On"</TT
  9410. >
  9411.         </P
  9412. ></LI
  9413. ><LI
  9414. ><P
  9415. >          This is only needed if you want to configure a directory that only consists of
  9416.          PHP scripts (same like a <TT
  9417. CLASS="filename"
  9418. >cgi-bin</TT
  9419. > directory):
  9420.          <TABLE
  9421. BORDER="0"
  9422. BGCOLOR="#E0E0E0"
  9423. CELLPADDING="5"
  9424. ><TR
  9425. ><TD
  9426. ><PRE
  9427. CLASS="programlisting"
  9428. ><Object name="x-httpd-php">
  9429. ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
  9430. Service fn=php4_execute [inikey=value inikey=value ...]
  9431. </Object></PRE
  9432. ></TD
  9433. ></TR
  9434. ></TABLE
  9435. >
  9436.          After that you can configure a directory in the Administration server and assign it
  9437.          the style <TT
  9438. CLASS="literal"
  9439. >x-httpd-php</TT
  9440. >. All files in it will get executed as PHP.
  9441.          This is nice to hide PHP usage by renaming files to <TT
  9442. CLASS="filename"
  9443. >.html</TT
  9444. >.
  9445.         </P
  9446. ></LI
  9447. ><LI
  9448. ><P
  9449. >          Setup of authentication: PHP authentication cannot be used with any
  9450.          other authentication. ALL AUTHENTICATION IS PASSED TO YOUR PHP SCRIPT.
  9451.          To configure PHP Authentication for the entire server, add the
  9452.          following line to your default object:
  9453.          <TABLE
  9454. BORDER="0"
  9455. BGCOLOR="#E0E0E0"
  9456. CELLPADDING="5"
  9457. ><TR
  9458. ><TD
  9459. ><PRE
  9460. CLASS="programlisting"
  9461. ><Object name="default">
  9462. AuthTrans fn=php4_auth_trans
  9463. .
  9464. .
  9465. .
  9466. </Object></PRE
  9467. ></TD
  9468. ></TR
  9469. ></TABLE
  9470. >
  9471.         </P
  9472. ></LI
  9473. ><LI
  9474. ><P
  9475. >          To use PHP Authentication on a single directory, add the following:
  9476.          <TABLE
  9477. BORDER="0"
  9478. BGCOLOR="#E0E0E0"
  9479. CELLPADDING="5"
  9480. ><TR
  9481. ><TD
  9482. ><PRE
  9483. CLASS="programlisting"
  9484. ><Object ppath="d:\path\to\authenticated\dir\*">
  9485. AuthTrans fn=php4_auth_trans
  9486. </Object></PRE
  9487. ></TD
  9488. ></TR
  9489. ></TABLE
  9490. >
  9491.         </P
  9492. ></LI
  9493. ></OL
  9494. >
  9495.      </P
  9496. ></DIV
  9497. ></DIV
  9498. ><DIV
  9499. CLASS="sect2"
  9500. ><HR><H3
  9501. CLASS="sect2"
  9502. ><A
  9503. NAME="install.netscape.windows"
  9504. ></A
  9505. >Installing PHP with NES/iPlanet/SunONE on Windows</H3
  9506. ><P
  9507. >       To Install PHP as CGI (for Netscape Enterprise Server,
  9508.       iPlanet, SunONE, perhaps Fastrack), do the following:
  9509.     </P
  9510. ><P
  9511. ></P
  9512. ><UL
  9513. ><LI
  9514. ><P
  9515. >        Copy <TT
  9516. CLASS="filename"
  9517. >php4ts.dll</TT
  9518. > to your systemroot
  9519.        (the directory where you installed Windows)
  9520.       </P
  9521. ></LI
  9522. ><LI
  9523. ><P
  9524. >        Make a file association from the command line.
  9525.        Type the following two lines:
  9526.        <TABLE
  9527. BORDER="0"
  9528. BGCOLOR="#E0E0E0"
  9529. CELLPADDING="5"
  9530. ><TR
  9531. ><TD
  9532. ><PRE
  9533. CLASS="shell"
  9534. >assoc .php=PHPScript
  9535. ftype PHPScript=c:\php\php.exe %1 %*</PRE
  9536. ></TD
  9537. ></TR
  9538. ></TABLE
  9539. >
  9540.       </P
  9541. ></LI
  9542. ><LI
  9543. ><P
  9544. >        In the Netscape Enterprise Administration Server create
  9545.        a dummy shellcgi directory and remove it just after (this
  9546.        step creates 5 important lines in obj.conf and allow the
  9547.        web server to handle shellcgi scripts).
  9548.       </P
  9549. ></LI
  9550. ><LI
  9551. ><P
  9552. >        In the Netscape Enterprise Administration Server create
  9553.        a new mime type (Category: type,
  9554.        Content-Type: magnus-internal/shellcgi, File Suffix:php).
  9555.       </P
  9556. ></LI
  9557. ><LI
  9558. ><P
  9559. >        Do it for each web server instance you want PHP to run
  9560.       </P
  9561. ></LI
  9562. ></UL
  9563. ><P
  9564. >      More details about setting up
  9565.      PHP as a CGI executable can be found here:
  9566.      <A
  9567. HREF="http://benoit.noss.free.fr/php/install-php.html"
  9568. TARGET="_top"
  9569. >http://benoit.noss.free.fr/php/install-php.html</A
  9570. >
  9571.     </P
  9572. ><P
  9573. >      To Install PHP as NSAPI (for Netscape Enterprise Server,
  9574.      iPlanet, SunONE, perhaps Fastrack), do the following:
  9575.     </P
  9576. ><P
  9577. ></P
  9578. ><UL
  9579. ><LI
  9580. ><P
  9581. >        Copy <TT
  9582. CLASS="filename"
  9583. >php4ts.dll</TT
  9584. > to your systemroot
  9585.        (the directory where you installed Windows)
  9586.       </P
  9587. ></LI
  9588. ><LI
  9589. ><P
  9590. >        Make a file association from the command line.
  9591.        Type the following two lines:
  9592.        <TABLE
  9593. BORDER="0"
  9594. BGCOLOR="#E0E0E0"
  9595. CELLPADDING="5"
  9596. ><TR
  9597. ><TD
  9598. ><PRE
  9599. CLASS="shell"
  9600. >assoc .php=PHPScript
  9601. ftype PHPScript=c:\php\php.exe %1 %*</PRE
  9602. ></TD
  9603. ></TR
  9604. ></TABLE
  9605. >
  9606.       </P
  9607. ></LI
  9608. ><LI
  9609. ><P
  9610. >        In the Netscape Enterprise Administration Server create
  9611.        a new mime type (Category: type,
  9612.        Content-Type: magnus-internal/x-httpd-php, File Suffix: php).
  9613.       </P
  9614. ></LI
  9615. ><LI
  9616. ><P
  9617. >         Edit <TT
  9618. CLASS="filename"
  9619. >magnus.conf</TT
  9620. > (for servers >= 6) or
  9621.         <TT
  9622. CLASS="filename"
  9623. >obj.conf</TT
  9624. > (for servers < 6) and add the following:
  9625.         You should
  9626.         place the the lines after <TT
  9627. CLASS="literal"
  9628. >mime types init</TT
  9629. >.
  9630.        <TABLE
  9631. BORDER="0"
  9632. BGCOLOR="#E0E0E0"
  9633. CELLPADDING="5"
  9634. ><TR
  9635. ><TD
  9636. ><PRE
  9637. CLASS="programlisting"
  9638. >Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="c:/php/sapi/php4nsapi.dll"
  9639. Init fn="php4_init" LateInit="yes" errorString="Failed to initialise PHP!" [php_ini="c:/path/to/php.ini"]</PRE
  9640. ></TD
  9641. ></TR
  9642. ></TABLE
  9643. >
  9644.        (PHP >= 4.3.3) The <TT
  9645. CLASS="literal"
  9646. >php_ini</TT
  9647. > parameter is optional but with it you can place your
  9648.        <TT
  9649. CLASS="filename"
  9650. >php.ini</TT
  9651. > in your webserver config directory.
  9652.       </P
  9653. ></LI
  9654. ><LI
  9655. ><P
  9656. >        Configure the default object in <TT
  9657. CLASS="filename"
  9658. >obj.conf</TT
  9659. >
  9660.        (for virtual server classes [SunONE 6.0+] in their <TT
  9661. CLASS="filename"
  9662. >vserver.obj.conf</TT
  9663. >):
  9664.        In the <TT
  9665. CLASS="literal"
  9666. ><Object name="default"></TT
  9667. >
  9668.        section, place this line necessarily after all 'ObjectType'
  9669.        and before all 'AddLog' lines:
  9670.        <TABLE
  9671. BORDER="0"
  9672. BGCOLOR="#E0E0E0"
  9673. CELLPADDING="5"
  9674. ><TR
  9675. ><TD
  9676. ><PRE
  9677. CLASS="programlisting"
  9678. >Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...]</PRE
  9679. ></TD
  9680. ></TR
  9681. ></TABLE
  9682. >
  9683.        (PHP >= 4.3.3) As additional parameters you can add some special <TT
  9684. CLASS="filename"
  9685. >php.ini</TT
  9686. >-values, for example you
  9687.        can set a <TT
  9688. CLASS="literal"
  9689. >docroot="/path/to/docroot"</TT
  9690. > specific to the context <TT
  9691. CLASS="literal"
  9692. >php4_execute</TT
  9693. >
  9694.        is called. For boolean ini-keys please use 0/1 as value, not <TT
  9695. CLASS="literal"
  9696. >"On","Off",...</TT
  9697. >
  9698.        (this will not work correctly), e.g. <TT
  9699. CLASS="literal"
  9700. >zlib.output_compression=1</TT
  9701. > instead of
  9702.        <TT
  9703. CLASS="literal"
  9704. >zlib.output_compression="On"</TT
  9705. >
  9706.       </P
  9707. ></LI
  9708. ><LI
  9709. ><P
  9710. >        This is only needed if you want to configure a directory that only consists of
  9711.        PHP scripts (same like a cgi-bin directory):
  9712.        <TABLE
  9713. BORDER="0"
  9714. BGCOLOR="#E0E0E0"
  9715. CELLPADDING="5"
  9716. ><TR
  9717. ><TD
  9718. ><PRE
  9719. CLASS="programlisting"
  9720. ><Object name="x-httpd-php">
  9721. ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
  9722. Service fn=php4_execute [inikey=value inikey=value ...]
  9723. </Object></PRE
  9724. ></TD
  9725. ></TR
  9726. ></TABLE
  9727. >
  9728.        After that you can configure a directory in the Administration server and assign it
  9729.        the style <TT
  9730. CLASS="literal"
  9731. >x-httpd-php</TT
  9732. >. All files in it will get executed as PHP.
  9733.        This is nice to hide PHP usage by renaming files to <TT
  9734. CLASS="filename"
  9735. >.html</TT
  9736. >.
  9737.       </P
  9738. ></LI
  9739. ><LI
  9740. ><P
  9741. >        Restart your web service and apply changes
  9742.       </P
  9743. ></LI
  9744. ><LI
  9745. ><P
  9746. >        Do it for each web server instance you want PHP to run
  9747.       </P
  9748. ></LI
  9749. ></UL
  9750. ><P
  9751. >      More details about setting up
  9752.      PHP as an NSAPI filter can be found here:
  9753.      <A
  9754. HREF="http://benoit.noss.free.fr/php/install-php4.html"
  9755. TARGET="_top"
  9756. >http://benoit.noss.free.fr/php/install-php4.html</A
  9757. >
  9758.     </P
  9759. ></DIV
  9760. ><DIV
  9761. CLASS="sect2"
  9762. ><HR><H3
  9763. CLASS="sect2"
  9764. ><A
  9765. NAME="install.netscape.phpini"
  9766. ></A
  9767. >CGI environment and recommended modifications in php.ini</H3
  9768. ><P
  9769. >      Important when writing PHP scripts is the fact that iPlanet/SunONE/Netscape is a multithreaded web server.
  9770.      Because of that all requests are running in the same process space (the space of the webserver itsself) and
  9771.      this space has only one environment. If you want to get CGI variables like <TT
  9772. CLASS="literal"
  9773. >PATH_INFO</TT
  9774. >,
  9775.      <TT
  9776. CLASS="literal"
  9777. >HTTP_HOST</TT
  9778. > etc. it is not the correct way to try this in the old PHP 3.x way with
  9779.      <A
  9780. HREF="#function.getenv"
  9781. ><B
  9782. CLASS="function"
  9783. >getenv()</B
  9784. ></A
  9785. > or a similar way (register globals to environment, <TT
  9786. CLASS="literal"
  9787. >$_ENV</TT
  9788. >).
  9789.      You would only get the environment of the running webserver without any valid CGI variables!
  9790.     </P
  9791. ><DIV
  9792. CLASS="note"
  9793. ><BLOCKQUOTE
  9794. CLASS="note"
  9795. ><P
  9796. ><B
  9797. >Poznßmka: </B
  9798. >
  9799.       Why are there (invalid) CGI variables in the environment?
  9800.      </P
  9801. ><P
  9802. >       Answer: This is because you started the webserver process from the admin server which runs the startup
  9803.       script of the webserver, you wanted to start, as a CGI script
  9804.       (a CGI script inside of the admin server!). This is why the environment of the started webserver
  9805.       has some CGI environment variables in it. You can test this by
  9806.       starting the webserver not from the administration server. Use the Unix command line as root user and
  9807.       start it manually - you will see there are no CGI-like environment variables.
  9808.      </P
  9809. ></BLOCKQUOTE
  9810. ></DIV
  9811. ><P
  9812. >      Simply change your scripts to get CGI variables in the correct way for PHP 4.x by using the superglobal
  9813.      <TT
  9814. CLASS="literal"
  9815. >$_SERVER</TT
  9816. >. If you have older scripts which use <TT
  9817. CLASS="literal"
  9818. >$HTTP_HOST</TT
  9819. >,...,
  9820.      you should turn on <TT
  9821. CLASS="literal"
  9822. >register_globals</TT
  9823. > in <TT
  9824. CLASS="filename"
  9825. >php.ini</TT
  9826. > and change the variable order
  9827.      to (important: remove <TT
  9828. CLASS="literal"
  9829. >"E"</TT
  9830. > from it, because you do not need the environment here):
  9831.      <TABLE
  9832. BORDER="0"
  9833. BGCOLOR="#E0E0E0"
  9834. CELLPADDING="5"
  9835. ><TR
  9836. ><TD
  9837. ><PRE
  9838. CLASS="programlisting"
  9839. >variables_order = "GPCS"
  9840. register_globals = On</PRE
  9841. ></TD
  9842. ></TR
  9843. ></TABLE
  9844. >
  9845.     </P
  9846. ></DIV
  9847. ><DIV
  9848. CLASS="sect2"
  9849. ><HR><H3
  9850. CLASS="sect2"
  9851. ><A
  9852. NAME="install.netscape.specialpages"
  9853. ></A
  9854. >Special use for error pages or self-made directory listings (PHP >= 4.3.3)</H3
  9855. ><P
  9856. >      You can use PHP to generate the error pages for "404 Not Found"
  9857.      or similar. Add the following line to the object in <TT
  9858. CLASS="filename"
  9859. >obj.conf</TT
  9860. > for
  9861.      every error page you want to overwrite:
  9862.      <TABLE
  9863. BORDER="0"
  9864. BGCOLOR="#E0E0E0"
  9865. CELLPADDING="5"
  9866. ><TR
  9867. ><TD
  9868. ><PRE
  9869. CLASS="programlisting"
  9870. >Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...]</PRE
  9871. ></TD
  9872. ></TR
  9873. ></TABLE
  9874. >
  9875.      where <TT
  9876. CLASS="literal"
  9877. >XXX</TT
  9878. > is the HTTP error code. Please delete any other <TT
  9879. CLASS="literal"
  9880. >Error</TT
  9881. >
  9882.      directives which could interfere with yours.
  9883.      If you want to place a page for all errors that could exist, leave
  9884.      the <TT
  9885. CLASS="literal"
  9886. >code</TT
  9887. > parameter out. Your script can get the HTTP status code
  9888.      with <TT
  9889. CLASS="literal"
  9890. >$_SERVER['ERROR_TYPE']</TT
  9891. >.
  9892.     </P
  9893. ><P
  9894. >      Another possibility is to generate self-made directory listings.
  9895.      Just create a PHP script which displays a directory listing and
  9896.      replace the corresponding default Service line for
  9897.      <TT
  9898. CLASS="literal"
  9899. >type="magnus-internal/directory"</TT
  9900. > in <TT
  9901. CLASS="filename"
  9902. >obj.conf</TT
  9903. > with the following:
  9904.      <TABLE
  9905. BORDER="0"
  9906. BGCOLOR="#E0E0E0"
  9907. CELLPADDING="5"
  9908. ><TR
  9909. ><TD
  9910. ><PRE
  9911. CLASS="programlisting"
  9912. >Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...]</PRE
  9913. ></TD
  9914. ></TR
  9915. ></TABLE
  9916. >
  9917.      For both error and directory listing pages the original URI and
  9918.      translated URI are in the variables <TT
  9919. CLASS="literal"
  9920. >$_SERVER['PATH_INFO']</TT
  9921. > and
  9922.      <TT
  9923. CLASS="literal"
  9924. >$_SERVER['PATH_TRANSLATED']</TT
  9925. >.
  9926.     </P
  9927. ></DIV
  9928. ><DIV
  9929. CLASS="sect2"
  9930. ><HR><H3
  9931. CLASS="sect2"
  9932. ><A
  9933. NAME="install.netscape.notes"
  9934. ></A
  9935. >Note about <A
  9936. HREF="#function.nsapi-virtual"
  9937. ><B
  9938. CLASS="function"
  9939. >nsapi_virtual()</B
  9940. ></A
  9941. > and subrequests (PHP >= 4.3.3)</H3
  9942. ><P
  9943. >      The NSAPI module now supports the <A
  9944. HREF="#function.nsapi-virtual"
  9945. ><B
  9946. CLASS="function"
  9947. >nsapi_virtual()</B
  9948. ></A
  9949. > function
  9950.      (alias: <A
  9951. HREF="#function.virtual"
  9952. ><B
  9953. CLASS="function"
  9954. >virtual()</B
  9955. ></A
  9956. >)
  9957.      to make subrequests on the webserver and insert the result in the webpage.
  9958.      The problem is, that this function uses some undocumented features from
  9959.      the NSAPI library.
  9960.     </P
  9961. ><P
  9962. >      Under Unix this is not a problem, because the module automatically looks
  9963.      for the needed functions and uses them if available. If not, <A
  9964. HREF="#function.nsapi-virtual"
  9965. ><B
  9966. CLASS="function"
  9967. >nsapi_virtual()</B
  9968. ></A
  9969. >
  9970.      is disabled.
  9971.     </P
  9972. ><P
  9973. >      Under Windows limitations in the DLL handling need the use of a automatic
  9974.      detection of the most recent <TT
  9975. CLASS="filename"
  9976. >ns-httpdXX.dll</TT
  9977. > file. This is tested for servers
  9978.      till version 6.1. If a newer version of the SunONE server is used, the detection
  9979.      fails and <A
  9980. HREF="#function.nsapi-virtual"
  9981. ><B
  9982. CLASS="function"
  9983. >nsapi_virtual()</B
  9984. ></A
  9985. > is disabled.
  9986.     </P
  9987. ><P
  9988. >      If this is the case, try the following:
  9989.      Add the following parameter to <TT
  9990. CLASS="literal"
  9991. >php4_init</TT
  9992. > in
  9993.      <TT
  9994. CLASS="filename"
  9995. >magnus.conf</TT
  9996. >/<TT
  9997. CLASS="filename"
  9998. >obj.conf</TT
  9999. >:
  10000.      <TABLE
  10001. BORDER="0"
  10002. BGCOLOR="#E0E0E0"
  10003. CELLPADDING="5"
  10004. ><TR
  10005. ><TD
  10006. ><PRE
  10007. CLASS="programlisting"
  10008. >Init fn=php4_init ... server_lib="ns-httpdXX.dll"</PRE
  10009. ></TD
  10010. ></TR
  10011. ></TABLE
  10012. >
  10013.      where <TT
  10014. CLASS="literal"
  10015. >XX</TT
  10016. > is the correct DLL version number. To get it, look in the server-root
  10017.      for the correct DLL name. The DLL with the biggest filesize is the right one.
  10018.     </P
  10019. ><P
  10020. >      You can check the status by using the <A
  10021. HREF="#function.phpinfo"
  10022. ><B
  10023. CLASS="function"
  10024. >phpinfo()</B
  10025. ></A
  10026. > function.
  10027.     </P
  10028. ><DIV
  10029. CLASS="note"
  10030. ><BLOCKQUOTE
  10031. CLASS="note"
  10032. ><P
  10033. ><B
  10034. >Poznßmka: </B
  10035. >
  10036.       But be warned: Support for <A
  10037. HREF="#function.nsapi-virtual"
  10038. ><B
  10039. CLASS="function"
  10040. >nsapi_virtual()</B
  10041. ></A
  10042. > is EXPERIMENTAL!!!
  10043.      </P
  10044. ></BLOCKQUOTE
  10045. ></DIV
  10046. ></DIV
  10047. ></DIV
  10048. ><DIV
  10049. CLASS="sect1"
  10050. ><HR><H2
  10051. CLASS="sect1"
  10052. ><A
  10053. NAME="install.omnihttpd"
  10054. ></A
  10055. >Servers-OmniHTTPd Server</H2
  10056. ><P
  10057. >     This section contains notes and hints specific to
  10058.     <A
  10059. HREF="http://www.omnicron.ca/"
  10060. TARGET="_top"
  10061. >OmniHTTPd</A
  10062. >.
  10063.    </P
  10064. ><DIV
  10065. CLASS="sect2"
  10066. ><HR><H3
  10067. CLASS="sect2"
  10068. ><A
  10069. NAME="install.omnihttpd.windows"
  10070. ></A
  10071. >OmniHTTPd 2.0b1 and up for Windows</H3
  10072. ><P
  10073. >      You need to complete the following steps to make PHP
  10074.      work with OmniHTTPd. This is a CGI executable setup.
  10075.      SAPI is supported by OmniHTTPd, but some tests have shown
  10076.      that it is not so stable to use PHP as an ISAPI module.
  10077.     </P
  10078. ><DIV
  10079. CLASS="note"
  10080. ><BLOCKQUOTE
  10081. CLASS="note"
  10082. ><P
  10083. ><B
  10084. >Important for CGI users: </B
  10085. >
  10086.       Read the <A
  10087. HREF="#faq.installation.forceredirect"
  10088. >faq
  10089.       on cgi.force_redirect</A
  10090. > for important details.  This
  10091.       directive needs to be set to <TT
  10092. CLASS="literal"
  10093. >0</TT
  10094. >.
  10095.      </P
  10096. ></BLOCKQUOTE
  10097. ></DIV
  10098. ><P
  10099. >      <P
  10100. ></P
  10101. ><OL
  10102. TYPE="1"
  10103. ><LI
  10104. ><P
  10105. >         Install OmniHTTPd server.
  10106.        </P
  10107. ></LI
  10108. ><LI
  10109. ><P
  10110. >         Right click on the blue OmniHTTPd icon in the system
  10111.         tray and select <TT
  10112. CLASS="literal"
  10113. >Properties</TT
  10114. >
  10115.        </P
  10116. ></LI
  10117. ><LI
  10118. ><P
  10119. >         Click on <TT
  10120. CLASS="literal"
  10121. >Web Server Global Settings</TT
  10122. >
  10123.        </P
  10124. ></LI
  10125. ><LI
  10126. ><P
  10127. >         On the 'External' tab, enter: <TT
  10128. CLASS="literal"
  10129. >virtual = .php
  10130.          | actual = c:\path-to-php-dir\php.exe</TT
  10131. >, and use the Add
  10132.         button.
  10133.        </P
  10134. ></LI
  10135. ><LI
  10136. ><P
  10137. >         On the <TT
  10138. CLASS="literal"
  10139. >Mime</TT
  10140. > tab, enter:
  10141.         <TT
  10142. CLASS="literal"
  10143. >virtual = wwwserver/stdcgi | actual = .php</TT
  10144. >,
  10145.         and use the Add button.
  10146.        </P
  10147. ></LI
  10148. ><LI
  10149. ><P
  10150. >         Click <TT
  10151. CLASS="literal"
  10152. >OK</TT
  10153. >
  10154.        </P
  10155. ></LI
  10156. ></OL
  10157. >
  10158.     </P
  10159. ><P
  10160. >      Repeat steps 2 - 6 for each extension you want to associate with PHP.
  10161.     </P
  10162. ><DIV
  10163. CLASS="note"
  10164. ><BLOCKQUOTE
  10165. CLASS="note"
  10166. ><P
  10167. ><B
  10168. >Poznßmka: </B
  10169. >
  10170.       Some OmniHTTPd packages come with built in PHP support.
  10171.       You can choose at setup time to do a custom setup, and
  10172.       uncheck the PHP component. We recommend you to use the latest
  10173.       PHP binaries. Some OmniHTTPd servers come with PHP 4 beta
  10174.       distributions, so you should choose not to set up
  10175.       the built in support, but install your own. If the server
  10176.       is already on your machine, use the Replace button in Step
  10177.       4 and 5 to set the new, correct information.
  10178.      </P
  10179. ></BLOCKQUOTE
  10180. ></DIV
  10181. ></DIV
  10182. ></DIV
  10183. ><DIV
  10184. CLASS="sect1"
  10185. ><HR><H2
  10186. CLASS="sect1"
  10187. ><A
  10188. NAME="install.oreilly"
  10189. ></A
  10190. >Servers-Oreilly Website Pro</H2
  10191. ><P
  10192. >     This section contains notes and hints specific to Oreilly
  10193.     Website Pro.
  10194.    </P
  10195. ><DIV
  10196. CLASS="sect2"
  10197. ><HR><H3
  10198. CLASS="sect2"
  10199. ><A
  10200. NAME="install.oreilly.windows"
  10201. ></A
  10202. >Oreilly Website Pro 2.5 and up for Windows</H3
  10203. ><P
  10204. >      This list describes how to set up the PHP CGI binary
  10205.      or the ISAPI module to work with Oreilly Website Pro
  10206.      on Windows.
  10207.     </P
  10208. ><P
  10209. >      <P
  10210. ></P
  10211. ><UL
  10212. ><LI
  10213. ><P
  10214. >         Edit the Server Properties and select the tab "Mapping".
  10215.        </P
  10216. ></LI
  10217. ><LI
  10218. ><P
  10219. >         From the List select "Associations" and enter the desired
  10220.         extension (<TT
  10221. CLASS="literal"
  10222. >.php</TT
  10223. >) and the path to the CGI exe
  10224.         (ex. <TT
  10225. CLASS="filename"
  10226. >c:\php\php.exe</TT
  10227. >) or the ISAPI DLL file
  10228.         (ex. <TT
  10229. CLASS="filename"
  10230. >c:\php\sapi\php4isapi.dll</TT
  10231. >).
  10232.        </P
  10233. ></LI
  10234. ><LI
  10235. ><P
  10236. >         Select "Content Types" add the same extension
  10237.         (<TT
  10238. CLASS="literal"
  10239. >.php</TT
  10240. >) and enter the content type.
  10241.         If you choose the CGI executable file, enter
  10242.         'wwwserver/shellcgi', if you choose the ISAPI module,
  10243.         enter 'wwwserver/isapi' (both without quotes).
  10244.        </P
  10245. ></LI
  10246. ></UL
  10247. >
  10248.     </P
  10249. ></DIV
  10250. ></DIV
  10251. ><DIV
  10252. CLASS="sect1"
  10253. ><HR><H2
  10254. CLASS="sect1"
  10255. ><A
  10256. NAME="install.sambar"
  10257. ></A
  10258. >Servers-Sambar</H2
  10259. ><P
  10260. >     This section contains notes and hints specific to the
  10261.     <A
  10262. HREF="http://www.sambar.com/"
  10263. TARGET="_top"
  10264. >Sambar server</A
  10265. > for Windows.
  10266.    </P
  10267. ><DIV
  10268. CLASS="sect2"
  10269. ><HR><H3
  10270. CLASS="sect2"
  10271. ><A
  10272. NAME="install.sambar.windows"
  10273. ></A
  10274. >Sambar Windows</H3
  10275. ><P
  10276. >      This list describes how to set up the ISAPI module to
  10277.      work with the Sambar server on Windows.
  10278.     </P
  10279. ><P
  10280. >      <P
  10281. ></P
  10282. ><UL
  10283. ><LI
  10284. ><P
  10285. >         Find the file called <TT
  10286. CLASS="filename"
  10287. >mappings.ini</TT
  10288. > (in the config
  10289.         directory) in the Sambar install directory.
  10290.        </P
  10291. ></LI
  10292. ><LI
  10293. ><P
  10294. >         Open <TT
  10295. CLASS="filename"
  10296. >mappings.ini</TT
  10297. > and add the following line
  10298.         under <TT
  10299. CLASS="literal"
  10300. >[ISAPI]</TT
  10301. >:
  10302.         <DIV
  10303. CLASS="informalexample"
  10304. ><A
  10305. NAME="AEN2009"
  10306. ></A
  10307. ><P
  10308. ></P
  10309. ><TABLE
  10310. BORDER="0"
  10311. BGCOLOR="#E0E0E0"
  10312. CELLPADDING="5"
  10313. ><TR
  10314. ><TD
  10315. ><PRE
  10316. CLASS="screen"
  10317. >*.php = c:\php\php4isapi.dll</PRE
  10318. ></TD
  10319. ></TR
  10320. ></TABLE
  10321. ><P
  10322. ></P
  10323. ></DIV
  10324. >
  10325.         (This line assumes that PHP was installed in
  10326.         <TT
  10327. CLASS="literal"
  10328. >c:\php</TT
  10329. >.)
  10330.        </P
  10331. ></LI
  10332. ><LI
  10333. ><P
  10334. >         Now restart the Sambar server for the changes to take effect.
  10335.        </P
  10336. ></LI
  10337. ></UL
  10338. >
  10339.     </P
  10340. ></DIV
  10341. ></DIV
  10342. ><DIV
  10343. CLASS="sect1"
  10344. ><HR><H2
  10345. CLASS="sect1"
  10346. ><A
  10347. NAME="install.xitami"
  10348. ></A
  10349. >Servers-Xitami</H2
  10350. ><P
  10351. >     This section contains notes and hints specific to
  10352.     <A
  10353. HREF="http://www.xitami.com/"
  10354. TARGET="_top"
  10355. >Xitami</A
  10356. >.
  10357.    </P
  10358. ><DIV
  10359. CLASS="sect2"
  10360. ><HR><H3
  10361. CLASS="sect2"
  10362. ><A
  10363. NAME="install.xitami.windows"
  10364. ></A
  10365. >Xitami for Windows</H3
  10366. ><P
  10367. >      This list describes how to set up the PHP CGI binary
  10368.      to work with Xitami on Windows.
  10369.     </P
  10370. ><DIV
  10371. CLASS="note"
  10372. ><BLOCKQUOTE
  10373. CLASS="note"
  10374. ><P
  10375. ><B
  10376. >Important for CGI users: </B
  10377. >
  10378.       Read the <A
  10379. HREF="#faq.installation.forceredirect"
  10380. >faq
  10381.       on cgi.force_redirect</A
  10382. > for important details.  This
  10383.       directive needs to be set to <TT
  10384. CLASS="literal"
  10385. >0</TT
  10386. >.
  10387.      </P
  10388. ></BLOCKQUOTE
  10389. ></DIV
  10390. ><P
  10391. >      <P
  10392. ></P
  10393. ><UL
  10394. ><LI
  10395. ><P
  10396. >         Make sure the webserver is running, and point
  10397.         your browser to xitamis admin console
  10398.         (usually <TT
  10399. CLASS="literal"
  10400. >http://127.0.0.1/admin</TT
  10401. >),
  10402.         and click on Configuration.
  10403.        </P
  10404. ></LI
  10405. ><LI
  10406. ><P
  10407. >         Navigate to the Filters, and put the
  10408.         extension which PHP should parse (i.e. .php)
  10409.         into the field File extensions (.xxx).
  10410.        </P
  10411. ></LI
  10412. ><LI
  10413. ><P
  10414. >         In Filter command or script put the path and name
  10415.         of your PHP executable i.e. <TT
  10416. CLASS="literal"
  10417. >c:\php\php.exe</TT
  10418. >.
  10419.        </P
  10420. ></LI
  10421. ><LI
  10422. ><P
  10423. >         Press the 'Save' icon.
  10424.        </P
  10425. ></LI
  10426. ><LI
  10427. ><P
  10428. >         Restart the server to reflect changes.
  10429.        </P
  10430. ></LI
  10431. ></UL
  10432. >
  10433.     </P
  10434. ></DIV
  10435. ></DIV
  10436. ><DIV
  10437. CLASS="sect1"
  10438. ><HR><H2
  10439. CLASS="sect1"
  10440. ><A
  10441. NAME="install.otherhttpd"
  10442. ></A
  10443. >Servers-Other web servers</H2
  10444. ><P
  10445. >     PHP can be built to support a large number of web servers. Please
  10446.  
  10447.     see Server-related
  10448.     options for a full list of server-related configure
  10449.     options. The PHP CGI binaries are compatible with almost all
  10450.     webservers supporting the CGI standard.
  10451.    </P
  10452. ></DIV
  10453. ><DIV
  10454. CLASS="sect1"
  10455. ><HR><H2
  10456. CLASS="sect1"
  10457. ><A
  10458. NAME="install.problems"
  10459. ></A
  10460. >Problems?</H2
  10461. ><DIV
  10462. CLASS="sect2"
  10463. ><H3
  10464. CLASS="sect2"
  10465. ><A
  10466. NAME="AEN2045"
  10467. ></A
  10468. >Read the FAQ</H3
  10469. ><P
  10470. >      Some problems are more common than others. The most
  10471.      common ones are listed in the <A
  10472. HREF="#faq"
  10473. >PHP
  10474.      FAQ</A
  10475. >, part of this manual.
  10476.     </P
  10477. ></DIV
  10478. ><DIV
  10479. CLASS="sect2"
  10480. ><HR><H3
  10481. CLASS="sect2"
  10482. ><A
  10483. NAME="install.otherproblems"
  10484. ></A
  10485. >Other problems</H3
  10486. ><P
  10487. >      If you are still stuck, someone on the PHP installation mailing list may be
  10488.      able to help you. You should check out the archive first, in case
  10489.      someone already answered someone else who had the same problem as
  10490.      you. The archives are available from the support page on <A
  10491. HREF="http://www.php.net/support.php"
  10492. TARGET="_top"
  10493. >http://www.php.net/support.php</A
  10494. >. To subscribe to the PHP installation
  10495.      mailing list, send an empty mail to <A
  10496. HREF="mailto:php-install-subscribe@lists.php.net"
  10497. TARGET="_top"
  10498. >php-install-subscribe@lists.php.net</A
  10499. >.
  10500.      The mailing list address is <A
  10501. HREF="mailto:php-install@lists.php.net"
  10502. TARGET="_top"
  10503. >php-install@lists.php.net</A
  10504. >.
  10505.     </P
  10506. ><P
  10507. >      If you want to get help on the mailing list, please try to be
  10508.      precise and give the necessary details about your environment
  10509.      (which operating system, what PHP version, what web server, if
  10510.      you are running PHP as CGI or a server module, <A
  10511. HREF="#ini.safe-mode"
  10512. >bezpeΦn² re╛im</A
  10513. >, etc...), and
  10514.      preferably enough code to make others able to reproduce and test
  10515.      your problem.
  10516.     </P
  10517. ></DIV
  10518. ><DIV
  10519. CLASS="sect2"
  10520. ><HR><H3
  10521. CLASS="sect2"
  10522. ><A
  10523. NAME="install.bugreports"
  10524. ></A
  10525. >Bug reports</H3
  10526. ><P
  10527. >      If you think you have found a bug in PHP, please report it.  The
  10528.      PHP developers probably don't know about it, and unless you
  10529.      report it, chances are it won't be fixed. You can report bugs
  10530.      using the bug-tracking system at <A
  10531. HREF="http://bugs.php.net/"
  10532. TARGET="_top"
  10533. >http://bugs.php.net/</A
  10534. >. Please do not
  10535.      send bug reports in mailing list or personal letters. The
  10536.      bug system is also suitable to submit feature requests.
  10537.     </P
  10538. ><P
  10539. >      Read the <A
  10540. HREF="http://bugs.php.net/how-to-report.php"
  10541. TARGET="_top"
  10542. >How to report a bug</A
  10543.      document before submitting any bug reports!
  10544.     </P
  10545. ></DIV
  10546. ></DIV
  10547. ><DIV
  10548. CLASS="sect1"
  10549. ><HR><H2
  10550. CLASS="sect1"
  10551. ><A
  10552. NAME="install.configure"
  10553. ></A
  10554. >Miscellaneous configure options</H2
  10555. ><P
  10556. >   Below is a partial list of configure options used by the PHP
  10557.   <TT
  10558. CLASS="filename"
  10559. >configure</TT
  10560. > scripts when compiling in Unix-like
  10561.   environments.  Most configure options are listed in their appropriate
  10562.   locations and not here.  For a complete up-to-date list of configure
  10563.   options, run <B
  10564. CLASS="command"
  10565. >./configure --help</B
  10566. > in your PHP source
  10567.   directory after running <B
  10568. CLASS="command"
  10569. >autoconf</B
  10570. > (see also the
  10571.   <A
  10572. HREF="#installation"
  10573. >Installation chapter</A
  10574. >).  You may also
  10575.   be interested in reading the
  10576.   <A
  10577. HREF="http://www.airs.com/ian/configure/"
  10578. TARGET="_top"
  10579. >GNU configure</A
  10580. > documentation for
  10581.   information on additional <B
  10582. CLASS="command"
  10583. >configure</B
  10584. > options such as
  10585.   <TT
  10586. CLASS="literal"
  10587. >--prefix=PREFIX</TT
  10588. >.
  10589.  </P
  10590. ><DIV
  10591. CLASS="note"
  10592. ><BLOCKQUOTE
  10593. CLASS="note"
  10594. ><P
  10595. ><B
  10596. >Poznßmka: </B
  10597. >
  10598.    These are only used at compile time. If you want to alter PHP's
  10599.    runtime configuration, please see the chapter on <A
  10600. HREF="#configuration"
  10601. >Runtime Configuration</A
  10602. >.
  10603.   </P
  10604. ></BLOCKQUOTE
  10605. ></DIV
  10606. ><P
  10607. ></P
  10608. ><UL
  10609. ><LI
  10610. ><P
  10611. >     <A
  10612. HREF="#install.configure.options.graphics"
  10613. >Graphics</A
  10614. >
  10615.    </P
  10616. ></LI
  10617. ><LI
  10618. ><P
  10619. >     <A
  10620. HREF="#install.configure.options.misc"
  10621. >Miscellaneous</A
  10622. >
  10623.    </P
  10624. ></LI
  10625. ><LI
  10626. ><P
  10627. >     <A
  10628. HREF="#install.configure.options.php"
  10629. >PHP Behaviour</A
  10630. >
  10631.    </P
  10632. ></LI
  10633. ><LI
  10634. ><P
  10635. >     <A
  10636. HREF="#install.configure.options.servers"
  10637. >Server</A
  10638. >
  10639.    </P
  10640. ></LI
  10641. ></UL
  10642. ><DIV
  10643. CLASS="sect2"
  10644. ><HR><H3
  10645. CLASS="sect2"
  10646. ><A
  10647. NAME="install.configure.options"
  10648. ></A
  10649. >Configure Options in PHP 4</H3
  10650. ><DIV
  10651. CLASS="note"
  10652. ><BLOCKQUOTE
  10653. CLASS="note"
  10654. ><P
  10655. ><B
  10656. >Poznßmka: </B
  10657. >
  10658.    These options are only used in PHP 4 as of PHP 4.1.0. 
  10659.    Some are available in older versions of PHP 4, some even in PHP 3, some only in PHP 4.1.0.
  10660.    If you want to compile an older version, some options will probably 
  10661.    not be available.
  10662.   </P
  10663. ></BLOCKQUOTE
  10664. ></DIV
  10665. ><DIV
  10666. CLASS="sect3"
  10667. ><HR><H4
  10668. CLASS="sect3"
  10669. ><A
  10670. NAME="install.configure.options.graphics"
  10671. ></A
  10672. >Graphics options</H4
  10673. ><P
  10674. ></P
  10675. ><DIV
  10676. CLASS="variablelist"
  10677. ><DL
  10678. ><DT
  10679. ><A
  10680. NAME="install.configure.with-imagick"
  10681. ></A
  10682. ><TT
  10683. CLASS="parameter"
  10684. ><I
  10685. >--with-imagick</I
  10686. ></TT
  10687. ></DT
  10688. ><DD
  10689. ><P
  10690. >       The imagick extension has been moved to PECL in PEAR and can be found 
  10691.       at <A
  10692. HREF="http://pear.php.net/imagick"
  10693. TARGET="_top"
  10694. >http://pear.php.net/imagick</A
  10695. >.  Install instructions
  10696.       for PHP 4 can be found on the PEAR site.
  10697.      </P
  10698. ><P
  10699. >       Simply doing <TT
  10700. CLASS="literal"
  10701. >--with-imagick</TT
  10702. > is only supported
  10703.       in PHP 3 unless you follow the instructions found on the PEAR site.
  10704.      </P
  10705. ></DD
  10706. ></DL
  10707. ></DIV
  10708. ></DIV
  10709. ><DIV
  10710. CLASS="sect3"
  10711. ><HR><H4
  10712. CLASS="sect3"
  10713. ><A
  10714. NAME="install.configure.options.misc"
  10715. ></A
  10716. >Misc options</H4
  10717. ><P
  10718. ></P
  10719. ><DIV
  10720. CLASS="variablelist"
  10721. ><DL
  10722. ><DT
  10723. ><A
  10724. NAME="install.configure.enable-debug"
  10725. ></A
  10726. ><TT
  10727. CLASS="parameter"
  10728. ><I
  10729. >--enable-debug</I
  10730. ></TT
  10731. ></DT
  10732. ><DD
  10733. ><P
  10734. >       Compile with debugging symbols.
  10735.      </P
  10736. ></DD
  10737. ><DT
  10738. ><A
  10739. NAME="install.configure.with-layout"
  10740. ></A
  10741. ><TT
  10742. CLASS="parameter"
  10743. ><I
  10744. >--with-layout=TYPE</I
  10745. ></TT
  10746. ></DT
  10747. ><DD
  10748. ><P
  10749. >       Sets how installed files will be laid out. Type is one of PHP (default) 
  10750. or GNU.
  10751.      </P
  10752. ></DD
  10753. ><DT
  10754. ><A
  10755. NAME="install.configure.with-pear"
  10756. ></A
  10757. ><TT
  10758. CLASS="parameter"
  10759. ><I
  10760. >--with-pear=DIR</I
  10761. ></TT
  10762. ></DT
  10763. ><DD
  10764. ><P
  10765. >       Install PEAR in DIR (default PREFIX/lib/php).
  10766.      </P
  10767. ></DD
  10768. ><DT
  10769. ><A
  10770. NAME="install.configure.without-pear"
  10771. ></A
  10772. ><TT
  10773. CLASS="parameter"
  10774. ><I
  10775. >--without-pear</I
  10776. ></TT
  10777. ></DT
  10778. ><DD
  10779. ><P
  10780. >       Do not install PEAR.
  10781.      </P
  10782. ></DD
  10783. ><DT
  10784. ><A
  10785. NAME="install.configure.enable-sigchild"
  10786. ></A
  10787. ><TT
  10788. CLASS="parameter"
  10789. ><I
  10790. >--enable-sigchild</I
  10791. ></TT
  10792. ></DT
  10793. ><DD
  10794. ><P
  10795. >       Enable PHP's own SIGCHLD handler.
  10796.      </P
  10797. ></DD
  10798. ><DT
  10799. ><A
  10800. NAME="install.configure.disable-rpath"
  10801. ></A
  10802. ><TT
  10803. CLASS="parameter"
  10804. ><I
  10805. >--disable-rpath</I
  10806. ></TT
  10807. ></DT
  10808. ><DD
  10809. ><P
  10810. >       Disable passing additional runtime library search paths.
  10811.      </P
  10812. ></DD
  10813. ><DT
  10814. ><A
  10815. NAME="install.configure.enable-libgcc"
  10816. ></A
  10817. ><TT
  10818. CLASS="parameter"
  10819. ><I
  10820. >--enable-libgcc</I
  10821. ></TT
  10822. ></DT
  10823. ><DD
  10824. ><P
  10825. >       Enable explicitly linking against libgcc.
  10826.      </P
  10827. ></DD
  10828. ><DT
  10829. ><A
  10830. NAME="install.configure.enable-php-streams"
  10831. ></A
  10832. ><TT
  10833. CLASS="parameter"
  10834. ><I
  10835. >--enable-php-streams</I
  10836. ></TT
  10837. ></DT
  10838. ><DD
  10839. ><P
  10840. >       Include experimental PHP streams. Do not use unless you are testing the 
  10841. code!
  10842.      </P
  10843. ></DD
  10844. ><DT
  10845. ><A
  10846. NAME="install.configure.with-zlib-dir"
  10847. ></A
  10848. ><TT
  10849. CLASS="parameter"
  10850. ><I
  10851. >--with-zlib-dir=<DIR></I
  10852. ></TT
  10853. ></DT
  10854. ><DD
  10855. ><P
  10856. >       Define the location of zlib install directory.
  10857.      </P
  10858. ></DD
  10859. ><DT
  10860. ><A
  10861. NAME="install.configure.enable-trans-sid"
  10862. ></A
  10863. ><TT
  10864. CLASS="parameter"
  10865. ><I
  10866. >--enable-trans-sid</I
  10867. ></TT
  10868. ></DT
  10869. ><DD
  10870. ><P
  10871. >       Enable transparent session id propagation. Only valid for PHP 4.1.2 or
  10872.       less. From PHP 4.2.0, trans-sid feature is always compiled.
  10873.      </P
  10874. ></DD
  10875. ><DT
  10876. ><A
  10877. NAME="install.configure.with-tsrm-pthreads"
  10878. ></A
  10879. ><TT
  10880. CLASS="parameter"
  10881. ><I
  10882. >--with-tsrm-pthreads</I
  10883. ></TT
  10884. ></DT
  10885. ><DD
  10886. ><P
  10887. >       Use POSIX threads (default).
  10888.      </P
  10889. ></DD
  10890. ><DT
  10891. ><A
  10892. NAME="install.configure.enable-shared"
  10893. ></A
  10894. ><TT
  10895. CLASS="parameter"
  10896. ><I
  10897. >--enable-shared[=PKGS]</I
  10898. ></TT
  10899. ></DT
  10900. ><DD
  10901. ><P
  10902. >       Build shared libraries [default=yes].
  10903.      </P
  10904. ></DD
  10905. ><DT
  10906. ><A
  10907. NAME="install.configure.enable-static"
  10908. ></A
  10909. ><TT
  10910. CLASS="parameter"
  10911. ><I
  10912. >--enable-static[=PKGS]</I
  10913. ></TT
  10914. ></DT
  10915. ><DD
  10916. ><P
  10917. >       Build static libraries [default=yes].
  10918.      </P
  10919. ></DD
  10920. ><DT
  10921. ><A
  10922. NAME="install.configure.enable-fast-install"
  10923. ></A
  10924. ><TT
  10925. CLASS="parameter"
  10926. ><I
  10927. >--enable-fast-install[=PKGS]</I
  10928. ></TT
  10929. ></DT
  10930. ><DD
  10931. ><P
  10932. >       Optimize for fast installation [default=yes].
  10933.      </P
  10934. ></DD
  10935. ><DT
  10936. ><A
  10937. NAME="install.configure.with-gnu-ld"
  10938. ></A
  10939. ><TT
  10940. CLASS="parameter"
  10941. ><I
  10942. >--with-gnu-ld</I
  10943. ></TT
  10944. ></DT
  10945. ><DD
  10946. ><P
  10947. >       Assume the C compiler uses GNU ld [default=no].
  10948.      </P
  10949. ></DD
  10950. ><DT
  10951. ><A
  10952. NAME="install.configure.disable-libtool-lock"
  10953. ></A
  10954. ><TT
  10955. CLASS="parameter"
  10956. ><I
  10957. >--disable-libtool-lock</I
  10958. ></TT
  10959. ></DT
  10960. ><DD
  10961. ><P
  10962. >       Avoid locking (might break parallel builds).
  10963.      </P
  10964. ></DD
  10965. ><DT
  10966. ><A
  10967. NAME="install.configure.with-pic"
  10968. ></A
  10969. ><TT
  10970. CLASS="parameter"
  10971. ><I
  10972. >--with-pic</I
  10973. ></TT
  10974. ></DT
  10975. ><DD
  10976. ><P
  10977. >       Try to use only PIC/non-PIC objects [default=use both].
  10978.      </P
  10979. ></DD
  10980. ><DT
  10981. ><A
  10982. NAME="install.configure.enable-memory-limit"
  10983. ></A
  10984. ><TT
  10985. CLASS="parameter"
  10986. ><I
  10987. >--enable-memory-limit</I
  10988. ></TT
  10989. ></DT
  10990. ><DD
  10991. ><P
  10992. >       Compile with memory limit support.
  10993.      </P
  10994. ></DD
  10995. ><DT
  10996. ><A
  10997. NAME="install.configure.disable-url-fopen-wrapper"
  10998. ></A
  10999. ><TT
  11000. CLASS="parameter"
  11001. ><I
  11002. >--disable-url-fopen-wrapper</I
  11003. ></TT
  11004. ></DT
  11005. ><DD
  11006. ><P
  11007. >       Disable the URL-aware fopen wrapper that allows
  11008.       accessing files via HTTP or FTP.
  11009.      </P
  11010. ></DD
  11011. ><DT
  11012. ><A
  11013. NAME="install.configure.enable-versioning.php4"
  11014. ></A
  11015. ><TT
  11016. CLASS="parameter"
  11017. ><I
  11018. >--enable-versioning</I
  11019. ></TT
  11020. ></DT
  11021. ><DD
  11022. ><P
  11023. >       Export only required symbols.
  11024.       See INSTALL for more information.
  11025.      </P
  11026. ></DD
  11027. ><DT
  11028. ><A
  11029. NAME="install.configure.with-ismp"
  11030. ></A
  11031. ><TT
  11032. CLASS="parameter"
  11033. ><I
  11034. >--with-imsp[=DIR]</I
  11035. ></TT
  11036. ></DT
  11037. ><DD
  11038. ><P
  11039. >       Include IMSp support (DIR is IMSP's include dir and libimsp.a dir).
  11040.       PHP 3 only!
  11041.      </P
  11042. ></DD
  11043. ><DT
  11044. ><A
  11045. NAME="install.configure.with-mck"
  11046. ></A
  11047. ><TT
  11048. CLASS="parameter"
  11049. ><I
  11050. >--with-mck[=DIR]</I
  11051. ></TT
  11052. ></DT
  11053. ><DD
  11054. ><P
  11055. >       Include Cybercash MCK support. DIR is the cybercash
  11056.       mck build directory, defaults to
  11057.       /usr/src/mck-3.2.0.3-linux for help look in
  11058.       extra/cyberlib. PHP 3 only!
  11059.      </P
  11060. ></DD
  11061. ><DT
  11062. ><A
  11063. NAME="install.configure.with-mod-dav"
  11064. ></A
  11065. ><TT
  11066. CLASS="parameter"
  11067. ><I
  11068. >--with-mod-dav=DIR</I
  11069. ></TT
  11070. ></DT
  11071. ><DD
  11072. ><P
  11073. >       Include DAV support through Apache's mod_dav,
  11074.       DIR is mod_dav's installation directory (Apache
  11075.       module version only!) PHP 3 only!
  11076.      </P
  11077. ></DD
  11078. ><DT
  11079. ><A
  11080. NAME="install.configure.enable-debugger"
  11081. ></A
  11082. ><TT
  11083. CLASS="parameter"
  11084. ><I
  11085. >--enable-debugger</I
  11086. ></TT
  11087. ></DT
  11088. ><DD
  11089. ><P
  11090. >       Compile with remote debugging functions. PHP 3 only!
  11091.      </P
  11092. ></DD
  11093. ><DT
  11094. ><A
  11095. NAME="install.configure.enable-versioning.php3"
  11096. ></A
  11097. ><TT
  11098. CLASS="parameter"
  11099. ><I
  11100. >--enable-versioning</I
  11101. ></TT
  11102. ></DT
  11103. ><DD
  11104. ><P
  11105. >       Take advantage of versioning and scoping
  11106.       provided by Solaris 2.x and Linux. PHP 3 only!
  11107.      </P
  11108. ></DD
  11109. ></DL
  11110. ></DIV
  11111. ></DIV
  11112. ><DIV
  11113. CLASS="sect3"
  11114. ><HR><H4
  11115. CLASS="sect3"
  11116. ><A
  11117. NAME="install.configure.options.php"
  11118. ></A
  11119. >PHP options</H4
  11120. ><P
  11121. ></P
  11122. ><DIV
  11123. CLASS="variablelist"
  11124. ><DL
  11125. ><DT
  11126. ><A
  11127. NAME="install.configure.enable-maintainer-mode"
  11128. ></A
  11129. ><TT
  11130. CLASS="parameter"
  11131. ><I
  11132. >--enable-maintainer-mode</I
  11133. ></TT
  11134. ></DT
  11135. ><DD
  11136. ><P
  11137. >       Enable make rules and dependencies not useful (and sometimes confusing) 
  11138.       to the casual installer.
  11139.      </P
  11140. ></DD
  11141. ><DT
  11142. ><A
  11143. NAME="install.configure.with-config-file-path"
  11144. ></A
  11145. ><TT
  11146. CLASS="parameter"
  11147. ><I
  11148. >--with-config-file-path=PATH</I
  11149. ></TT
  11150. ></DT
  11151. ><DD
  11152. ><P
  11153. >       Sets the path in which to look for <TT
  11154. CLASS="filename"
  11155. >php.ini</TT
  11156. >, defaults to PREFIX/lib.
  11157.      </P
  11158. ></DD
  11159. ><DT
  11160. ><A
  11161. NAME="install.configure.enable-safe-mode"
  11162. ></A
  11163. ><TT
  11164. CLASS="parameter"
  11165. ><I
  11166. >--enable-safe-mode</I
  11167. ></TT
  11168. ></DT
  11169. ><DD
  11170. ><P
  11171. >       Enable safe mode by default.
  11172.      </P
  11173. ></DD
  11174. ><DT
  11175. ><A
  11176. NAME="install.configure.with-exec-dir"
  11177. ></A
  11178. ><TT
  11179. CLASS="parameter"
  11180. ><I
  11181. >--with-exec-dir[=DIR]</I
  11182. ></TT
  11183. ></DT
  11184. ><DD
  11185. ><P
  11186. >       Only allow executables in DIR when in safe mode defaults to /usr/local/php/bin.
  11187.      </P
  11188. ></DD
  11189. ><DT
  11190. ><A
  11191. NAME="install.configure.enable-magic-quotes"
  11192. ></A
  11193. ><TT
  11194. CLASS="parameter"
  11195. ><I
  11196. >--enable-magic-quotes</I
  11197. ></TT
  11198. ></DT
  11199. ><DD
  11200. ><P
  11201. >       Enable magic quotes by default.
  11202.      </P
  11203. ></DD
  11204. ><DT
  11205. ><A
  11206. NAME="install.configure.disable-short-tags"
  11207. ></A
  11208. ><TT
  11209. CLASS="parameter"
  11210. ><I
  11211. >--disable-short-tags</I
  11212. ></TT
  11213. ></DT
  11214. ><DD
  11215. ><P
  11216. >       Disable the short-form <? start tag by default.
  11217.      </P
  11218. ></DD
  11219. ></DL
  11220. ></DIV
  11221. ></DIV
  11222. ><DIV
  11223. CLASS="sect3"
  11224. ><HR><H4
  11225. CLASS="sect3"
  11226. ><A
  11227. NAME="install.configure.options.servers"
  11228. ></A
  11229. >SAPI options</H4
  11230. ><P
  11231. >    The following list contains the available SAPI&s (<TT
  11232. CLASS="literal"
  11233. >Server
  11234.    Application Programming Interface)</TT
  11235. > for PHP.
  11236.   </P
  11237. ><P
  11238. ></P
  11239. ><DIV
  11240. CLASS="variablelist"
  11241. ><DL
  11242. ><DT
  11243. ><A
  11244. NAME="install.configure.with-aolserver"
  11245. ></A
  11246. ><TT
  11247. CLASS="parameter"
  11248. ><I
  11249. >--with-aolserver=DIR</I
  11250. ></TT
  11251. ></DT
  11252. ><DD
  11253. ><P
  11254. >       Specify path to the installed AOLserver.
  11255.      </P
  11256. ></DD
  11257. ><DT
  11258. ><A
  11259. NAME="install.configure.with-apxs"
  11260. ></A
  11261. ><TT
  11262. CLASS="parameter"
  11263. ><I
  11264. >--with-apxs[=FILE]</I
  11265. ></TT
  11266. ></DT
  11267. ><DD
  11268. ><P
  11269. >       Build shared Apache module. FILE is the optional pathname to the Apache
  11270.       apxs tool; defaults to apxs. Make sure you specify the version of apxs that
  11271.       is actually installed on your system and NOT the one that is in the apache
  11272.       source tarball.
  11273.      </P
  11274. ></DD
  11275. ><DT
  11276. ><A
  11277. NAME="install.configure.with-apache"
  11278. ></A
  11279. ><TT
  11280. CLASS="parameter"
  11281. ><I
  11282. >--with-apache[=DIR]</I
  11283. ></TT
  11284. ></DT
  11285. ><DD
  11286. ><P
  11287. >       Build a static Apache module. DIR is the top-level Apache build directory,
  11288.       defaults to <TT
  11289. CLASS="filename"
  11290. >/usr/local/apache</TT
  11291. >.
  11292.      </P
  11293. ></DD
  11294. ><DT
  11295. ><A
  11296. NAME="install.configure.with-mod_charset"
  11297. ></A
  11298. ><TT
  11299. CLASS="parameter"
  11300. ><I
  11301. >--with-mod_charset</I
  11302. ></TT
  11303. ></DT
  11304. ><DD
  11305. ><P
  11306. >       Enable transfer tables for mod_charset (Russian Apache).
  11307.      </P
  11308. ></DD
  11309. ><DT
  11310. ><A
  11311. NAME="install.configure.with-apxs2"
  11312. ></A
  11313. ><TT
  11314. CLASS="parameter"
  11315. ><I
  11316. >--with-apxs2[=FILE]</I
  11317. ></TT
  11318. ></DT
  11319. ><DD
  11320. ><P
  11321. >       Build shared Apache 2.0 module. FILE is the optional pathname to the Apache
  11322.       apxs tool; defaults to apxs.
  11323.      </P
  11324. ></DD
  11325. ><DT
  11326. ><A
  11327. NAME="install.configure.with-caudium"
  11328. ></A
  11329. ><TT
  11330. CLASS="parameter"
  11331. ><I
  11332. >--with-caudium=DIR</I
  11333. ></TT
  11334. ></DT
  11335. ><DD
  11336. ><P
  11337. >       Build PHP as a Pike module for use with Caudium. DIR is the Caudium server
  11338.       dir, with the default value <TT
  11339. CLASS="filename"
  11340. >/usr/local/caudium/server</TT
  11341. >.
  11342.      </P
  11343. ></DD
  11344. ><DT
  11345. ><A
  11346. NAME="install.configure.disable-cli"
  11347. ></A
  11348. ><TT
  11349. CLASS="parameter"
  11350. ><I
  11351. >--disable-cli</I
  11352. ></TT
  11353. ></DT
  11354. ><DD
  11355. ><P
  11356. >       Available with PHP 4.3.0. Disable building the CLI version of PHP (this
  11357.       forces <A
  11358. HREF="#install.configure.without-pear"
  11359. >--without-pear</A
  11360. >).
  11361.       More information is available in the section about
  11362.       <A
  11363. HREF="#features.commandline"
  11364. >Using PHP from the command line</A
  11365. >.
  11366.      </P
  11367. ></DD
  11368. ><DT
  11369. ><A
  11370. NAME="install.configure.enable-embed"
  11371. ></A
  11372. ><TT
  11373. CLASS="parameter"
  11374. ><I
  11375. > --enable-embed[=TYPE]</I
  11376. ></TT
  11377. ></DT
  11378. ><DD
  11379. ><P
  11380. >       Enable building of the embedded SAPI library. TYPE is either
  11381.       <TT
  11382. CLASS="literal"
  11383. >shared</TT
  11384. > or <TT
  11385. CLASS="literal"
  11386. >static</TT
  11387. >, which
  11388.       defaults to <TT
  11389. CLASS="literal"
  11390. >shared</TT
  11391. >. Available with PHP 4.3.0.
  11392.      </P
  11393. ></DD
  11394. ><DT
  11395. ><A
  11396. NAME="install.configure.with-fhttpd"
  11397. ></A
  11398. ><TT
  11399. CLASS="parameter"
  11400. ><I
  11401. >--with-fhttpd[=DIR]</I
  11402. ></TT
  11403. ></DT
  11404. ><DD
  11405. ><P
  11406. >       Build fhttpd module. DIR is the fhttpd sources directory, defaults to
  11407.       <TT
  11408. CLASS="filename"
  11409. >/usr/local/src/fhttpd</TT
  11410. >. No longer available as of PHP
  11411.       4.3.0.
  11412.      </P
  11413. ></DD
  11414. ><DT
  11415. ><A
  11416. NAME="install.configure.with-isapi"
  11417. ></A
  11418. ><TT
  11419. CLASS="parameter"
  11420. ><I
  11421. >--with-isapi=DIR</I
  11422. ></TT
  11423. ></DT
  11424. ><DD
  11425. ><P
  11426. >       Build PHP as an ISAPI module for use with Zeus.
  11427.      </P
  11428. ></DD
  11429. ><DT
  11430. ><A
  11431. NAME="install.configure.with-nsapi"
  11432. ></A
  11433. ><TT
  11434. CLASS="parameter"
  11435. ><I
  11436. >--with-nsapi=DIR</I
  11437. ></TT
  11438. ></DT
  11439. ><DD
  11440. ><P
  11441. >       Specify path to the installed Netscape/iPlanet/SunONE Webserver.
  11442.      </P
  11443. ></DD
  11444. ><DT
  11445. ><A
  11446. NAME="install.configure.with-phttpd"
  11447. ></A
  11448. ><TT
  11449. CLASS="parameter"
  11450. ><I
  11451. >--with-phttpd=DIR</I
  11452. ></TT
  11453. ></DT
  11454. ><DD
  11455. ><P
  11456. >       No information yet.
  11457.      </P
  11458. ></DD
  11459. ><DT
  11460. ><A
  11461. NAME="install.configure.with-pi3web"
  11462. ></A
  11463. ><TT
  11464. CLASS="parameter"
  11465. ><I
  11466. >--with-pi3web=DIR</I
  11467. ></TT
  11468. ></DT
  11469. ><DD
  11470. ><P
  11471. >       Build PHP as a module for use with Pi3Web.
  11472.      </P
  11473. ></DD
  11474. ><DT
  11475. ><A
  11476. NAME="install.configure.with-roxen"
  11477. ></A
  11478. ><TT
  11479. CLASS="parameter"
  11480. ><I
  11481. >--with-roxen=DIR</I
  11482. ></TT
  11483. ></DT
  11484. ><DD
  11485. ><P
  11486. >       Build PHP as a Pike module. DIR is the base Roxen directory, normally
  11487.       <TT
  11488. CLASS="filename"
  11489. >/usr/local/roxen/server</TT
  11490. >.
  11491.      </P
  11492. ></DD
  11493. ><DT
  11494. ><A
  11495. NAME="install.configure.enable-roxen-zts"
  11496. ></A
  11497. ><TT
  11498. CLASS="parameter"
  11499. ><I
  11500. >--enable-roxen-zts</I
  11501. ></TT
  11502. ></DT
  11503. ><DD
  11504. ><P
  11505. >       Build the Roxen module using Zend Thread Safety.
  11506.      </P
  11507. ></DD
  11508. ><DT
  11509. ><A
  11510. NAME="install.configure.with-servlet"
  11511. ></A
  11512. ><TT
  11513. CLASS="parameter"
  11514. ><I
  11515. >--with-servlet[=DIR]</I
  11516. ></TT
  11517. ></DT
  11518. ><DD
  11519. ><P
  11520. >       Include servlet support. DIR is the base install directory for the JSDK.
  11521.       This SAPI requires the java extension must be built as a shared dl.
  11522.      </P
  11523. ></DD
  11524. ><DT
  11525. ><A
  11526. NAME="install.configure.with-thttpd"
  11527. ></A
  11528. ><TT
  11529. CLASS="parameter"
  11530. ><I
  11531. >--with-thttpd=SRCDIR</I
  11532. ></TT
  11533. ></DT
  11534. ><DD
  11535. ><P
  11536. >       Build PHP as thttpd module.
  11537.      </P
  11538. ></DD
  11539. ><DT
  11540. ><A
  11541. NAME="install.configure.with-tux"
  11542. ></A
  11543. ><TT
  11544. CLASS="parameter"
  11545. ><I
  11546. >--with-tux=MODULEDIR</I
  11547. ></TT
  11548. ></DT
  11549. ><DD
  11550. ><P
  11551. >       Build PHP as a TUX module (Linux only).
  11552.      </P
  11553. ></DD
  11554. ><DT
  11555. ><A
  11556. NAME="install.configure.with-webjames"
  11557. ></A
  11558. ><TT
  11559. CLASS="parameter"
  11560. ><I
  11561. >--with-webjames=SRCDIR</I
  11562. ></TT
  11563. ></DT
  11564. ><DD
  11565. ><P
  11566. >       Build PHP as a WebJames module (RISC OS only)
  11567.      </P
  11568. ></DD
  11569. ><DT
  11570. ><A
  11571. NAME="install.configure.disable-cgi"
  11572. ></A
  11573. ><TT
  11574. CLASS="parameter"
  11575. ><I
  11576. > --disable-cgi</I
  11577. ></TT
  11578. ></DT
  11579. ><DD
  11580. ><P
  11581. >       Disable building CGI version of PHP. Available with PHP 4.3.0.
  11582.      </P
  11583. ></DD
  11584. ><DT
  11585. ><A
  11586. NAME="install.configure.enable-force-cgi-redirect"
  11587. ></A
  11588. ><TT
  11589. CLASS="parameter"
  11590. ><I
  11591. >--enable-force-cgi-redirect</I
  11592. ></TT
  11593. ></DT
  11594. ><DD
  11595. ><P
  11596. >       Enable the security check for internal server redirects. You should use
  11597.       this if you are running the CGI version with Apache.
  11598.      </P
  11599. ></DD
  11600. ><DT
  11601. ><A
  11602. NAME="install.configure.enable-discard-path"
  11603. ></A
  11604. ><TT
  11605. CLASS="parameter"
  11606. ><I
  11607. >--enable-discard-path</I
  11608. ></TT
  11609. ></DT
  11610. ><DD
  11611. ><P
  11612. >       If this is enabled, the PHP CGI binary can safely be placed outside of
  11613.       the web tree and people will not be able to circumvent <TT
  11614. CLASS="filename"
  11615. >.htaccess</TT
  11616. >
  11617.       security.
  11618.      </P
  11619. ></DD
  11620. ><DT
  11621. ><A
  11622. NAME="install.configure.with-fastcgi"
  11623. ></A
  11624. ><TT
  11625. CLASS="parameter"
  11626. ><I
  11627. >--with-fastcgi</I
  11628. ></TT
  11629. ></DT
  11630. ><DD
  11631. ><P
  11632. >       Build PHP as FastCGI application. No longer available as of PHP 4.3.0,
  11633.       instead you should use <TT
  11634. CLASS="parameter"
  11635. ><I
  11636. >--enable-fastcgi</I
  11637. ></TT
  11638. >.
  11639.      </P
  11640. ></DD
  11641. ><DT
  11642. ><A
  11643. NAME="install.configure.enable-fastcgi"
  11644. ></A
  11645. ><TT
  11646. CLASS="parameter"
  11647. ><I
  11648. >--enable-fastcgi</I
  11649. ></TT
  11650. ></DT
  11651. ><DD
  11652. ><P
  11653. >       If this is enabled, the CGI module will be built with support for FastCGI
  11654.       also. Available since PHP 4.3.0
  11655.      </P
  11656. ></DD
  11657. ><DT
  11658. ><A
  11659. NAME="install.configure.disable-path-info-check"
  11660. ></A
  11661. ><TT
  11662. CLASS="parameter"
  11663. ><I
  11664. >--disable-path-info-check</I
  11665. ></TT
  11666. ></DT
  11667. ><DD
  11668. ><P
  11669. >       If this is disabled, paths such as <TT
  11670. CLASS="filename"
  11671. >/info.php/test?a=b</TT
  11672. >
  11673.       will fail to work. Available since <TT
  11674. CLASS="literal"
  11675. >PHP 4.3.0</TT
  11676. >.
  11677.       For more information see the
  11678.       <A
  11679. HREF="http://httpd.apache.org/docs-2.0/en/mod/core.html#acceptpathinfo"
  11680. TARGET="_top"
  11681. >Apache Manual</A
  11682. >.
  11683.      </P
  11684. ></DD
  11685. ></DL
  11686. ></DIV
  11687. ></DIV
  11688. ></DIV
  11689. ></DIV
  11690. ></DIV
  11691. ><DIV
  11692. CLASS="chapter"
  11693. ><HR><H1
  11694. ><A
  11695. NAME="configuration"
  11696. >Kapitola 4. Runtime Configuration</A
  11697. ></H1
  11698. ><DIV
  11699. CLASS="sect1"
  11700. ><H2
  11701. CLASS="sect1"
  11702. ><A
  11703. NAME="configuration.file"
  11704. ></A
  11705. >The configuration file</H2
  11706. ><P
  11707. >     The configuration file (called <TT
  11708. CLASS="filename"
  11709. >php3.ini</TT
  11710. > in
  11711.     PHP 3.0, and simply <TT
  11712. CLASS="filename"
  11713. >php.ini</TT
  11714. > as of PHP 4.0)
  11715.     is read when PHP starts up. For the server module versions of PHP,
  11716.     this happens only once when the web server is started. For the
  11717.     <SPAN
  11718. CLASS="acronym"
  11719. >CGI</SPAN
  11720. > and <SPAN
  11721. CLASS="acronym"
  11722. >CLI</SPAN
  11723. > version, it happens on
  11724.     every invocation.
  11725.    </P
  11726. ><P
  11727. >     The default location of <TT
  11728. CLASS="filename"
  11729. >php.ini</TT
  11730. > is a compile time option (see the <A
  11731. HREF="#faq.installation.phpini"
  11732. >FAQ</A
  11733. > entry), but can be changed
  11734.     for the <SPAN
  11735. CLASS="acronym"
  11736. >CGI</SPAN
  11737. > and <SPAN
  11738. CLASS="acronym"
  11739. >CLI</SPAN
  11740. > version with the
  11741.     <TT
  11742. CLASS="literal"
  11743. >-c</TT
  11744. > command line switch, see the chapter about using
  11745.     <TT
  11746. CLASS="literal"
  11747. >PHP</TT
  11748. > from the <A
  11749. HREF="#features.commandline"
  11750. >command line</A
  11751. >. You can also use the
  11752.     environment variable <TT
  11753. CLASS="literal"
  11754. >PHPRC</TT
  11755. > for an additional path to
  11756.     search for a <TT
  11757. CLASS="filename"
  11758. >php.ini</TT
  11759. > file.
  11760.    </P
  11761. ><DIV
  11762. CLASS="note"
  11763. ><BLOCKQUOTE
  11764. CLASS="note"
  11765. ><P
  11766. ><B
  11767. >Poznßmka: </B
  11768. >
  11769.      The Apache web server changes the directory to root at startup causing
  11770.      PHP to attempt to read <TT
  11771. CLASS="filename"
  11772. >php.ini</TT
  11773. > from the root
  11774.      filesystem if it exists.
  11775.     </P
  11776. ></BLOCKQUOTE
  11777. ></DIV
  11778. ><P
  11779. >     Not every PHP directive is documented below. For a list of all directives, 
  11780.     please read your well commented <TT
  11781. CLASS="filename"
  11782. >php.ini</TT
  11783. > file. You may want to view the 
  11784.     latest <A
  11785. HREF="http://cvs.php.net/co.php/php-src/php.ini-dist"
  11786. TARGET="_top"
  11787. >php.ini here</A
  11788. > from CVS.
  11789.    </P
  11790. ><DIV
  11791. CLASS="note"
  11792. ><BLOCKQUOTE
  11793. CLASS="note"
  11794. ><P
  11795. ><B
  11796. >Poznßmka: </B
  11797. >
  11798.      The default value for the PHP directive 
  11799.      <A
  11800. HREF="#ini.register-globals"
  11801. >register_globals</A
  11802. > changed from 
  11803.      <SPAN
  11804. CLASS="emphasis"
  11805. ><I
  11806. CLASS="emphasis"
  11807. >on</I
  11808. ></SPAN
  11809. > to <SPAN
  11810. CLASS="emphasis"
  11811. ><I
  11812. CLASS="emphasis"
  11813. >off</I
  11814. ></SPAN
  11815. > in PHP 
  11816.      <A
  11817. HREF="http://www.php.net/release_4_2_0.php"
  11818. TARGET="_top"
  11819. >4.2.0</A
  11820. >.
  11821.     </P
  11822. ></BLOCKQUOTE
  11823. ></DIV
  11824. ><P
  11825. >     <TABLE
  11826. WIDTH="100%"
  11827. BORDER="0"
  11828. CELLPADDING="0"
  11829. CELLSPACING="0"
  11830. CLASS="EXAMPLE"
  11831. ><TR
  11832. ><TD
  11833. ><DIV
  11834. CLASS="example"
  11835. ><A
  11836. NAME="AEN2442"
  11837. ></A
  11838. ><P
  11839. ><B
  11840. >P°φklad 4-1. <TT
  11841. CLASS="filename"
  11842. >php.ini</TT
  11843. > example</B
  11844. ></P
  11845. ><TABLE
  11846. BORDER="0"
  11847. BGCOLOR="#E0E0E0"
  11848. CELLPADDING="5"
  11849. ><TR
  11850. ><TD
  11851. ><PRE
  11852. CLASS="ini"
  11853. >; any text on a line after an unquoted semicolon (;) is ignored
  11854. [php] ; section markers (text within square brackets) are also ignored
  11855. ; Boolean values can be set to either:
  11856. ;    true, on, yes
  11857. ; or false, off, no, none
  11858. register_globals = off
  11859. magic_quotes_gpc = yes
  11860.  
  11861. ; you can enclose strings in double-quotes
  11862. include_path = ".:/usr/local/lib/php"
  11863.  
  11864. ; backslashes are treated the same as any other character
  11865. include_path = ".;c:\php\lib"</PRE
  11866. ></TD
  11867. ></TR
  11868. ></TABLE
  11869. ></DIV
  11870. ></TD
  11871. ></TR
  11872. ></TABLE
  11873. >
  11874.    </P
  11875. ></DIV
  11876. ><DIV
  11877. CLASS="sect1"
  11878. ><HR><H2
  11879. CLASS="sect1"
  11880. ><A
  11881. NAME="configuration.changes"
  11882. ></A
  11883. >How to change configuration settings</H2
  11884. ><DIV
  11885. CLASS="sect2"
  11886. ><H3
  11887. CLASS="sect2"
  11888. ><A
  11889. NAME="configuration.changes.apache"
  11890. ></A
  11891. >Running <TT
  11892. CLASS="literal"
  11893. >PHP</TT
  11894. > as Apache module</H3
  11895. ><P
  11896. >      When using PHP as an Apache module, you can also change the
  11897.      configuration settings using directives in Apache configuration
  11898.      files (e.g. <TT
  11899. CLASS="filename"
  11900. >httpd.conf</TT
  11901. >) and
  11902.      <TT
  11903. CLASS="filename"
  11904. >.htaccess</TT
  11905. > files (You will need
  11906.      "AllowOverride Options" or "AllowOverride All" privileges)
  11907.     </P
  11908. ><P
  11909. >      With PHP 4.0, there are several Apache directives that allow you
  11910.      to change the PHP configuration from within the Apache configuration
  11911.      files.  For a listing of which directives are 
  11912.      <TT
  11913. CLASS="constant"
  11914. ><B
  11915. >PHP_INI_ALL</B
  11916. ></TT
  11917. >, <TT
  11918. CLASS="constant"
  11919. ><B
  11920. >PHP_INI_PERDIR</B
  11921. ></TT
  11922. >, 
  11923.      or <TT
  11924. CLASS="constant"
  11925. ><B
  11926. >PHP_INI_SYSTEM</B
  11927. ></TT
  11928. >, have a look at the table
  11929.      found within the <A
  11930. HREF="#function.ini-set"
  11931. ><B
  11932. CLASS="function"
  11933. >ini_set()</B
  11934. ></A
  11935. > documentation.
  11936.     </P
  11937. ><DIV
  11938. CLASS="note"
  11939. ><BLOCKQUOTE
  11940. CLASS="note"
  11941. ><P
  11942. ><B
  11943. >Poznßmka: </B
  11944. >
  11945.       With PHP 3.0, there are Apache directives that correspond to each
  11946.       configuration setting in the <TT
  11947. CLASS="filename"
  11948. >php3.ini</TT
  11949. > name,
  11950.       except the name is prefixed by "php3_".
  11951.      </P
  11952. ></BLOCKQUOTE
  11953. ></DIV
  11954. ><P
  11955. >      <P
  11956. ></P
  11957. ><DIV
  11958. CLASS="variablelist"
  11959. ><DL
  11960. ><DT
  11961. ><SPAN
  11962. CLASS="systemitem"
  11963. >php_value</SPAN
  11964. >
  11965.         <TT
  11966. CLASS="parameter"
  11967. ><I
  11968. >name</I
  11969. ></TT
  11970. >
  11971.         <TT
  11972. CLASS="parameter"
  11973. ><I
  11974. >value</I
  11975. ></TT
  11976. ></DT
  11977. ><DD
  11978. ><P
  11979. >          Sets the value of the specified directive.
  11980.          Can be used only with <TT
  11981. CLASS="constant"
  11982. ><B
  11983. >PHP_INI_ALL</B
  11984. ></TT
  11985. > and <TT
  11986. CLASS="constant"
  11987. ><B
  11988. >PHP_INI_PERDIR</B
  11989. ></TT
  11990. > type directives.
  11991.          To clear a previously set value use <TT
  11992. CLASS="literal"
  11993. >none</TT
  11994. > as the value.
  11995.         </P
  11996. ><DIV
  11997. CLASS="note"
  11998. ><BLOCKQUOTE
  11999. CLASS="note"
  12000. ><P
  12001. ><B
  12002. >Poznßmka: </B
  12003. >
  12004.           Don't use <TT
  12005. CLASS="literal"
  12006. >php_value</TT
  12007. > to set boolean values.
  12008.           <TT
  12009. CLASS="literal"
  12010. >php_flag</TT
  12011. > (see below) should be used instead.
  12012.          </P
  12013. ></BLOCKQUOTE
  12014. ></DIV
  12015. ></DD
  12016. ><DT
  12017. ><SPAN
  12018. CLASS="systemitem"
  12019. >php_flag</SPAN
  12020. >
  12021.         <TT
  12022. CLASS="parameter"
  12023. ><I
  12024. >name</I
  12025. ></TT
  12026. >
  12027.         <TT
  12028. CLASS="parameter"
  12029. ><I
  12030. >on|off</I
  12031. ></TT
  12032. ></DT
  12033. ><DD
  12034. ><P
  12035. >          Used to set a Boolean configuration directive.
  12036.          Can be used only with <TT
  12037. CLASS="constant"
  12038. ><B
  12039. >PHP_INI_ALL</B
  12040. ></TT
  12041. > and <TT
  12042. CLASS="constant"
  12043. ><B
  12044. >PHP_INI_PERDIR</B
  12045. ></TT
  12046. > type directives.
  12047.         </P
  12048. ></DD
  12049. ><DT
  12050. ><SPAN
  12051. CLASS="systemitem"
  12052. >php_admin_value</SPAN
  12053. >
  12054.         <TT
  12055. CLASS="parameter"
  12056. ><I
  12057. >name</I
  12058. ></TT
  12059. >
  12060.         <TT
  12061. CLASS="parameter"
  12062. ><I
  12063. >value</I
  12064. ></TT
  12065. ></DT
  12066. ><DD
  12067. ><P
  12068. >          Sets the value of the specified directive.
  12069.          This can NOT be used in <TT
  12070. CLASS="filename"
  12071. >.htaccess</TT
  12072. > files.
  12073.          Any directive type set with <SPAN
  12074. CLASS="systemitem"
  12075. >php_admin_value</SPAN
  12076. >
  12077.          can not be overridden by <TT
  12078. CLASS="filename"
  12079. >.htaccess</TT
  12080. > or virtualhost directives.
  12081.          To clear a previously set value use <TT
  12082. CLASS="literal"
  12083. >none</TT
  12084. > as the value.
  12085.         </P
  12086. ></DD
  12087. ><DT
  12088. ><SPAN
  12089. CLASS="systemitem"
  12090. >php_admin_flag</SPAN
  12091. >
  12092.         <TT
  12093. CLASS="parameter"
  12094. ><I
  12095. >name</I
  12096. ></TT
  12097. >
  12098.         <TT
  12099. CLASS="parameter"
  12100. ><I
  12101. >on|off</I
  12102. ></TT
  12103. ></DT
  12104. ><DD
  12105. ><P
  12106. >          Used to set a Boolean configuration directive.
  12107.          This can NOT be used in <TT
  12108. CLASS="filename"
  12109. >.htaccess</TT
  12110. > files.
  12111.          Any directive type set with <SPAN
  12112. CLASS="systemitem"
  12113. >php_admin_flag</SPAN
  12114. >
  12115.          can not be overridden by <TT
  12116. CLASS="filename"
  12117. >.htaccess</TT
  12118. > or virtualhost directives.
  12119.         </P
  12120. ></DD
  12121. ></DL
  12122. ></DIV
  12123. >
  12124.     </P
  12125. ><P
  12126. >      <TABLE
  12127. WIDTH="100%"
  12128. BORDER="0"
  12129. CELLPADDING="0"
  12130. CELLSPACING="0"
  12131. CLASS="EXAMPLE"
  12132. ><TR
  12133. ><TD
  12134. ><DIV
  12135. CLASS="example"
  12136. ><A
  12137. NAME="AEN2509"
  12138. ></A
  12139. ><P
  12140. ><B
  12141. >P°φklad 4-2. Apache configuration example</B
  12142. ></P
  12143. ><TABLE
  12144. BORDER="0"
  12145. BGCOLOR="#E0E0E0"
  12146. CELLPADDING="5"
  12147. ><TR
  12148. ><TD
  12149. ><PRE
  12150. CLASS="ini"
  12151. ><IfModule mod_php4.c>
  12152.   php_value include_path ".:/usr/local/lib/php"
  12153.   php_admin_flag safe_mode on
  12154. </IfModule>
  12155. <IfModule mod_php3.c>
  12156.   php3_include_path ".:/usr/local/lib/php"
  12157.   php3_safe_mode on
  12158. </IfModule></PRE
  12159. ></TD
  12160. ></TR
  12161. ></TABLE
  12162. ></DIV
  12163. ></TD
  12164. ></TR
  12165. ></TABLE
  12166. >
  12167.     </P
  12168. ><DIV
  12169. CLASS="caution"
  12170. ><P
  12171. ></P
  12172. ><TABLE
  12173. CLASS="caution"
  12174. BORDER="1"
  12175. WIDTH="100%"
  12176. ><TR
  12177. ><TD
  12178. ALIGN="CENTER"
  12179. ><B
  12180. >V²straha</B
  12181. ></TD
  12182. ></TR
  12183. ><TR
  12184. ><TD
  12185. ALIGN="LEFT"
  12186. ><P
  12187. >       PHP constants do not exist outside of PHP. For example, in 
  12188.       <TT
  12189. CLASS="filename"
  12190. >httpd.conf</TT
  12191. > you can not use PHP constants 
  12192.       such as <TT
  12193. CLASS="constant"
  12194. ><B
  12195. >E_ALL</B
  12196. ></TT
  12197. > or <TT
  12198. CLASS="constant"
  12199. ><B
  12200. >E_NOTICE</B
  12201. ></TT
  12202.       to set the <A
  12203. HREF="#ini.error-reporting"
  12204. >error_reporting</A
  12205.       directive as they will have no meaning and will evaluate to
  12206.       <SPAN
  12207. CLASS="emphasis"
  12208. ><I
  12209. CLASS="emphasis"
  12210. >0</I
  12211. ></SPAN
  12212. >. Use the associated bitmask values instead.
  12213.       These constants can be used in <TT
  12214. CLASS="filename"
  12215. >php.ini</TT
  12216. >
  12217.      </P
  12218. ></TD
  12219. ></TR
  12220. ></TABLE
  12221. ></DIV
  12222. ></DIV
  12223. ><DIV
  12224. CLASS="sect2"
  12225. ><HR><H3
  12226. CLASS="sect2"
  12227. ><A
  12228. NAME="configuration.changes.windows"
  12229. ></A
  12230. >Changing <TT
  12231. CLASS="literal"
  12232. >PHP</TT
  12233. > configuration via the Windows registry</H3
  12234. ><P
  12235. >       When running PHP on Windows, the configuration values can be
  12236.       modified on per-directory basis using the Windows registry. The
  12237.       configuration values are stored in the registry key 
  12238.       <TT
  12239. CLASS="literal"
  12240. >HKLM\SOFTWARE\PHP\Per Directory Values</TT
  12241. >, 
  12242.       in the sub-keys corresponding to the path names. For example, configuration 
  12243.       values for the directory <TT
  12244. CLASS="literal"
  12245. >c:\inetpub\wwwroot</TT
  12246. > would
  12247.       be stored in the key <TT
  12248. CLASS="literal"
  12249. >HKLM\SOFTWARE\PHP\Per Directory
  12250.       Values\c\inetpub\wwwroot</TT
  12251. >. The settings for the
  12252.       directory would be active for any script running from this
  12253.       directory or any subdirectory of it. The values under the key
  12254.       should have the name of <A
  12255. HREF="#configuration"
  12256. >PHP
  12257.       configuration directive</A
  12258. > and the string value. PHP
  12259.       constants in the values would not be parsed. 
  12260.      </P
  12261. ></DIV
  12262. ><DIV
  12263. CLASS="sect2"
  12264. ><HR><H3
  12265. CLASS="sect2"
  12266. ><A
  12267. NAME="configuration.changes.other"
  12268. ></A
  12269. >Other interfaces to <TT
  12270. CLASS="literal"
  12271. >PHP</TT
  12272. ></H3
  12273. ><P
  12274. >      Regardless of the interface to <TT
  12275. CLASS="literal"
  12276. >PHP</TT
  12277. > you can change
  12278.      certain values at runtime of your scripts through
  12279.      <A
  12280. HREF="#function.ini-set"
  12281. ><B
  12282. CLASS="function"
  12283. >ini_set()</B
  12284. ></A
  12285. >. The following table provides an overview
  12286.      at which level a directive can be set/changed.
  12287.     </P
  12288. ><P
  12289. >      <DIV
  12290. CLASS="table"
  12291. ><A
  12292. NAME="AEN2535"
  12293. ></A
  12294. ><P
  12295. ><B
  12296. >Tabulka 4-1. Definition of PHP_INI_* constants</B
  12297. ></P
  12298. ><TABLE
  12299. BORDER="1"
  12300. CLASS="CALSTABLE"
  12301. ><THEAD
  12302. ><TR
  12303. ><TH
  12304. ALIGN="LEFT"
  12305. VALIGN="MIDDLE"
  12306. >Constant</TH
  12307. ><TH
  12308. ALIGN="LEFT"
  12309. VALIGN="MIDDLE"
  12310. >Value</TH
  12311. ><TH
  12312. ALIGN="LEFT"
  12313. VALIGN="MIDDLE"
  12314. >Meaning</TH
  12315. ></TR
  12316. ></THEAD
  12317. ><TBODY
  12318. ><TR
  12319. ><TD
  12320. ALIGN="LEFT"
  12321. VALIGN="MIDDLE"
  12322. >PHP_INI_USER</TD
  12323. ><TD
  12324. ALIGN="LEFT"
  12325. VALIGN="MIDDLE"
  12326. >1</TD
  12327. ><TD
  12328. ALIGN="LEFT"
  12329. VALIGN="MIDDLE"
  12330. >Entry can be set in user scripts</TD
  12331. ></TR
  12332. ><TR
  12333. ><TD
  12334. ALIGN="LEFT"
  12335. VALIGN="MIDDLE"
  12336. >PHP_INI_PERDIR</TD
  12337. ><TD
  12338. ALIGN="LEFT"
  12339. VALIGN="MIDDLE"
  12340. >2</TD
  12341. ><TD
  12342. ALIGN="LEFT"
  12343. VALIGN="MIDDLE"
  12344. >          Entry can be set in <TT
  12345. CLASS="filename"
  12346. >php.ini</TT
  12347. >, <TT
  12348. CLASS="filename"
  12349. >.htaccess</TT
  12350. > or
  12351.          <TT
  12352. CLASS="filename"
  12353. >httpd.conf</TT
  12354. >
  12355.         </TD
  12356. ></TR
  12357. ><TR
  12358. ><TD
  12359. ALIGN="LEFT"
  12360. VALIGN="MIDDLE"
  12361. >PHP_INI_SYSTEM</TD
  12362. ><TD
  12363. ALIGN="LEFT"
  12364. VALIGN="MIDDLE"
  12365. >4</TD
  12366. ><TD
  12367. ALIGN="LEFT"
  12368. VALIGN="MIDDLE"
  12369. >          Entry can be set in <TT
  12370. CLASS="filename"
  12371. >php.ini</TT
  12372. > or <TT
  12373. CLASS="filename"
  12374. >httpd.conf</TT
  12375. >
  12376.         </TD
  12377. ></TR
  12378. ><TR
  12379. ><TD
  12380. ALIGN="LEFT"
  12381. VALIGN="MIDDLE"
  12382. >PHP_INI_ALL</TD
  12383. ><TD
  12384. ALIGN="LEFT"
  12385. VALIGN="MIDDLE"
  12386. >7</TD
  12387. ><TD
  12388. ALIGN="LEFT"
  12389. VALIGN="MIDDLE"
  12390. >Entry can be set anywhere</TD
  12391. ></TR
  12392. ></TBODY
  12393. ></TABLE
  12394. ></DIV
  12395. >
  12396.     </P
  12397. ><P
  12398. >      You can view the settings of the configuration values in
  12399.      the output of <A
  12400. HREF="#function.phpinfo"
  12401. ><B
  12402. CLASS="function"
  12403. >phpinfo()</B
  12404. ></A
  12405. >. You can also
  12406.      access the values of individual configuration directives using
  12407.      <A
  12408. HREF="#function.ini-get"
  12409. ><B
  12410. CLASS="function"
  12411. >ini_get()</B
  12412. ></A
  12413. > or <A
  12414. HREF="#function.get-cfg-var"
  12415. ><B
  12416. CLASS="function"
  12417. >get_cfg_var()</B
  12418. ></A
  12419. >.
  12420.     </P
  12421. ></DIV
  12422. ></DIV
  12423. ><DIV
  12424. CLASS="sect1"
  12425. ><HR><H2
  12426. CLASS="sect1"
  12427. ><A
  12428. NAME="configuration.directives"
  12429. ></A
  12430. >Miscellaneous configuration directives</H2
  12431. ><P
  12432. >     This is not a complete list of PHP directives.  Directives are listed 
  12433.     in their appropriate locations so for example information on session
  12434.     directives is located in the 
  12435.     <A
  12436. HREF="#ref.session"
  12437. >sessions chapter</A
  12438. >.
  12439.    </P
  12440. ><DIV
  12441. CLASS="sect2"
  12442. ><HR><H3
  12443. CLASS="sect2"
  12444. ><A
  12445. NAME="ini.sect.httpd-options"
  12446. ></A
  12447. >Httpd Options</H3
  12448. ><P
  12449. >      <DIV
  12450. CLASS="table"
  12451. ><A
  12452. NAME="AEN2576"
  12453. ></A
  12454. ><P
  12455. ><B
  12456. >Tabulka 4-2. Httpd Options</B
  12457. ></P
  12458. ><TABLE
  12459. BORDER="1"
  12460. CLASS="CALSTABLE"
  12461. ><THEAD
  12462. ><TR
  12463. ><TH
  12464. ALIGN="LEFT"
  12465. VALIGN="MIDDLE"
  12466. >Name</TH
  12467. ><TH
  12468. ALIGN="LEFT"
  12469. VALIGN="MIDDLE"
  12470. >Default</TH
  12471. ><TH
  12472. ALIGN="LEFT"
  12473. VALIGN="MIDDLE"
  12474. >Changeable</TH
  12475. ></TR
  12476. ></THEAD
  12477. ><TBODY
  12478. ><TR
  12479. ><TD
  12480. ALIGN="LEFT"
  12481. VALIGN="MIDDLE"
  12482. >async_send</TD
  12483. ><TD
  12484. ALIGN="LEFT"
  12485. VALIGN="MIDDLE"
  12486. >"0"</TD
  12487. ><TD
  12488. ALIGN="LEFT"
  12489. VALIGN="MIDDLE"
  12490. >PHP_INI_ALL</TD
  12491. ></TR
  12492. ></TBODY
  12493. ></TABLE
  12494. ></DIV
  12495. >
  12496.     </P
  12497. ><P
  12498. >     </P
  12499. ></DIV
  12500. ><DIV
  12501. CLASS="sect2"
  12502. ><HR><H3
  12503. CLASS="sect2"
  12504. ><A
  12505. NAME="ini.sect.language-options"
  12506. ></A
  12507. >Language Options</H3
  12508. ><P
  12509. >    <DIV
  12510. CLASS="table"
  12511. ><A
  12512. NAME="AEN2593"
  12513. ></A
  12514. ><P
  12515. ><B
  12516. >Tabulka 4-3. Language and Misc Configuration Options</B
  12517. ></P
  12518. ><TABLE
  12519. BORDER="1"
  12520. CLASS="CALSTABLE"
  12521. ><THEAD
  12522. ><TR
  12523. ><TH
  12524. ALIGN="LEFT"
  12525. VALIGN="MIDDLE"
  12526. >Name</TH
  12527. ><TH
  12528. ALIGN="LEFT"
  12529. VALIGN="MIDDLE"
  12530. >Default</TH
  12531. ><TH
  12532. ALIGN="LEFT"
  12533. VALIGN="MIDDLE"
  12534. >Changeable</TH
  12535. ></TR
  12536. ></THEAD
  12537. ><TBODY
  12538. ><TR
  12539. ><TD
  12540. ALIGN="LEFT"
  12541. VALIGN="MIDDLE"
  12542. >short_open_tag</TD
  12543. ><TD
  12544. ALIGN="LEFT"
  12545. VALIGN="MIDDLE"
  12546. >On</TD
  12547. ><TD
  12548. ALIGN="LEFT"
  12549. VALIGN="MIDDLE"
  12550. >PHP_INI_SYSTEM|PHP_INI_PERDIR</TD
  12551. ></TR
  12552. ><TR
  12553. ><TD
  12554. ALIGN="LEFT"
  12555. VALIGN="MIDDLE"
  12556. >asp_tags</TD
  12557. ><TD
  12558. ALIGN="LEFT"
  12559. VALIGN="MIDDLE"
  12560. >Off</TD
  12561. ><TD
  12562. ALIGN="LEFT"
  12563. VALIGN="MIDDLE"
  12564. >PHP_INI_SYSTEM|PHP_INI_PERDIR</TD
  12565. ></TR
  12566. ><TR
  12567. ><TD
  12568. ALIGN="LEFT"
  12569. VALIGN="MIDDLE"
  12570. >precision</TD
  12571. ><TD
  12572. ALIGN="LEFT"
  12573. VALIGN="MIDDLE"
  12574. >"14"</TD
  12575. ><TD
  12576. ALIGN="LEFT"
  12577. VALIGN="MIDDLE"
  12578. >PHP_INI_ALL</TD
  12579. ></TR
  12580. ><TR
  12581. ><TD
  12582. ALIGN="LEFT"
  12583. VALIGN="MIDDLE"
  12584. >y2k_compliance</TD
  12585. ><TD
  12586. ALIGN="LEFT"
  12587. VALIGN="MIDDLE"
  12588. >Off</TD
  12589. ><TD
  12590. ALIGN="LEFT"
  12591. VALIGN="MIDDLE"
  12592. >PHP_INI_ALL</TD
  12593. ></TR
  12594. ><TR
  12595. ><TD
  12596. ALIGN="LEFT"
  12597. VALIGN="MIDDLE"
  12598. >allow_call_time_pass_reference</TD
  12599. ><TD
  12600. ALIGN="LEFT"
  12601. VALIGN="MIDDLE"
  12602. >On</TD
  12603. ><TD
  12604. ALIGN="LEFT"
  12605. VALIGN="MIDDLE"
  12606. >PHP_INI_SYSTEM|PHP_INI_PERDIR</TD
  12607. ></TR
  12608. ><TR
  12609. ><TD
  12610. ALIGN="LEFT"
  12611. VALIGN="MIDDLE"
  12612. >expose_php</TD
  12613. ><TD
  12614. ALIGN="LEFT"
  12615. VALIGN="MIDDLE"
  12616. >On</TD
  12617. ><TD
  12618. ALIGN="LEFT"
  12619. VALIGN="MIDDLE"
  12620. >PHP_INI_SYSTEM</TD
  12621. ></TR
  12622. ></TBODY
  12623. ></TABLE
  12624. ></DIV
  12625. >
  12626.    </P
  12627. ><P
  12628. >Zde je struΦnΘ vysv∞tlenφ
  12629. konfiguraΦnφch direktiv.</P
  12630. ><P
  12631. >      <P
  12632. ></P
  12633. ><DIV
  12634. CLASS="variablelist"
  12635. ><DL
  12636. ><DT
  12637. ><A
  12638. NAME="ini.short-open-tag"
  12639. ></A
  12640. ><TT
  12641. CLASS="parameter"
  12642. ><I
  12643. >short_open_tag</I
  12644. ></TT
  12645. >
  12646.         <A
  12647. HREF="#language.types.boolean"
  12648. ><B
  12649. CLASS="type"
  12650. >boolean</B
  12651. ></A
  12652. ></DT
  12653. ><DD
  12654. ><P
  12655. >          Tells whether the short form (<TT
  12656. CLASS="userinput"
  12657. ><B
  12658. ><? ?></B
  12659. ></TT
  12660. >)
  12661.          of PHP's open tag should be allowed.  If you want to use PHP in
  12662.          combination with XML, you can disable this option in order to 
  12663.          use <TT
  12664. CLASS="userinput"
  12665. ><B
  12666. ><?xml ?></B
  12667. ></TT
  12668. > inline.  Otherwise, you 
  12669.          can print it with PHP, for example: <TT
  12670. CLASS="userinput"
  12671. ><B
  12672. ><?php echo '<?xml 
  12673.          version="1.0"'; ?></B
  12674. ></TT
  12675. >.  Also if disabled, you must use the 
  12676.          long form of the PHP open tag (<TT
  12677. CLASS="userinput"
  12678. ><B
  12679. ><?php ?></B
  12680. ></TT
  12681. >).
  12682.         </P
  12683. ><DIV
  12684. CLASS="note"
  12685. ><BLOCKQUOTE
  12686. CLASS="note"
  12687. ><P
  12688. ><B
  12689. >Poznßmka: </B
  12690. >
  12691.           This directive also affects the shorthand <TT
  12692. CLASS="userinput"
  12693. ><B
  12694. ><?=</B
  12695. ></TT
  12696. >, 
  12697.           which is identical to <TT
  12698. CLASS="userinput"
  12699. ><B
  12700. ><? echo</B
  12701. ></TT
  12702. >.  Use of this 
  12703.           shortcut requires <SPAN
  12704. CLASS="systemitem"
  12705. >short_open_tag</SPAN
  12706. >
  12707.           to be on.
  12708.          </P
  12709. ></BLOCKQUOTE
  12710. ></DIV
  12711. ></DD
  12712. ><DT
  12713. ><A
  12714. NAME="ini.asp-tags"
  12715. ></A
  12716. ><TT
  12717. CLASS="parameter"
  12718. ><I
  12719. >asp_tags</I
  12720. ></TT
  12721. >
  12722.         <A
  12723. HREF="#language.types.boolean"
  12724. ><B
  12725. CLASS="type"
  12726. >boolean</B
  12727. ></A
  12728. ></DT
  12729. ><DD
  12730. ><P
  12731. >          Enables the use of ASP-like <% %> tags in addition to
  12732.          the usual <?php ?> tags. This includes the
  12733.          variable-value printing shorthand of <%= $value %>. For 
  12734.          more information, see <A
  12735. HREF="#language.basic-syntax.phpmode"
  12736. >Escaping from HTML</A
  12737. >.
  12738.         </P
  12739. ><DIV
  12740. CLASS="note"
  12741. ><BLOCKQUOTE
  12742. CLASS="note"
  12743. ><P
  12744. ><B
  12745. >Poznßmka: </B
  12746. >
  12747.           Support for ASP-style tags was added in 3.0.4.
  12748.          </P
  12749. ></BLOCKQUOTE
  12750. ></DIV
  12751. ></DD
  12752. ><DT
  12753. ><A
  12754. NAME="ini.precision"
  12755. ></A
  12756. ><TT
  12757. CLASS="parameter"
  12758. ><I
  12759. >precision</I
  12760. ></TT
  12761. >
  12762.         <A
  12763. HREF="#language.types.integer"
  12764. ><B
  12765. CLASS="type"
  12766. >integer</B
  12767. ></A
  12768. ></DT
  12769. ><DD
  12770. ><P
  12771. >          The number of significant digits displayed in floating point numbers.
  12772.         </P
  12773. ></DD
  12774. ><DT
  12775. ><A
  12776. NAME="ini.y2k-compliance"
  12777. ></A
  12778. ><TT
  12779. CLASS="parameter"
  12780. ><I
  12781. >y2k_compliance</I
  12782. ></TT
  12783. >
  12784.         <A
  12785. HREF="#language.types.boolean"
  12786. ><B
  12787. CLASS="type"
  12788. >boolean</B
  12789. ></A
  12790. ></DT
  12791. ><DD
  12792. ><P
  12793. >          Enforce year 2000 compliance (will cause problems with non-compliant browsers)
  12794.         </P
  12795. ></DD
  12796. ><DT
  12797. ><A
  12798. NAME="ini.allow-call-time-pass-reference"
  12799. ></A
  12800. ><TT
  12801. CLASS="parameter"
  12802. ><I
  12803. >allow_call_time_pass_reference</I
  12804. ></TT
  12805. >
  12806.         <A
  12807. HREF="#language.types.boolean"
  12808. ><B
  12809. CLASS="type"
  12810. >boolean</B
  12811. ></A
  12812. ></DT
  12813. ><DD
  12814. ><P
  12815. >          Whether to enable the ability to force arguments to be passed by reference
  12816.          at function call time. This method is deprecated and is likely to be
  12817.          unsupported in future versions of PHP/Zend.  The encouraged method of
  12818.          specifying which arguments should be passed by reference is in the function
  12819.          declaration.  You're encouraged to try and turn this option Off and make
  12820.          sure your scripts work properly with it in order to ensure they will work
  12821.          with future versions of the language (you will receive a warning each time
  12822.          you use this feature, and the argument will be passed by value instead of by
  12823.          reference).
  12824.         </P
  12825. ><P
  12826. >          See also <A
  12827. HREF="#language.references"
  12828. >References Explained</A
  12829. >.
  12830.         </P
  12831. ></DD
  12832. ><DT
  12833. ><A
  12834. NAME="ini.expose-php"
  12835. ></A
  12836. ><TT
  12837. CLASS="parameter"
  12838. ><I
  12839. >expose_php</I
  12840. ></TT
  12841. >
  12842.         <A
  12843. HREF="#language.types.boolean"
  12844. ><B
  12845. CLASS="type"
  12846. >boolean</B
  12847. ></A
  12848. ></DT
  12849. ><DD
  12850. ><P
  12851. >          Decides whether PHP may expose the fact that it is installed on the server
  12852.          (e.g. by adding its signature to the Web server header). It is no security
  12853.          threat in any way, but it makes it possible to determine whether you use PHP
  12854.          on your server or not.
  12855.         </P
  12856. ></DD
  12857. ></DL
  12858. ></DIV
  12859. >
  12860.     </P
  12861. ></DIV
  12862. ><DIV
  12863. CLASS="sect2"
  12864. ><HR><H3
  12865. CLASS="sect2"
  12866. ><A
  12867. NAME="ini.sect.resource-limits"
  12868. ></A
  12869. >Resource Limits</H3
  12870. ><P
  12871. >     <DIV
  12872. CLASS="table"
  12873. ><A
  12874. NAME="AEN2682"
  12875. ></A
  12876. ><P
  12877. ><B
  12878. >Tabulka 4-4. Resource Limits</B
  12879. ></P
  12880. ><TABLE
  12881. BORDER="1"
  12882. CLASS="CALSTABLE"
  12883. ><THEAD
  12884. ><TR
  12885. ><TH
  12886. ALIGN="LEFT"
  12887. VALIGN="MIDDLE"
  12888. >Name</TH
  12889. ><TH
  12890. ALIGN="LEFT"
  12891. VALIGN="MIDDLE"
  12892. >Default</TH
  12893. ><TH
  12894. ALIGN="LEFT"
  12895. VALIGN="MIDDLE"
  12896. >Changeable</TH
  12897. ></TR
  12898. ></THEAD
  12899. ><TBODY
  12900. ><TR
  12901. ><TD
  12902. ALIGN="LEFT"
  12903. VALIGN="MIDDLE"
  12904. >memory_limit</TD
  12905. ><TD
  12906. ALIGN="LEFT"
  12907. VALIGN="MIDDLE"
  12908. >"8M"</TD
  12909. ><TD
  12910. ALIGN="LEFT"
  12911. VALIGN="MIDDLE"
  12912. >PHP_INI_ALL</TD
  12913. ></TR
  12914. ></TBODY
  12915. ></TABLE
  12916. ></DIV
  12917. >
  12918.    </P
  12919. ><P
  12920. >Zde je struΦnΘ vysv∞tlenφ
  12921. konfiguraΦnφch direktiv.</P
  12922. ><P
  12923. >     <P
  12924. ></P
  12925. ><DIV
  12926. CLASS="variablelist"
  12927. ><DL
  12928. ><DT
  12929. ><A
  12930. NAME="ini.memory-limit"
  12931. ></A
  12932. ><TT
  12933. CLASS="parameter"
  12934. ><I
  12935. >memory_limit</I
  12936. ></TT
  12937. >
  12938.        <A
  12939. HREF="#language.types.integer"
  12940. ><B
  12941. CLASS="type"
  12942. >integer</B
  12943. ></A
  12944. ></DT
  12945. ><DD
  12946. ><P
  12947. >         This sets the maximum amount of memory in bytes that a script
  12948.         is allowed to allocate.  This helps prevent poorly written
  12949.         scripts for eating up all available memory on a server.  In order to
  12950.         use this directive you must have enabled it at compile time.  So, 
  12951.         your configure line would have included:
  12952.         <TT
  12953. CLASS="literal"
  12954. >--enable-memory-limit</TT
  12955. >. Note that you have to set 
  12956.         it to -1 if you don't want any limit for your memory.
  12957.        </P
  12958. ><P
  12959. >         As of PHP 4.3.2, and when memory_limit is enabled, the PHP function 
  12960.         <A
  12961. HREF="#function.memory-get-usage"
  12962. ><B
  12963. CLASS="function"
  12964. >memory_get_usage()</B
  12965. ></A
  12966. > is made available.
  12967.        </P
  12968. ></DD
  12969. ></DL
  12970. ></DIV
  12971. >
  12972.    </P
  12973. ><P
  12974. >     See also: <A
  12975. HREF="#ini.max-execution-time"
  12976. >max_execution_time</A
  12977. >.
  12978.    </P
  12979. ></DIV
  12980. ><DIV
  12981. CLASS="sect2"
  12982. ><HR><H3
  12983. CLASS="sect2"
  12984. ><A
  12985. NAME="ini.sect.data-handling"
  12986. ></A
  12987. >Data Handling</H3
  12988. ><P
  12989. >      <DIV
  12990. CLASS="table"
  12991. ><A
  12992. NAME="AEN2712"
  12993. ></A
  12994. ><P
  12995. ><B
  12996. >Tabulka 4-5. Data Handling Configuration Options</B
  12997. ></P
  12998. ><TABLE
  12999. BORDER="1"
  13000. CLASS="CALSTABLE"
  13001. ><THEAD
  13002. ><TR
  13003. ><TH
  13004. ALIGN="LEFT"
  13005. VALIGN="MIDDLE"
  13006. >Name</TH
  13007. ><TH
  13008. ALIGN="LEFT"
  13009. VALIGN="MIDDLE"
  13010. >Default</TH
  13011. ><TH
  13012. ALIGN="LEFT"
  13013. VALIGN="MIDDLE"
  13014. >Changeable</TH
  13015. ></TR
  13016. ></THEAD
  13017. ><TBODY
  13018. ><TR
  13019. ><TD
  13020. ALIGN="LEFT"
  13021. VALIGN="MIDDLE"
  13022. >track-vars</TD
  13023. ><TD
  13024. ALIGN="LEFT"
  13025. VALIGN="MIDDLE"
  13026. >"On"</TD
  13027. ><TD
  13028. ALIGN="LEFT"
  13029. VALIGN="MIDDLE"
  13030. >PHP_INI_??</TD
  13031. ></TR
  13032. ><TR
  13033. ><TD
  13034. ALIGN="LEFT"
  13035. VALIGN="MIDDLE"
  13036. >arg_separator.output</TD
  13037. ><TD
  13038. ALIGN="LEFT"
  13039. VALIGN="MIDDLE"
  13040. >"&"</TD
  13041. ><TD
  13042. ALIGN="LEFT"
  13043. VALIGN="MIDDLE"
  13044. >PHP_INI_ALL</TD
  13045. ></TR
  13046. ><TR
  13047. ><TD
  13048. ALIGN="LEFT"
  13049. VALIGN="MIDDLE"
  13050. >arg_separator.input</TD
  13051. ><TD
  13052. ALIGN="LEFT"
  13053. VALIGN="MIDDLE"
  13054. >"&"</TD
  13055. ><TD
  13056. ALIGN="LEFT"
  13057. VALIGN="MIDDLE"
  13058. >PHP_INI_SYSTEM|PHP_INI_PERDIR</TD
  13059. ></TR
  13060. ><TR
  13061. ><TD
  13062. ALIGN="LEFT"
  13063. VALIGN="MIDDLE"
  13064. >variables_order</TD
  13065. ><TD
  13066. ALIGN="LEFT"
  13067. VALIGN="MIDDLE"
  13068. >"EGPCS"</TD
  13069. ><TD
  13070. ALIGN="LEFT"
  13071. VALIGN="MIDDLE"
  13072. >PHP_INI_ALL</TD
  13073. ></TR
  13074. ><TR
  13075. ><TD
  13076. ALIGN="LEFT"
  13077. VALIGN="MIDDLE"
  13078. >register_globals</TD
  13079. ><TD
  13080. ALIGN="LEFT"
  13081. VALIGN="MIDDLE"
  13082. >"Off"</TD
  13083. ><TD
  13084. ALIGN="LEFT"
  13085. VALIGN="MIDDLE"
  13086. >PHP_INI_PERDIR|PHP_INI_SYSTEM</TD
  13087. ></TR
  13088. ><TR
  13089. ><TD
  13090. ALIGN="LEFT"
  13091. VALIGN="MIDDLE"
  13092. >register_argc_argv</TD
  13093. ><TD
  13094. ALIGN="LEFT"
  13095. VALIGN="MIDDLE"
  13096. >"On"</TD
  13097. ><TD
  13098. ALIGN="LEFT"
  13099. VALIGN="MIDDLE"
  13100. >PHP_INI_PERDIR|PHP_INI_SYSTEM</TD
  13101. ></TR
  13102. ><TR
  13103. ><TD
  13104. ALIGN="LEFT"
  13105. VALIGN="MIDDLE"
  13106. >register_long_arrays</TD
  13107. ><TD
  13108. ALIGN="LEFT"
  13109. VALIGN="MIDDLE"
  13110. >"On"</TD
  13111. ><TD
  13112. ALIGN="LEFT"
  13113. VALIGN="MIDDLE"
  13114. >PHP_INI_PERDIR|PHP_INI_SYSTEM</TD
  13115. ></TR
  13116. ><TR
  13117. ><TD
  13118. ALIGN="LEFT"
  13119. VALIGN="MIDDLE"
  13120. >post_max_size</TD
  13121. ><TD
  13122. ALIGN="LEFT"
  13123. VALIGN="MIDDLE"
  13124. >"8M"</TD
  13125. ><TD
  13126. ALIGN="LEFT"
  13127. VALIGN="MIDDLE"
  13128. >PHP_INI_SYSTEM|PHP_INI_PERDIR</TD
  13129. ></TR
  13130. ><TR
  13131. ><TD
  13132. ALIGN="LEFT"
  13133. VALIGN="MIDDLE"
  13134. >gpc_order</TD
  13135. ><TD
  13136. ALIGN="LEFT"
  13137. VALIGN="MIDDLE"
  13138. >"GPC"</TD
  13139. ><TD
  13140. ALIGN="LEFT"
  13141. VALIGN="MIDDLE"
  13142. >PHP_INI_ALL</TD
  13143. ></TR
  13144. ><TR
  13145. ><TD
  13146. ALIGN="LEFT"
  13147. VALIGN="MIDDLE"
  13148. >auto_prepend_file</TD
  13149. ><TD
  13150. ALIGN="LEFT"
  13151. VALIGN="MIDDLE"
  13152. >""</TD
  13153. ><TD
  13154. ALIGN="LEFT"
  13155. VALIGN="MIDDLE"
  13156. >PHP_INI_SYSTEM|PHP_INI_PERDIR</TD
  13157. ></TR
  13158. ><TR
  13159. ><TD
  13160. ALIGN="LEFT"
  13161. VALIGN="MIDDLE"
  13162. >auto_append_file</TD
  13163. ><TD
  13164. ALIGN="LEFT"
  13165. VALIGN="MIDDLE"
  13166. >""</TD
  13167. ><TD
  13168. ALIGN="LEFT"
  13169. VALIGN="MIDDLE"
  13170. >PHP_INI_SYSTEM|PHP_INI_PERDIR</TD
  13171. ></TR
  13172. ><TR
  13173. ><TD
  13174. ALIGN="LEFT"
  13175. VALIGN="MIDDLE"
  13176. >default_mimetype</TD
  13177. ><TD
  13178. ALIGN="LEFT"
  13179. VALIGN="MIDDLE"
  13180. >"text/html"</TD
  13181. ><TD
  13182. ALIGN="LEFT"
  13183. VALIGN="MIDDLE"
  13184. >PHP_INI_ALL</TD
  13185. ></TR
  13186. ><TR
  13187. ><TD
  13188. ALIGN="LEFT"
  13189. VALIGN="MIDDLE"
  13190. >default_charset</TD
  13191. ><TD
  13192. ALIGN="LEFT"
  13193. VALIGN="MIDDLE"
  13194. >"iso-8859-1"</TD
  13195. ><TD
  13196. ALIGN="LEFT"
  13197. VALIGN="MIDDLE"
  13198. >PHP_INI_ALL</TD
  13199. ></TR
  13200. ><TR
  13201. ><TD
  13202. ALIGN="LEFT"
  13203. VALIGN="MIDDLE"
  13204. >always_populate_raw_post_data</TD
  13205. ><TD
  13206. ALIGN="LEFT"
  13207. VALIGN="MIDDLE"
  13208. >"0"</TD
  13209. ><TD
  13210. ALIGN="LEFT"
  13211. VALIGN="MIDDLE"
  13212. >PHP_INI_SYSTEM|PHP_INI_PERDIR</TD
  13213. ></TR
  13214. ><TR
  13215. ><TD
  13216. ALIGN="LEFT"
  13217. VALIGN="MIDDLE"
  13218. >allow_webdav_methods</TD
  13219. ><TD
  13220. ALIGN="LEFT"
  13221. VALIGN="MIDDLE"
  13222. >"0"</TD
  13223. ><TD
  13224. ALIGN="LEFT"
  13225. VALIGN="MIDDLE"
  13226. >PHP_INI_SYSTEM|PHP_INI_PERDIR</TD
  13227. ></TR
  13228. ></TBODY
  13229. ></TABLE
  13230. ></DIV
  13231. >
  13232.     </P
  13233. ><P
  13234. >Zde je struΦnΘ vysv∞tlenφ
  13235. konfiguraΦnφch direktiv.</P
  13236. ><P
  13237. >      <P
  13238. ></P
  13239. ><DIV
  13240. CLASS="variablelist"
  13241. ><DL
  13242. ><DT
  13243. ><A
  13244. NAME="ini.track-vars"
  13245. ></A
  13246. ><TT
  13247. CLASS="parameter"
  13248. ><I
  13249. >track_vars</I
  13250. ></TT
  13251. >
  13252.         <A
  13253. HREF="#language.types.boolean"
  13254. ><B
  13255. CLASS="type"
  13256. >boolean</B
  13257. ></A
  13258. ></DT
  13259. ><DD
  13260. ><P
  13261. >          If enabled, then Environment, GET, POST, Cookie, and Server
  13262.          variables can be found in the global associative arrays
  13263.          <TT
  13264. CLASS="varname"
  13265. >$_ENV</TT
  13266. >,
  13267.          <TT
  13268. CLASS="varname"
  13269. >$_GET</TT
  13270. >,
  13271.          <TT
  13272. CLASS="varname"
  13273. >$_POST</TT
  13274. >,
  13275.          <TT
  13276. CLASS="varname"
  13277. >$_COOKIE</TT
  13278. >, and
  13279.          <TT
  13280. CLASS="varname"
  13281. >$_SERVER</TT
  13282. >.
  13283.         </P
  13284. ><P
  13285. >          Note that as of PHP 4.0.3, <SPAN
  13286. CLASS="systemitem"
  13287. >track_vars</SPAN
  13288. > is always turned on.
  13289.         </P
  13290. ></DD
  13291. ><DT
  13292. ><A
  13293. NAME="ini.arg-separator.output"
  13294. ></A
  13295. ><TT
  13296. CLASS="parameter"
  13297. ><I
  13298. >arg_separator.output</I
  13299. ></TT
  13300. >
  13301.         <A
  13302. HREF="#language.types.string"
  13303. ><B
  13304. CLASS="type"
  13305. >string</B
  13306. ></A
  13307. ></DT
  13308. ><DD
  13309. ><P
  13310. >          The separator used in PHP generated URLs to separate arguments.
  13311.         </P
  13312. ></DD
  13313. ><DT
  13314. ><A
  13315. NAME="ini.arg-separator.input"
  13316. ></A
  13317. ><TT
  13318. CLASS="parameter"
  13319. ><I
  13320. >arg_separator.input</I
  13321. ></TT
  13322. >
  13323.         <A
  13324. HREF="#language.types.string"
  13325. ><B
  13326. CLASS="type"
  13327. >string</B
  13328. ></A
  13329. ></DT
  13330. ><DD
  13331. ><P
  13332. >          List of separator(s) used by PHP to parse input URLs into variables.
  13333.         </P
  13334. ><DIV
  13335. CLASS="note"
  13336. ><BLOCKQUOTE
  13337. CLASS="note"
  13338. ><P
  13339. ><B
  13340. >Poznßmka: </B
  13341. >
  13342.           Every character in this directive is considered as separator!
  13343.          </P
  13344. ></BLOCKQUOTE
  13345. ></DIV
  13346. ></DD
  13347. ><DT
  13348. ><A
  13349. NAME="ini.variables-order"
  13350. ></A
  13351. ><TT
  13352. CLASS="parameter"
  13353. ><I
  13354. >variables_order</I
  13355. ></TT
  13356. >
  13357.         <A
  13358. HREF="#language.types.string"
  13359. ><B
  13360. CLASS="type"
  13361. >string</B
  13362. ></A
  13363. ></DT
  13364. ><DD
  13365. ><P
  13366. >          Set the order of the EGPCS (Environment, GET, POST, Cookie,
  13367.          Server) variable parsing. The default setting of this
  13368.          directive is "EGPCS". Setting this to "GP", for example,
  13369.          will cause PHP to completely ignore environment variables,
  13370.          cookies and server variables, and to overwrite any GET
  13371.          method variables with POST-method variables of the same name.
  13372.         </P
  13373. ><P
  13374. >          See also <A
  13375. HREF="#ini.register-globals"
  13376. >register_globals</A
  13377. >.
  13378.         </P
  13379. ></DD
  13380. ><DT
  13381. ><A
  13382. NAME="ini.register-globals"
  13383. ></A
  13384. ><TT
  13385. CLASS="parameter"
  13386. ><I
  13387. >register_globals</I
  13388. ></TT
  13389. >
  13390.         <A
  13391. HREF="#language.types.boolean"
  13392. ><B
  13393. CLASS="type"
  13394. >boolean</B
  13395. ></A
  13396. ></DT
  13397. ><DD
  13398. ><P
  13399. >          Tells whether or not to register the EGPCS (Environment, GET,
  13400.          POST, Cookie, Server) variables as global variables. For example;
  13401.          if register_globals = on, the url 
  13402.          <TT
  13403. CLASS="literal"
  13404. >http://www.example.com/test.php?id=3</TT
  13405. > will produce
  13406.          <TT
  13407. CLASS="varname"
  13408. >$id</TT
  13409. >. Or, <TT
  13410. CLASS="varname"
  13411. >$DOCUMENT_ROOT</TT
  13412. > from
  13413.          <TT
  13414. CLASS="varname"
  13415. >$_SERVER['DOCUMENT_ROOT']</TT
  13416. >. You may want to turn
  13417.          this off if you don't want to clutter your scripts' global scope with
  13418.          user data.  As of PHP <A
  13419. HREF="http://www.php.net/release_4_2_0.php"
  13420. TARGET="_top"
  13421. >4.2.0</A
  13422. >,
  13423.          this directive defaults to <SPAN
  13424. CLASS="emphasis"
  13425. ><I
  13426. CLASS="emphasis"
  13427. >off</I
  13428. ></SPAN
  13429. >.  It's preferred to
  13430.          go through PHP <A
  13431. HREF="#reserved.variables"
  13432. >Predefined Variables
  13433.          </A
  13434. > instead, such as the 
  13435.          <A
  13436. HREF="#language.variables.superglobals"
  13437. >superglobals</A
  13438. >:
  13439.          <TT
  13440. CLASS="varname"
  13441. >$_ENV</TT
  13442. >, <TT
  13443. CLASS="varname"
  13444. >$_GET</TT
  13445. >,
  13446.          <TT
  13447. CLASS="varname"
  13448. >$_POST</TT
  13449. >, <TT
  13450. CLASS="varname"
  13451. >$_COOKIE</TT
  13452. >, and
  13453.          <TT
  13454. CLASS="varname"
  13455. >$_SERVER</TT
  13456. >. Please read the security chapter on
  13457.          <A
  13458. HREF="#security.registerglobals"
  13459. >Using register_globals</A
  13460. >
  13461.          for related information.
  13462.         </P
  13463. ><P
  13464. >          Please note that <SPAN
  13465. CLASS="systemitem"
  13466. >register_globals</SPAN
  13467. >
  13468.          cannot be set at runtime (<A
  13469. HREF="#function.ini-set"
  13470. ><B
  13471. CLASS="function"
  13472. >ini_set()</B
  13473. ></A
  13474. >). Although, you can
  13475.          use <TT
  13476. CLASS="filename"
  13477. >.htaccess</TT
  13478. > if your host allows it as described
  13479.          above. An example <TT
  13480. CLASS="filename"
  13481. >.htaccess</TT
  13482. > entry:
  13483.          <TT
  13484. CLASS="userinput"
  13485. ><B
  13486. >php_flag register_globals on</B
  13487. ></TT
  13488. >.
  13489.         </P
  13490. ><DIV
  13491. CLASS="note"
  13492. ><BLOCKQUOTE
  13493. CLASS="note"
  13494. ><P
  13495. ><B
  13496. >Poznßmka: </B
  13497. >
  13498.           <SPAN
  13499. CLASS="systemitem"
  13500. >register_globals</SPAN
  13501. > is affected 
  13502.           by the <A
  13503. HREF="#ini.variables-order"
  13504. >variables_order</A
  13505.           directive.
  13506.          </P
  13507. ></BLOCKQUOTE
  13508. ></DIV
  13509. ></DD
  13510. ><DT
  13511. ><A
  13512. NAME="ini.register-argc-argv"
  13513. ></A
  13514. ><TT
  13515. CLASS="parameter"
  13516. ><I
  13517. >register_argc_argv</I
  13518. ></TT
  13519. >
  13520.         <A
  13521. HREF="#language.types.boolean"
  13522. ><B
  13523. CLASS="type"
  13524. >boolean</B
  13525. ></A
  13526. ></DT
  13527. ><DD
  13528. ><P
  13529. >          Tells PHP whether to declare the argv & argc variables 
  13530.          (that would contain the GET information).
  13531.         </P
  13532. ><P
  13533. >          See also <A
  13534. HREF="#features.commandline"
  13535. >command line</A
  13536. >.
  13537.          Also, this directive became available in PHP 4.0.0 and
  13538.          was always "on" before that.
  13539.         </P
  13540. ></DD
  13541. ><DT
  13542. ><A
  13543. NAME="ini.register-long-arrays"
  13544. ></A
  13545. ><TT
  13546. CLASS="parameter"
  13547. ><I
  13548. >register_long_arrays</I
  13549. ></TT
  13550. >
  13551.         <A
  13552. HREF="#language.types.boolean"
  13553. ><B
  13554. CLASS="type"
  13555. >boolean</B
  13556. ></A
  13557. ></DT
  13558. ><DD
  13559. ><P
  13560. >          Tells PHP whether or not to register the deprecated long 
  13561.          <TT
  13562. CLASS="varname"
  13563. >$HTTP_*_VARS</TT
  13564. > type 
  13565.          <A
  13566. HREF="#language.variables.predefined"
  13567. >predefined 
  13568.          variables</A
  13569. >.  When On (default), long predefined PHP
  13570.          variables like <TT
  13571. CLASS="varname"
  13572. >$HTTP_GET_VARS</TT
  13573. > will be defined.
  13574.          If you're not using them, it's recommended to turn them off,
  13575.          for performance reasons.  Instead, use the superglobal arrays,
  13576.          like <TT
  13577. CLASS="varname"
  13578. >$_GET</TT
  13579. >.
  13580.         </P
  13581. ><P
  13582. >          This directive became available in PHP 5.0.0.
  13583.         </P
  13584. ></DD
  13585. ><DT
  13586. ><A
  13587. NAME="ini.post-max-size"
  13588. ></A
  13589. ><TT
  13590. CLASS="parameter"
  13591. ><I
  13592. >post_max_size</I
  13593. ></TT
  13594. >
  13595.         <A
  13596. HREF="#language.types.integer"
  13597. ><B
  13598. CLASS="type"
  13599. >integer</B
  13600. ></A
  13601. ></DT
  13602. ><DD
  13603. ><P
  13604. >          Sets max size of post data allowed. This setting also affects
  13605.          file upload. To upload large files, this value must be larger
  13606.          than <A
  13607. HREF="#ini.upload-max-filesize"
  13608. >upload_max_filesize</A
  13609. >.
  13610.         </P
  13611. ><P
  13612. >          If memory limit is enabled by your configure script, <A
  13613. HREF="#ini.memory-limit"
  13614. >memory_limit</A
  13615. > also affects
  13616.          file uploading. Generally speaking,
  13617.          <A
  13618. HREF="#ini.memory-limit"
  13619. >memory_limit</A
  13620. > should be
  13621.          larger than <TT
  13622. CLASS="parameter"
  13623. ><I
  13624. >post_max_size</I
  13625. ></TT
  13626. >.
  13627.         </P
  13628. ></DD
  13629. ><DT
  13630. ><A
  13631. NAME="ini.gpc-order"
  13632. ></A
  13633. ><TT
  13634. CLASS="parameter"
  13635. ><I
  13636. >gpc_order</I
  13637. ></TT
  13638. >
  13639.         <A
  13640. HREF="#language.types.string"
  13641. ><B
  13642. CLASS="type"
  13643. >string</B
  13644. ></A
  13645. ></DT
  13646. ><DD
  13647. ><P
  13648. >          Set the order of GET/POST/COOKIE variable parsing. The
  13649.          default setting of this directive is "GPC".  Setting this to
  13650.          "GP", for example, will cause PHP to completely ignore cookies
  13651.          and to overwrite any GET method variables with POST-method
  13652.          variables of the same name.
  13653.         </P
  13654. ><DIV
  13655. CLASS="note"
  13656. ><BLOCKQUOTE
  13657. CLASS="note"
  13658. ><P
  13659. ><B
  13660. >Poznßmka: </B
  13661. >
  13662.           This option is not available in PHP 4.
  13663.           Use <A
  13664. HREF="#ini.variables-order"
  13665. >variables_order</A
  13666. >
  13667.           instead.
  13668.          </P
  13669. ></BLOCKQUOTE
  13670. ></DIV
  13671. ></DD
  13672. ><DT
  13673. ><A
  13674. NAME="ini.auto-prepend-file"
  13675. ></A
  13676. ><TT
  13677. CLASS="parameter"
  13678. ><I
  13679. >auto_prepend_file</I
  13680. ></TT
  13681. >
  13682.         <A
  13683. HREF="#language.types.string"
  13684. ><B
  13685. CLASS="type"
  13686. >string</B
  13687. ></A
  13688. ></DT
  13689. ><DD
  13690. ><P
  13691. >          Specifies the name of a file that is automatically parsed
  13692.          before the main file.  The file is included as if it was
  13693.          called with the <A
  13694. HREF="#function.include"
  13695. ><B
  13696. CLASS="function"
  13697. >include()</B
  13698. ></A
  13699. > function, so
  13700.          <A
  13701. HREF="#ini.include-path"
  13702. >include_path</A
  13703. > is used.</P
  13704. ><P
  13705. >          The special value <SPAN
  13706. CLASS="systemitem"
  13707. >none</SPAN
  13708.          disables auto-prepending.
  13709.         </P
  13710. ></DD
  13711. ><DT
  13712. ><A
  13713. NAME="ini.auto-append-file"
  13714. ></A
  13715. ><TT
  13716. CLASS="parameter"
  13717. ><I
  13718. >auto_append_file</I
  13719. ></TT
  13720. >
  13721.         <A
  13722. HREF="#language.types.string"
  13723. ><B
  13724. CLASS="type"
  13725. >string</B
  13726. ></A
  13727. ></DT
  13728. ><DD
  13729. ><P
  13730. >          Specifies the name of a file that is automatically parsed
  13731.          after the main file.  The file is included as if it was
  13732.          called with the <A
  13733. HREF="#function.include"
  13734. ><B
  13735. CLASS="function"
  13736. >include()</B
  13737. ></A
  13738. > function, so
  13739.          <A
  13740. HREF="#ini.include-path"
  13741. >include_path</A
  13742. > is used.</P
  13743. ><P
  13744. >          The special value <SPAN
  13745. CLASS="systemitem"
  13746. >none</SPAN
  13747.          disables auto-appending.
  13748.          <DIV
  13749. CLASS="note"
  13750. ><BLOCKQUOTE
  13751. CLASS="note"
  13752. ><P
  13753. ><B
  13754. >Poznßmka: </B
  13755. >
  13756.            If the script is terminated with <A
  13757. HREF="#function.exit"
  13758. ><B
  13759. CLASS="function"
  13760. >exit()</B
  13761. ></A
  13762. >,
  13763.            auto-append will <SPAN
  13764. CLASS="emphasis"
  13765. ><I
  13766. CLASS="emphasis"
  13767. >not</I
  13768. ></SPAN
  13769. > occur.</P
  13770. ></BLOCKQUOTE
  13771. ></DIV
  13772. >
  13773.         </P
  13774. ></DD
  13775. ><DT
  13776. ><A
  13777. NAME="ini.default-mimetype"
  13778. ></A
  13779. ><TT
  13780. CLASS="parameter"
  13781. ><I
  13782. >default_mimetype</I
  13783. ></TT
  13784. >
  13785.         <A
  13786. HREF="#language.types.string"
  13787. ><B
  13788. CLASS="type"
  13789. >string</B
  13790. ></A
  13791. ></DT
  13792. ><DD
  13793. ><P
  13794. >         </P
  13795. ></DD
  13796. ><DT
  13797. ><A
  13798. NAME="ini.default-charset"
  13799. ></A
  13800. ><TT
  13801. CLASS="parameter"
  13802. ><I
  13803. >default_charset</I
  13804. ></TT
  13805. >
  13806.         <A
  13807. HREF="#language.types.string"
  13808. ><B
  13809. CLASS="type"
  13810. >string</B
  13811. ></A
  13812. ></DT
  13813. ><DD
  13814. ><P
  13815. >          As of 4.0b4, PHP always outputs a character encoding by default in
  13816.          the Content-type: header. To disable sending of the charset, simply
  13817.          set it to be empty.
  13818.         </P
  13819. ></DD
  13820. ><DT
  13821. ><A
  13822. NAME="ini.always-populate-raw-post-data"
  13823. ></A
  13824. ><TT
  13825. CLASS="parameter"
  13826. ><I
  13827. >always_populate_raw_post_data</I
  13828. ></TT
  13829. >
  13830.         <A
  13831. HREF="#language.types.boolean"
  13832. ><B
  13833. CLASS="type"
  13834. >boolean</B
  13835. ></A
  13836. ></DT
  13837. ><DD
  13838. ><P
  13839. >          Always populate the $HTTP_RAW_POST_DATA variable.
  13840.         </P
  13841. ></DD
  13842. ><DT
  13843. ><A
  13844. NAME="ini.allow-webdav-methods"
  13845. ></A
  13846. ><TT
  13847. CLASS="parameter"
  13848. ><I
  13849. >allow_webdav_methods</I
  13850. ></TT
  13851. >
  13852.         <A
  13853. HREF="#language.types.boolean"
  13854. ><B
  13855. CLASS="type"
  13856. >boolean</B
  13857. ></A
  13858. ></DT
  13859. ><DD
  13860. ><P
  13861. >          Allow handling of WebDAV http requests within PHP scripts (eg.
  13862.          PROPFIND, PROPPATCH, MOVE, COPY, etc..)
  13863.          If you want to get the post data of those requests, you have to
  13864.          set <A
  13865. HREF="#ini.always-populate-raw-post-data"
  13866. >          always_populate_raw_post_data</A
  13867. > as well.
  13868.         </P
  13869. ></DD
  13870. ></DL
  13871. ></DIV
  13872. >
  13873.     </P
  13874. ><P
  13875. >      See also: <A
  13876. HREF="#ini.magic-quotes-gpc"
  13877. >magic_quotes_gpc</A
  13878. >,
  13879.      <A
  13880. HREF="#ini.magic-quotes-runtime"
  13881. >magic-quotes-runtime</A
  13882. >,
  13883.      and
  13884.      <A
  13885. HREF="#ini.magic-quotes-sybase"
  13886. >magic_quotes_sybase</A
  13887. >.
  13888.     </P
  13889. ></DIV
  13890. ><DIV
  13891. CLASS="sect2"
  13892. ><HR><H3
  13893. CLASS="sect2"
  13894. ><A
  13895. NAME="ini.sect.path-directory"
  13896. ></A
  13897. >Paths and Directories</H3
  13898. ><P
  13899. >      <DIV
  13900. CLASS="table"
  13901. ><A
  13902. NAME="AEN2944"
  13903. ></A
  13904. ><P
  13905. ><B
  13906. >Tabulka 4-6. Paths and Directories Configuration Options</B
  13907. ></P
  13908. ><TABLE
  13909. BORDER="1"
  13910. CLASS="CALSTABLE"
  13911. ><THEAD
  13912. ><TR
  13913. ><TH
  13914. ALIGN="LEFT"
  13915. VALIGN="MIDDLE"
  13916. >Name</TH
  13917. ><TH
  13918. ALIGN="LEFT"
  13919. VALIGN="MIDDLE"
  13920. >Default</TH
  13921. ><TH
  13922. ALIGN="LEFT"
  13923. VALIGN="MIDDLE"
  13924. >Changeable</TH
  13925. ></TR
  13926. ></THEAD
  13927. ><TBODY
  13928. ><TR
  13929. ><TD
  13930. ALIGN="LEFT"
  13931. VALIGN="MIDDLE"
  13932. >include_path</TD
  13933. ><TD
  13934. ALIGN="LEFT"
  13935. VALIGN="MIDDLE"
  13936. >PHP_INCLUDE_PATH</TD
  13937. ><TD
  13938. ALIGN="LEFT"
  13939. VALIGN="MIDDLE"
  13940. >PHP_INI_ALL</TD
  13941. ></TR
  13942. ><TR
  13943. ><TD
  13944. ALIGN="LEFT"
  13945. VALIGN="MIDDLE"
  13946. >doc_root</TD
  13947. ><TD
  13948. ALIGN="LEFT"
  13949. VALIGN="MIDDLE"
  13950. >PHP_INCLUDE_PATH</TD
  13951. ><TD
  13952. ALIGN="LEFT"
  13953. VALIGN="MIDDLE"
  13954. >PHP_INI_SYSTEM</TD
  13955. ></TR
  13956. ><TR
  13957. ><TD
  13958. ALIGN="LEFT"
  13959. VALIGN="MIDDLE"
  13960. >user_dir</TD
  13961. ><TD
  13962. ALIGN="LEFT"
  13963. VALIGN="MIDDLE"
  13964. >NULL</TD
  13965. ><TD
  13966. ALIGN="LEFT"
  13967. VALIGN="MIDDLE"
  13968. >PHP_INI_SYSTEM</TD
  13969. ></TR
  13970. ><TR
  13971. ><TD
  13972. ALIGN="LEFT"
  13973. VALIGN="MIDDLE"
  13974. >extension_dir</TD
  13975. ><TD
  13976. ALIGN="LEFT"
  13977. VALIGN="MIDDLE"
  13978. >PHP_EXTENSION_DIR</TD
  13979. ><TD
  13980. ALIGN="LEFT"
  13981. VALIGN="MIDDLE"
  13982. >PHP_INI_SYSTEM</TD
  13983. ></TR
  13984. ><TR
  13985. ><TD
  13986. ALIGN="LEFT"
  13987. VALIGN="MIDDLE"
  13988. >cgi.fix_pathinfo</TD
  13989. ><TD
  13990. ALIGN="LEFT"
  13991. VALIGN="MIDDLE"
  13992. >"0"</TD
  13993. ><TD
  13994. ALIGN="LEFT"
  13995. VALIGN="MIDDLE"
  13996. >PHP_INI_SYSTEM</TD
  13997. ></TR
  13998. ><TR
  13999. ><TD
  14000. ALIGN="LEFT"
  14001. VALIGN="MIDDLE"
  14002. >cgi.force_redirect</TD
  14003. ><TD
  14004. ALIGN="LEFT"
  14005. VALIGN="MIDDLE"
  14006. >"1"</TD
  14007. ><TD
  14008. ALIGN="LEFT"
  14009. VALIGN="MIDDLE"
  14010. >PHP_INI_SYSTEM</TD
  14011. ></TR
  14012. ><TR
  14013. ><TD
  14014. ALIGN="LEFT"
  14015. VALIGN="MIDDLE"
  14016. >cgi.redirect_status_env</TD
  14017. ><TD
  14018. ALIGN="LEFT"
  14019. VALIGN="MIDDLE"
  14020. >""</TD
  14021. ><TD
  14022. ALIGN="LEFT"
  14023. VALIGN="MIDDLE"
  14024. >PHP_INI_SYSTEM</TD
  14025. ></TR
  14026. ><TR
  14027. ><TD
  14028. ALIGN="LEFT"
  14029. VALIGN="MIDDLE"
  14030. >fastcgi.impersonate</TD
  14031. ><TD
  14032. ALIGN="LEFT"
  14033. VALIGN="MIDDLE"
  14034. >"0"</TD
  14035. ><TD
  14036. ALIGN="LEFT"
  14037. VALIGN="MIDDLE"
  14038. >PHP_INI_SYSTEM</TD
  14039. ></TR
  14040. ><TR
  14041. ><TD
  14042. ALIGN="LEFT"
  14043. VALIGN="MIDDLE"
  14044. >cgi.rfc2616_headers</TD
  14045. ><TD
  14046. ALIGN="LEFT"
  14047. VALIGN="MIDDLE"
  14048. >"0"</TD
  14049. ><TD
  14050. ALIGN="LEFT"
  14051. VALIGN="MIDDLE"
  14052. >PHP_INI_SYSTEM</TD
  14053. ></TR
  14054. ></TBODY
  14055. ></TABLE
  14056. ></DIV
  14057. >
  14058.     </P
  14059. ><P
  14060. >Zde je struΦnΘ vysv∞tlenφ
  14061. konfiguraΦnφch direktiv.</P
  14062. ><P
  14063. >      <P
  14064. ></P
  14065. ><DIV
  14066. CLASS="variablelist"
  14067. ><DL
  14068. ><DT
  14069. ><A
  14070. NAME="ini.include-path"
  14071. ></A
  14072. ><TT
  14073. CLASS="parameter"
  14074. ><I
  14075. >include_path</I
  14076. ></TT
  14077. >
  14078.         <A
  14079. HREF="#language.types.string"
  14080. ><B
  14081. CLASS="type"
  14082. >string</B
  14083. ></A
  14084. ></DT
  14085. ><DD
  14086. ><P
  14087. >          Specifies a list of directories where the
  14088.          <A
  14089. HREF="#function.require"
  14090. ><B
  14091. CLASS="function"
  14092. >require()</B
  14093. ></A
  14094. >, <A
  14095. HREF="#function.include"
  14096. ><B
  14097. CLASS="function"
  14098. >include()</B
  14099. ></A
  14100. >
  14101.          and <B
  14102. CLASS="function"
  14103. >fopen_with_path()</B
  14104. > functions look for
  14105.          files.  The format is like the system's <TT
  14106. CLASS="envar"
  14107. >PATH</TT
  14108. >
  14109.          environment variable: a list of directories separated with a
  14110.          colon in Unix or semicolon in Windows.
  14111.         </P
  14112. ><P
  14113. >          <TABLE
  14114. WIDTH="100%"
  14115. BORDER="0"
  14116. CELLPADDING="0"
  14117. CELLSPACING="0"
  14118. CLASS="EXAMPLE"
  14119. ><TR
  14120. ><TD
  14121. ><DIV
  14122. CLASS="example"
  14123. ><A
  14124. NAME="AEN3003"
  14125. ></A
  14126. ><P
  14127. ><B
  14128. >P°φklad 4-3. Unix include_path</B
  14129. ></P
  14130. ><TABLE
  14131. BORDER="0"
  14132. BGCOLOR="#E0E0E0"
  14133. CELLPADDING="5"
  14134. ><TR
  14135. ><TD
  14136. ><PRE
  14137. CLASS="php.ini"
  14138. >include_path=".:/php/includes"</PRE
  14139. ></TD
  14140. ></TR
  14141. ></TABLE
  14142. ></DIV
  14143. ></TD
  14144. ></TR
  14145. ></TABLE
  14146. >
  14147.         </P
  14148. ><P
  14149. >          <TABLE
  14150. WIDTH="100%"
  14151. BORDER="0"
  14152. CELLPADDING="0"
  14153. CELLSPACING="0"
  14154. CLASS="EXAMPLE"
  14155. ><TR
  14156. ><TD
  14157. ><DIV
  14158. CLASS="example"
  14159. ><A
  14160. NAME="AEN3007"
  14161. ></A
  14162. ><P
  14163. ><B
  14164. >P°φklad 4-4. Windows include_path</B
  14165. ></P
  14166. ><TABLE
  14167. BORDER="0"
  14168. BGCOLOR="#E0E0E0"
  14169. CELLPADDING="5"
  14170. ><TR
  14171. ><TD
  14172. ><PRE
  14173. CLASS="php.ini"
  14174. >include_path=".;c:\php\includes"</PRE
  14175. ></TD
  14176. ></TR
  14177. ></TABLE
  14178. ></DIV
  14179. ></TD
  14180. ></TR
  14181. ></TABLE
  14182. >
  14183.         </P
  14184. ><P
  14185. >          Using a <TT
  14186. CLASS="literal"
  14187. >.</TT
  14188. > in the include path allows for
  14189.          relative includes as it means the current directory.
  14190.         </P
  14191. ></DD
  14192. ><DT
  14193. ><A
  14194. NAME="ini.doc-root"
  14195. ></A
  14196. ><TT
  14197. CLASS="parameter"
  14198. ><I
  14199. >doc_root</I
  14200. ></TT
  14201. >
  14202.         <A
  14203. HREF="#language.types.string"
  14204. ><B
  14205. CLASS="type"
  14206. >string</B
  14207. ></A
  14208. ></DT
  14209. ><DD
  14210. ><P
  14211. >          PHP's "root directory" on the server. Only used if
  14212.          non-empty. If PHP is configured with <A
  14213. HREF="#ini.safe-mode"
  14214. >bezpeΦn² re╛im</A
  14215. >, no files outside
  14216.          this directory are served.
  14217.          If PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
  14218.          if you are running PHP as a CGI under any web server (other than IIS)
  14219.          The alternative is to use the <A
  14220. HREF="#ini.cgi.force-redirect"
  14221. >          cgi.force_redirect</A
  14222. > configuration below.
  14223.         </P
  14224. ></DD
  14225. ><DT
  14226. ><A
  14227. NAME="ini.user-dir"
  14228. ></A
  14229. ><TT
  14230. CLASS="parameter"
  14231. ><I
  14232. >user_dir</I
  14233. ></TT
  14234. >
  14235.         <A
  14236. HREF="#language.types.string"
  14237. ><B
  14238. CLASS="type"
  14239. >string</B
  14240. ></A
  14241. ></DT
  14242. ><DD
  14243. ><P
  14244. >          The base name of the directory used on a user's home
  14245.          directory for <TT
  14246. CLASS="literal"
  14247. >PHP</TT
  14248. > files, for example
  14249.          <TT
  14250. CLASS="literal"
  14251. >public_html</TT
  14252. >.
  14253.         </P
  14254. ></DD
  14255. ><DT
  14256. ><A
  14257. NAME="ini.extension-dir"
  14258. ></A
  14259. ><TT
  14260. CLASS="parameter"
  14261. ><I
  14262. >extension_dir</I
  14263. ></TT
  14264. >
  14265.         <A
  14266. HREF="#language.types.string"
  14267. ><B
  14268. CLASS="type"
  14269. >string</B
  14270. ></A
  14271. ></DT
  14272. ><DD
  14273. ><P
  14274. >          In what directory PHP should look for dynamically loadable
  14275.          extensions. See also: <A
  14276. HREF="#ini.enable-dl"
  14277. >enable_dl</A
  14278. >,
  14279.          and <A
  14280. HREF="#function.dl"
  14281. ><B
  14282. CLASS="function"
  14283. >dl()</B
  14284. ></A
  14285. >.
  14286.         </P
  14287. ></DD
  14288. ><DT
  14289. ><A
  14290. NAME="ini.extension"
  14291. ></A
  14292. ><TT
  14293. CLASS="parameter"
  14294. ><I
  14295. >extension</I
  14296. ></TT
  14297. >
  14298.         <A
  14299. HREF="#language.types.string"
  14300. ><B
  14301. CLASS="type"
  14302. >string</B
  14303. ></A
  14304. ></DT
  14305. ><DD
  14306. ><P
  14307. >          Which dynamically loadable extensions to load when PHP starts
  14308.          up.
  14309.         </P
  14310. ></DD
  14311. ><DT
  14312. ><A
  14313. NAME="ini.cgi.fix_pathinfo"
  14314. ></A
  14315. ><TT
  14316. CLASS="parameter"
  14317. ><I
  14318. >cgi.fix_pathinfo</I
  14319. ></TT
  14320. >
  14321.         <A
  14322. HREF="#language.types.boolean"
  14323. ><B
  14324. CLASS="type"
  14325. >boolean</B
  14326. ></A
  14327. ></DT
  14328. ><DD
  14329. ><P
  14330. >          Provides <SPAN
  14331. CLASS="emphasis"
  14332. ><I
  14333. CLASS="emphasis"
  14334. >real</I
  14335. ></SPAN
  14336. > PATH_INFO/PATH_TRANSLATED
  14337.          support for CGI.  PHP's previous behaviour was to set
  14338.          PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok what PATH_INFO
  14339.          is.  For more information on PATH_INFO, see the cgi specs.  Setting
  14340.          this to 1 will cause PHP CGI to fix it's paths to conform to the
  14341.          spec.  A setting of zero causes PHP to behave as before.  Default
  14342.          is zero.  You should fix your scripts to use SCRIPT_FILENAME rather
  14343.          than PATH_TRANSLATED.
  14344.         </P
  14345. ></DD
  14346. ><DT
  14347. ><A
  14348. NAME="ini.cgi.force-redirect"
  14349. ></A
  14350. ><TT
  14351. CLASS="parameter"
  14352. ><I
  14353. >cgi.force_redirect</I
  14354. ></TT
  14355. >
  14356.         <A
  14357. HREF="#language.types.boolean"
  14358. ><B
  14359. CLASS="type"
  14360. >boolean</B
  14361. ></A
  14362. ></DT
  14363. ><DD
  14364. ><P
  14365. >          cgi.force_redirect is necessary to provide security running PHP as a
  14366.          CGI under most web servers. Left undefined, PHP turns this on by
  14367.          default. You can turn it off <SPAN
  14368. CLASS="emphasis"
  14369. ><I
  14370. CLASS="emphasis"
  14371. >AT YOUR OWN RISK</I
  14372. ></SPAN
  14373. >.
  14374.         </P
  14375. ><DIV
  14376. CLASS="note"
  14377. ><BLOCKQUOTE
  14378. CLASS="note"
  14379. ><P
  14380. ><B
  14381. >Poznßmka: </B
  14382. >
  14383.           Windows Users: You CAN safely turn this off for IIS, in fact, you MUST.
  14384.           To get OmniHTTPD or Xitami to work you MUST turn it off.
  14385.          </P
  14386. ></BLOCKQUOTE
  14387. ></DIV
  14388. ></DD
  14389. ><DT
  14390. ><A
  14391. NAME="ini.cgi.redirect-status-env"
  14392. ></A
  14393. ><TT
  14394. CLASS="parameter"
  14395. ><I
  14396. >cgi.redirect_status_env</I
  14397. ></TT
  14398. >
  14399.         <A
  14400. HREF="#language.types.string"
  14401. ><B
  14402. CLASS="type"
  14403. >string</B
  14404. ></A
  14405. ></DT
  14406. ><DD
  14407. ><P
  14408. >          If cgi.force_redirect is turned on, and you are not running under
  14409.          Apache or Netscape (iPlanet) web servers, you MAY need to set an
  14410.          environment variable name that PHP will look for to know it is OK
  14411.          to continue execution.
  14412.         </P
  14413. ><DIV
  14414. CLASS="note"
  14415. ><BLOCKQUOTE
  14416. CLASS="note"
  14417. ><P
  14418. ><B
  14419. >Poznßmka: </B
  14420. >
  14421.           Setting this variable MAY cause security issues,
  14422.           KNOW WHAT YOU ARE DOING FIRST.
  14423.          </P
  14424. ></BLOCKQUOTE
  14425. ></DIV
  14426. ></DD
  14427. ><DT
  14428. ><A
  14429. NAME="ini.fastcgi.impersonate"
  14430. ></A
  14431. ><TT
  14432. CLASS="parameter"
  14433. ><I
  14434. >fastcgi.impersonate</I
  14435. ></TT
  14436. >
  14437.         <A
  14438. HREF="#language.types.string"
  14439. ><B
  14440. CLASS="type"
  14441. >string</B
  14442. ></A
  14443. ></DT
  14444. ><DD
  14445. ><P
  14446. >          FastCGI under IIS (on WINNT based OS) supports the ability to impersonate
  14447.          security tokens of the calling client. This allows IIS to define the
  14448.          security context that the request runs under. mod_fastcgi under Apache
  14449.          does not currently support this feature (03/17/2002)
  14450.          Set to 1 if running under IIS. Default is zero.
  14451.         </P
  14452. ></DD
  14453. ><DT
  14454. ><A
  14455. NAME="ini.cgi.rfc2616-headers"
  14456. ></A
  14457. ><TT
  14458. CLASS="parameter"
  14459. ><I
  14460. >cgi.rfc2616_headers</I
  14461. ></TT
  14462. >
  14463.         <A
  14464. HREF="#language.types.integer"
  14465. ><B
  14466. CLASS="type"
  14467. >int</B
  14468. ></A
  14469. ></DT
  14470. ><DD
  14471. ><P
  14472. >          Tells PHP what type of headers to use when sending HTTP response
  14473.          code. If it's set 0, PHP sends a Status: header that is supported
  14474.          by Apache and other web servers. When this option is set to 1, PHP
  14475.          will send <A
  14476. HREF="http://www.faqs.org/rfcs/rfc2616"
  14477. TARGET="_top"
  14478. >RFC 2616</A
  14479. > compliant
  14480.          headers.  Leave it set to 0 unless you know what you're doing.
  14481.         </P
  14482. ></DD
  14483. ></DL
  14484. ></DIV
  14485. >
  14486.     </P
  14487. ></DIV
  14488. ><DIV
  14489. CLASS="sect2"
  14490. ><HR><H3
  14491. CLASS="sect2"
  14492. ><A
  14493. NAME="ini.sect.file_uploads"
  14494. ></A
  14495. >File Uploads</H3
  14496. ><P
  14497. >      <DIV
  14498. CLASS="table"
  14499. ><A
  14500. NAME="AEN3082"
  14501. ></A
  14502. ><P
  14503. ><B
  14504. >Tabulka 4-7. File Uploads Configuration Options</B
  14505. ></P
  14506. ><TABLE
  14507. BORDER="1"
  14508. CLASS="CALSTABLE"
  14509. ><THEAD
  14510. ><TR
  14511. ><TH
  14512. ALIGN="LEFT"
  14513. VALIGN="MIDDLE"
  14514. >Name</TH
  14515. ><TH
  14516. ALIGN="LEFT"
  14517. VALIGN="MIDDLE"
  14518. >Default</TH
  14519. ><TH
  14520. ALIGN="LEFT"
  14521. VALIGN="MIDDLE"
  14522. >Changeable</TH
  14523. ></TR
  14524. ></THEAD
  14525. ><TBODY
  14526. ><TR
  14527. ><TD
  14528. ALIGN="LEFT"
  14529. VALIGN="MIDDLE"
  14530. >file_uploads</TD
  14531. ><TD
  14532. ALIGN="LEFT"
  14533. VALIGN="MIDDLE"
  14534. >"1"</TD
  14535. ><TD
  14536. ALIGN="LEFT"
  14537. VALIGN="MIDDLE"
  14538. >PHP_INI_SYSTEM</TD
  14539. ></TR
  14540. ><TR
  14541. ><TD
  14542. ALIGN="LEFT"
  14543. VALIGN="MIDDLE"
  14544. >upload_tmp_dir</TD
  14545. ><TD
  14546. ALIGN="LEFT"
  14547. VALIGN="MIDDLE"
  14548. >NULL</TD
  14549. ><TD
  14550. ALIGN="LEFT"
  14551. VALIGN="MIDDLE"
  14552. >PHP_INI_SYSTEM</TD
  14553. ></TR
  14554. ><TR
  14555. ><TD
  14556. ALIGN="LEFT"
  14557. VALIGN="MIDDLE"
  14558. >upload_max_filesize</TD
  14559. ><TD
  14560. ALIGN="LEFT"
  14561. VALIGN="MIDDLE"
  14562. >"2M"</TD
  14563. ><TD
  14564. ALIGN="LEFT"
  14565. VALIGN="MIDDLE"
  14566. >PHP_INI_SYSTEM|PHP_INI_PERDIR</TD
  14567. ></TR
  14568. ></TBODY
  14569. ></TABLE
  14570. ></DIV
  14571. >
  14572.     </P
  14573. ><P
  14574. >Zde je struΦnΘ vysv∞tlenφ
  14575. konfiguraΦnφch direktiv.</P
  14576. ><P
  14577. >      <P
  14578. ></P
  14579. ><DIV
  14580. CLASS="variablelist"
  14581. ><DL
  14582. ><DT
  14583. ><A
  14584. NAME="ini.file-uploads"
  14585. ></A
  14586. ><TT
  14587. CLASS="parameter"
  14588. ><I
  14589. >file_uploads</I
  14590. ></TT
  14591. >
  14592.         <A
  14593. HREF="#language.types.boolean"
  14594. ><B
  14595. CLASS="type"
  14596. >boolean</B
  14597. ></A
  14598. ></DT
  14599. ><DD
  14600. ><P
  14601. >          Whether or not to allow HTTP
  14602.          <A
  14603. HREF="#features.file-upload"
  14604. >file uploads</A
  14605. >. See also 
  14606.          the 
  14607.          <A
  14608. HREF="#ini.upload-max-filesize"
  14609. >upload_max_filesize</A
  14610. >,
  14611.          <A
  14612. HREF="#ini.upload-tmp-dir"
  14613. >upload_tmp_dir</A
  14614. >, and 
  14615.          <A
  14616. HREF="#ini.post-max-size"
  14617. >post_max_size</A
  14618. > directives.
  14619.         </P
  14620. ></DD
  14621. ><DT
  14622. ><A
  14623. NAME="ini.upload-tmp-dir"
  14624. ></A
  14625. ><TT
  14626. CLASS="parameter"
  14627. ><I
  14628. >upload_tmp_dir</I
  14629. ></TT
  14630. >
  14631.         <A
  14632. HREF="#language.types.string"
  14633. ><B
  14634. CLASS="type"
  14635. >string</B
  14636. ></A
  14637. ></DT
  14638. ><DD
  14639. ><P
  14640. >          The temporary directory used for storing files when doing
  14641.          file upload. Must be writable by whatever user <TT
  14642. CLASS="literal"
  14643. >PHP</TT
  14644. >
  14645.          is running as. If not specified PHP will use the system's default.
  14646.         </P
  14647. ></DD
  14648. ><DT
  14649. ><A
  14650. NAME="ini.upload-max-filesize"
  14651. ></A
  14652. ><TT
  14653. CLASS="parameter"
  14654. ><I
  14655. >upload_max_filesize</I
  14656. ></TT
  14657. >
  14658.         <A
  14659. HREF="#language.types.integer"
  14660. ><B
  14661. CLASS="type"
  14662. >integer</B
  14663. ></A
  14664. ></DT
  14665. ><DD
  14666. ><P
  14667. >          The maximum size of an uploaded file.
  14668.         </P
  14669. ></DD
  14670. ></DL
  14671. ></DIV
  14672. >
  14673.     </P
  14674. ></DIV
  14675. ><DIV
  14676. CLASS="sect2"
  14677. ><HR><H3
  14678. CLASS="sect2"
  14679. ><A
  14680. NAME="ini.sql-general"
  14681. ></A
  14682. >General SQL</H3
  14683. ><P
  14684. >      <DIV
  14685. CLASS="table"
  14686. ><A
  14687. NAME="AEN3132"
  14688. ></A
  14689. ><P
  14690. ><B
  14691. >Tabulka 4-8. General SQL Configuration Options</B
  14692. ></P
  14693. ><TABLE
  14694. BORDER="1"
  14695. CLASS="CALSTABLE"
  14696. ><THEAD
  14697. ><TR
  14698. ><TH
  14699. ALIGN="LEFT"
  14700. VALIGN="MIDDLE"
  14701. >Name</TH
  14702. ><TH
  14703. ALIGN="LEFT"
  14704. VALIGN="MIDDLE"
  14705. >Default</TH
  14706. ><TH
  14707. ALIGN="LEFT"
  14708. VALIGN="MIDDLE"
  14709. >Changeable</TH
  14710. ></TR
  14711. ></THEAD
  14712. ><TBODY
  14713. ><TR
  14714. ><TD
  14715. ALIGN="LEFT"
  14716. VALIGN="MIDDLE"
  14717. >sql.safe_mode</TD
  14718. ><TD
  14719. ALIGN="LEFT"
  14720. VALIGN="MIDDLE"
  14721. >"0"</TD
  14722. ><TD
  14723. ALIGN="LEFT"
  14724. VALIGN="MIDDLE"
  14725. >PHP_INI_SYSTEM</TD
  14726. ></TR
  14727. ></TBODY
  14728. ></TABLE
  14729. ></DIV
  14730. >
  14731.     </P
  14732. ><P
  14733. >Zde je struΦnΘ vysv∞tlenφ
  14734. konfiguraΦnφch direktiv.</P
  14735. ><P
  14736. >      <P
  14737. ></P
  14738. ><DIV
  14739. CLASS="variablelist"
  14740. ><DL
  14741. ><DT
  14742. ><A
  14743. NAME="ini.sql.safe-mode"
  14744. ></A
  14745. ><TT
  14746. CLASS="parameter"
  14747. ><I
  14748. >sql.safe_mode</I
  14749. ></TT
  14750. >
  14751.         <A
  14752. HREF="#language.types.boolean"
  14753. ><B
  14754. CLASS="type"
  14755. >boolean</B
  14756. ></A
  14757. ></DT
  14758. ><DD
  14759. ><P
  14760. >         </P
  14761. ></DD
  14762. ></DL
  14763. ></DIV
  14764. >
  14765.     </P
  14766. ></DIV
  14767. ><DIV
  14768. CLASS="sect2"
  14769. ><HR><H3
  14770. CLASS="sect2"
  14771. ><A
  14772. NAME="ini.sect.debugger"
  14773. ></A
  14774. >Debugger Configuration Directives</H3
  14775. ><DIV
  14776. CLASS="caution"
  14777. ><P
  14778. ></P
  14779. ><TABLE
  14780. CLASS="caution"
  14781. BORDER="1"
  14782. WIDTH="100%"
  14783. ><TR
  14784. ><TD
  14785. ALIGN="CENTER"
  14786. ><B
  14787. >V²straha</B
  14788. ></TD
  14789. ></TR
  14790. ><TR
  14791. ><TD
  14792. ALIGN="LEFT"
  14793. ><P
  14794. >       Only PHP 3 implements a default debugger, for more information see <A
  14795. HREF="#debugger"
  14796. >D</A
  14797. >.
  14798.      </P
  14799. ></TD
  14800. ></TR
  14801. ></TABLE
  14802. ></DIV
  14803. ><P
  14804. ></P
  14805. ><DIV
  14806. CLASS="variablelist"
  14807. ><DL
  14808. ><DT
  14809. ><A
  14810. NAME="ini.debugger.host"
  14811. ></A
  14812. ><TT
  14813. CLASS="parameter"
  14814. ><I
  14815. >debugger.host</I
  14816. ></TT
  14817. >
  14818.        <A
  14819. HREF="#language.types.string"
  14820. ><B
  14821. CLASS="type"
  14822. >string</B
  14823. ></A
  14824. ></DT
  14825. ><DD
  14826. ><P
  14827. >         DNS name or IP address of host used by the debugger.
  14828.        </P
  14829. ></DD
  14830. ><DT
  14831. ><A
  14832. NAME="ini.debugger.port"
  14833. ></A
  14834. ><TT
  14835. CLASS="parameter"
  14836. ><I
  14837. >debugger.port</I
  14838. ></TT
  14839. >
  14840.        <A
  14841. HREF="#language.types.string"
  14842. ><B
  14843. CLASS="type"
  14844. >string</B
  14845. ></A
  14846. ></DT
  14847. ><DD
  14848. ><P
  14849. >         Port number used by the debugger.
  14850.        </P
  14851. ></DD
  14852. ><DT
  14853. ><A
  14854. NAME="ini.debugger.enabled"
  14855. ></A
  14856. ><TT
  14857. CLASS="parameter"
  14858. ><I
  14859. >debugger.enabled</I
  14860. ></TT
  14861. >
  14862.        <A
  14863. HREF="#language.types.boolean"
  14864. ><B
  14865. CLASS="type"
  14866. >boolean</B
  14867. ></A
  14868. ></DT
  14869. ><DD
  14870. ><P
  14871. >         Whether the debugger is enabled.
  14872.        </P
  14873. ></DD
  14874. ></DL
  14875. ></DIV
  14876. ></DIV
  14877. ></DIV
  14878. ></DIV
  14879. ></DIV
  14880. ><DIV
  14881. CLASS="PART"
  14882. ><A
  14883. NAME="langref"
  14884. ></A
  14885. ><DIV
  14886. CLASS="TITLEPAGE"
  14887. ><H1
  14888. CLASS="title"
  14889. >II. Reference jazyka</H1
  14890. ><DIV
  14891. CLASS="TOC"
  14892. ><DL
  14893. ><DT
  14894. ><B
  14895. >Obsah</B
  14896. ></DT
  14897. ><DT
  14898. >5. <A
  14899. HREF="#language.basic-syntax"
  14900. >Zßkladnφ syntaxe</A
  14901. ></DT
  14902. ><DT
  14903. >6. <A
  14904. HREF="#language.types"
  14905. >Types</A
  14906. ></DT
  14907. ><DT
  14908. >7. <A
  14909. HREF="#language.variables"
  14910. >Prom∞nnΘ</A
  14911. ></DT
  14912. ><DT
  14913. >8. <A
  14914. HREF="#language.constants"
  14915. >Konstanty</A
  14916. ></DT
  14917. ><DT
  14918. >9. <A
  14919. HREF="#language.expressions"
  14920. >V²razy</A
  14921. ></DT
  14922. ><DT
  14923. >10. <A
  14924. HREF="#language.operators"
  14925. >Operßtory</A
  14926. ></DT
  14927. ><DT
  14928. >11. <A
  14929. HREF="#control-structures"
  14930. >╪φdicφ struktury</A
  14931. ></DT
  14932. ><DT
  14933. >12. <A
  14934. HREF="#functions"
  14935. >Funkce</A
  14936. ></DT
  14937. ><DT
  14938. >13. <A
  14939. HREF="#language.oop"
  14940. >Classes and Objects</A
  14941. ></DT
  14942. ><DT
  14943. >14. <A
  14944. HREF="#language.references"
  14945. >Vysv∞tlenφ referencφ (odkaz∙)</A
  14946. ></DT
  14947. ></DL
  14948. ></DIV
  14949. ></DIV
  14950. ><DIV
  14951. CLASS="chapter"
  14952. ><HR><H1
  14953. ><A
  14954. NAME="language.basic-syntax"
  14955. >Kapitola 5. Zßkladnφ syntaxe</A
  14956. ></H1
  14957. ><DIV
  14958. CLASS="sect1"
  14959. ><H2
  14960. CLASS="sect1"
  14961. ><A
  14962. NAME="language.basic-syntax.phpmode"
  14963. ></A
  14964. >Opu╣t∞nφ HTML</H2
  14965. ><P
  14966. >     Jsou Φty°i zp∙soby jak opustit HTML a vstoupit to "PHP m≤du":
  14967.     </P
  14968. ><P
  14969. >      <TABLE
  14970. WIDTH="100%"
  14971. BORDER="0"
  14972. CELLPADDING="0"
  14973. CELLSPACING="0"
  14974. CLASS="EXAMPLE"
  14975. ><TR
  14976. ><TD
  14977. ><DIV
  14978. CLASS="example"
  14979. ><A
  14980. NAME="AEN3186"
  14981. ></A
  14982. ><P
  14983. ><B
  14984. >P°φklad 5-1. Zp∙soby opu╣t∞nφ HTML</B
  14985. ></P
  14986. ><TABLE
  14987. BORDER="0"
  14988. BGCOLOR="#E0E0E0"
  14989. CELLPADDING="5"
  14990. ><TR
  14991. ><TD
  14992. ><PRE
  14993. CLASS="programlisting"
  14994. >1.  <? echo ("toto je nejjednodu╣╣φ SGML zpracovatelskß instrukce\n"); ?>
  14995.  
  14996. 2.  <?php echo("pokud chcete zpracovßvat XHTML nebo XML dokumenty, pou╛φvejte toto\n"); ?>
  14997.  
  14998. 3.  <script language="php">
  14999.         echo ("n∞kterΘ editory (nap°φklad FrontPage) nemajφ zpracovatelskΘ instrukce v lßsce");
  15000.     </script>
  15001.  
  15002. 4.  <% echo ("p°φpadn∞ m∙╛ete pou╛φvat ASP tagy"); %>
  15003.     <%= $variable; # toto je zkratka za "<%echo .." %></PRE
  15004. ></TD
  15005. ></TR
  15006. ></TABLE
  15007. ></DIV
  15008. ></TD
  15009. ></TR
  15010. ></TABLE
  15011. >
  15012.     </P
  15013. ><P
  15014. >     Prvnφ zp∙sob je dostupn² pouze, pokud jsou povoleny krßtkΘ tagy. To se dß
  15015.     ud∞lat
  15016.     
  15017.     povolenφm konfiguraΦnφ direktivy
  15018.     <A
  15019. HREF="#ini.short-open-tag"
  15020. >short_open_tag</A
  15021. > v konfiguraΦnφm
  15022.     souboru PHP, nebo kompilacφ PHP s <B
  15023. CLASS="command"
  15024. >configure</B
  15025. > volbou
  15026.     --enable-short-tags.
  15027.     </P
  15028. ><P
  15029. >     Obecn∞ preferovanou metodou je druh² zp∙sob, proto╛e umo╛≥uje snadnou
  15030.     implementaci dal╣φho generovßnφ XHTML z PHP.
  15031.     </P
  15032. ><P
  15033. >     ╚tvrt² zp∙sob je dostupn², pouze pokud byly povoleny ASP tagy pomocφ
  15034.     konfiguraΦnφ direktivy <A
  15035. HREF="#ini.asp-tags"
  15036. >asp_tags</A
  15037. >.
  15038.  
  15039.     <DIV
  15040. CLASS="note"
  15041. ><BLOCKQUOTE
  15042. CLASS="note"
  15043. ><P
  15044. ><B
  15045. >Poznßmka: </B
  15046. >Podpora ASP tag∙ byla p°idßna v 3.0.4.</P
  15047. ></BLOCKQUOTE
  15048. ></DIV
  15049. ></P
  15050. ><P
  15051. >     P°φpadnß bezprost°edn∞ nßsledujφcφ sekvence konce °ßdku je souΦßstφ
  15052.     uzavφrajφcφho tagu.
  15053.     </P
  15054. ></DIV
  15055. ><DIV
  15056. CLASS="sect1"
  15057. ><HR><H2
  15058. CLASS="sect1"
  15059. ><A
  15060. NAME="language.basic-syntax.instruction-separation"
  15061. ></A
  15062. >Odd∞lovßnφ instrukcφ</H2
  15063. ><P
  15064. >     Instrukce se odd∞lujφ stejn∞ jako v C nebo Perlu - ukonΦujte ka╛d² v²raz
  15065.     st°ednφkem.
  15066.     </P
  15067. ><P
  15068. >     Uzavφrajφcφ tag (?>) takΘ implikuje konec v²razu, tak╛e nßsledujφcφ
  15069.     ukßzky jsou ekvivalentnφ:
  15070.  
  15071.      <DIV
  15072. CLASS="informalexample"
  15073. ><A
  15074. NAME="AEN3202"
  15075. ></A
  15076. ><P
  15077. ></P
  15078. ><TABLE
  15079. BORDER="0"
  15080. BGCOLOR="#E0E0E0"
  15081. CELLPADDING="5"
  15082. ><TR
  15083. ><TD
  15084. ><PRE
  15085. CLASS="programlisting"
  15086. ><?php
  15087.     echo "Toto je test";
  15088. ?>
  15089.  
  15090. <?php echo "Toto je test" ?></PRE
  15091. ></TD
  15092. ></TR
  15093. ></TABLE
  15094. ><P
  15095. ></P
  15096. ></DIV
  15097. ></P
  15098. ></DIV
  15099. ><DIV
  15100. CLASS="sect1"
  15101. ><HR><H2
  15102. CLASS="sect1"
  15103. ><A
  15104. NAME="language.basic-syntax.comments"
  15105. ></A
  15106. >Komentß°e</H2
  15107. ><P
  15108. >     PHP podporuje komentß°ovΘ notace jazyk∙ 'C', 'C++' a UnixovΘho shellu.
  15109.     Nap°φklad:
  15110.  
  15111.     <DIV
  15112. CLASS="informalexample"
  15113. ><A
  15114. NAME="AEN3207"
  15115. ></A
  15116. ><P
  15117. ></P
  15118. ><TABLE
  15119. BORDER="0"
  15120. BGCOLOR="#E0E0E0"
  15121. CELLPADDING="5"
  15122. ><TR
  15123. ><TD
  15124. ><PRE
  15125. CLASS="programlisting"
  15126. ><?php
  15127.     echo "Toto je test"; // Toto je jedno°ßdkov² komentß° typu C++
  15128.     /* Toto je vφce°ßdkov² komentß°
  15129.        a je╣t∞ jeden komentß° */
  15130.     echo "Toto je dal╣φ test";
  15131.     echo "Poslednφ Test"; # Toto je komentß° shellovΘho typu
  15132. ?></PRE
  15133. ></TD
  15134. ></TR
  15135. ></TABLE
  15136. ><P
  15137. ></P
  15138. ></DIV
  15139. ></P
  15140. ><P
  15141. >     Jedno°ßdkovΘ typy komentß°∙ ve skuteΦnosti komentujφ do konce °ßdku nebo
  15142.     souΦasnΘho bloku PHP k≤du, podle toho, co se vyskytuje d°φv.
  15143.     </P
  15144. ><DIV
  15145. CLASS="informalexample"
  15146. ><A
  15147. NAME="AEN3210"
  15148. ></A
  15149. ><P
  15150. ></P
  15151. ><TABLE
  15152. BORDER="0"
  15153. BGCOLOR="#E0E0E0"
  15154. CELLPADDING="5"
  15155. ><TR
  15156. ><TD
  15157. ><PRE
  15158. CLASS="programlisting"
  15159. ><h1>Toto je  <?php # echo "mal²";?> p°φklad.</h1>
  15160. <p>HlaviΦka na p°edchozφm °ßdku bude 'Toto je p°φklad'.</PRE
  15161. ></TD
  15162. ></TR
  15163. ></TABLE
  15164. ><P
  15165. ></P
  15166. ></DIV
  15167. ><P
  15168. >     M∞li byste si dßt pozor na vno°ovßnφ komentß°∙ typu 'C++', ke kterΘmu m∙╛e
  15169.     dojφt p°i zakomentovßnφ velk²ch blok∙.
  15170.     </P
  15171. ><DIV
  15172. CLASS="informalexample"
  15173. ><A
  15174. NAME="AEN3213"
  15175. ></A
  15176. ><P
  15177. ></P
  15178. ><TABLE
  15179. BORDER="0"
  15180. BGCOLOR="#E0E0E0"
  15181. CELLPADDING="5"
  15182. ><TR
  15183. ><TD
  15184. ><PRE
  15185. CLASS="programlisting"
  15186. ><?php
  15187.  /*
  15188.     echo "Toto je test"; /* Tento komentß° zp∙sobφ problΘm */
  15189.  */
  15190. ?></PRE
  15191. ></TD
  15192. ></TR
  15193. ></TABLE
  15194. ><P
  15195. ></P
  15196. ></DIV
  15197. ></DIV
  15198. ></DIV
  15199. ><DIV
  15200. CLASS="chapter"
  15201. ><HR><H1
  15202. ><A
  15203. NAME="language.types"
  15204. >Kapitola 6. Types</A
  15205. ></H1
  15206. ><DIV
  15207. CLASS="sect1"
  15208. ><H2
  15209. CLASS="sect1"
  15210. ><A
  15211. NAME="language.types.intro"
  15212. ></A
  15213. >Introduction</H2
  15214. ><P
  15215. >    PHP supports eight primitive types.
  15216.   </P
  15217. ><P
  15218. >    Four scalar types:
  15219.  
  15220.    <P
  15221. ></P
  15222. ><UL
  15223. ><LI
  15224. ><P
  15225. >       <A
  15226. HREF="#language.types.boolean"
  15227. ><B
  15228. CLASS="type"
  15229. >boolean</B
  15230. ></A
  15231. >
  15232.      </P
  15233. ></LI
  15234. ><LI
  15235. ><P
  15236. >       <A
  15237. HREF="#language.types.integer"
  15238. ><B
  15239. CLASS="type"
  15240. >integer</B
  15241. ></A
  15242. >
  15243.      </P
  15244. ></LI
  15245. ><LI
  15246. ><P
  15247. >       <A
  15248. HREF="#language.types.float"
  15249. ><B
  15250. CLASS="type"
  15251. >float</B
  15252. ></A
  15253. > (floating-point number, aka '<A
  15254. HREF="#language.types.float"
  15255. ><B
  15256. CLASS="type"
  15257. >double</B
  15258. ></A
  15259. >')
  15260.      </P
  15261. ></LI
  15262. ><LI
  15263. ><P
  15264. >       <A
  15265. HREF="#language.types.string"
  15266. ><B
  15267. CLASS="type"
  15268. >string</B
  15269. ></A
  15270. >
  15271.      </P
  15272. ></LI
  15273. ></UL
  15274. >
  15275.  
  15276.    Two compound types:
  15277.  
  15278.    <P
  15279. ></P
  15280. ><UL
  15281. ><LI
  15282. ><P
  15283. >       <A
  15284. HREF="#language.types.array"
  15285. ><B
  15286. CLASS="type"
  15287. >array</B
  15288. ></A
  15289. >
  15290.      </P
  15291. ></LI
  15292. ><LI
  15293. ><P
  15294. >       <A
  15295. HREF="#language.types.object"
  15296. ><B
  15297. CLASS="type"
  15298. >object</B
  15299. ></A
  15300. >
  15301.      </P
  15302. ></LI
  15303. ></UL
  15304. >
  15305.  
  15306.    And finally two special types:
  15307.  
  15308.    <P
  15309. ></P
  15310. ><UL
  15311. ><LI
  15312. ><P
  15313. >       <A
  15314. HREF="#language.types.resource"
  15315. ><B
  15316. CLASS="type"
  15317. >resource</B
  15318. ></A
  15319. >
  15320.      </P
  15321. ></LI
  15322. ><LI
  15323. ><P
  15324. >       <A
  15325. HREF="#language.types.null"
  15326. ><B
  15327. CLASS="type"
  15328. >NULL</B
  15329. ></A
  15330. >
  15331.      </P
  15332. ></LI
  15333. ></UL
  15334. >
  15335.  
  15336.    This manual also introduces some 
  15337.    <A
  15338. HREF="#language.pseudo-types"
  15339. >pseudo-types</A
  15340.    for readability reasons:
  15341.  
  15342.    <P
  15343. ></P
  15344. ><UL
  15345. ><LI
  15346. ><P
  15347. >       <A
  15348. HREF="#language.types.mixed"
  15349. >mixed</A
  15350. >
  15351.      </P
  15352. ></LI
  15353. ><LI
  15354. ><P
  15355. >       <A
  15356. HREF="#language.types.number"
  15357. >number</A
  15358. >
  15359.      </P
  15360. ></LI
  15361. ><LI
  15362. ><P
  15363. >       <A
  15364. HREF="#language.types.mixed"
  15365. >callback</A
  15366. >
  15367.      </P
  15368. ></LI
  15369. ></UL
  15370. >
  15371.    You may also find some references to the type "double". Consider
  15372.    double the same as float, the two names exist only for historic
  15373.    reasons. 
  15374.   </P
  15375. ><P
  15376. >    The type of a variable is usually not set by the programmer;
  15377.    rather, it is decided at runtime by PHP depending on the context in
  15378.    which that variable is used.
  15379.   </P
  15380. ><DIV
  15381. CLASS="note"
  15382. ><BLOCKQUOTE
  15383. CLASS="note"
  15384. ><P
  15385. ><B
  15386. >Poznßmka: </B
  15387. >
  15388.     If you want to check out the type and value of a certain <A
  15389. HREF="#language.expressions"
  15390. >expression</A
  15391. >, use
  15392.     <A
  15393. HREF="#function.var-dump"
  15394. ><B
  15395. CLASS="function"
  15396. >var_dump()</B
  15397. ></A
  15398. >.
  15399.    </P
  15400. ><P
  15401. ><B
  15402. >Poznßmka: </B
  15403. >
  15404.     If you simply want a human-readable representation of the type for
  15405.     debugging, use <A
  15406. HREF="#function.gettype"
  15407. ><B
  15408. CLASS="function"
  15409. >gettype()</B
  15410. ></A
  15411. >. To check for a certain type,
  15412.     do <SPAN
  15413. CLASS="emphasis"
  15414. ><I
  15415. CLASS="emphasis"
  15416. >not</I
  15417. ></SPAN
  15418. > use <A
  15419. HREF="#function.gettype"
  15420. ><B
  15421. CLASS="function"
  15422. >gettype()</B
  15423. ></A
  15424. >, but use the
  15425.     <TT
  15426. CLASS="literal"
  15427. >is_<TT
  15428. CLASS="replaceable"
  15429. ><I
  15430. >type</I
  15431. ></TT
  15432. ></TT
  15433. > functions. Some
  15434.     examples:
  15435.     <DIV
  15436. CLASS="informalexample"
  15437. ><A
  15438. NAME="AEN3271"
  15439. ></A
  15440. ><P
  15441. ></P
  15442. ><TABLE
  15443. BORDER="0"
  15444. BGCOLOR="#E0E0E0"
  15445. CELLPADDING="5"
  15446. ><TR
  15447. ><TD
  15448. ><PRE
  15449. CLASS="php"
  15450. ><?php
  15451. $bool = TRUE;   // a boolean
  15452. $str  = "foo";  // a string
  15453. $int  = 12;     // an integer
  15454.  
  15455. echo gettype($bool); // prints out "boolean"
  15456. echo gettype($str);  // prints out "string"
  15457.  
  15458. // If this is an integer, increment it by four
  15459. if (is_int($int)) {
  15460.     $int += 4;
  15461. }
  15462.  
  15463. // If $bool is a string, print it out
  15464. // (does not print out anything)
  15465. if (is_string($bool)) {
  15466.     echo "String: $bool";
  15467. }
  15468. ?></PRE
  15469. ></TD
  15470. ></TR
  15471. ></TABLE
  15472. ><P
  15473. ></P
  15474. ></DIV
  15475. >
  15476.    </P
  15477. ></BLOCKQUOTE
  15478. ></DIV
  15479. ><P
  15480. >    If you would like to force a variable to be converted to a certain
  15481.    type, you may either <A
  15482. HREF="#language.types.typecasting"
  15483. >cast</A
  15484. > the variable or
  15485.    use the <A
  15486. HREF="#function.settype"
  15487. ><B
  15488. CLASS="function"
  15489. >settype()</B
  15490. ></A
  15491. > function on it.
  15492.   </P
  15493. ><P
  15494. >    Note that a variable may be evaluated with different values in certain
  15495.    situations, depending on what type it is at the time. For more
  15496.    information, see the section on <A
  15497. HREF="#language.types.type-juggling"
  15498. >Type Juggling</A
  15499. >.  Also, you 
  15500.    may be interested in viewing 
  15501.    <A
  15502. HREF="#types.comparisons"
  15503. >the type comparison tables</A
  15504. >,
  15505.    as they show examples of various type related comparisons.
  15506.   </P
  15507. ></DIV
  15508. ><DIV
  15509. CLASS="sect1"
  15510. ><HR><H2
  15511. CLASS="sect1"
  15512. ><A
  15513. NAME="language.types.boolean"
  15514. ></A
  15515. >Booleans</H2
  15516. ><P
  15517. >      This is the easiest type. A <A
  15518. HREF="#language.types.boolean"
  15519. ><B
  15520. CLASS="type"
  15521. >boolean</B
  15522. ></A
  15523. > expresses a 
  15524.      truth value. It can be either <TT
  15525. CLASS="constant"
  15526. ><B
  15527. >TRUE</B
  15528. ></TT
  15529. > or <TT
  15530. CLASS="constant"
  15531. ><B
  15532. >FALSE</B
  15533. ></TT
  15534. >. 
  15535.     </P
  15536. ><DIV
  15537. CLASS="note"
  15538. ><BLOCKQUOTE
  15539. CLASS="note"
  15540. ><P
  15541. ><B
  15542. >Poznßmka: </B
  15543. >
  15544.       The boolean type was introduced in PHP 4.
  15545.      </P
  15546. ></BLOCKQUOTE
  15547. ></DIV
  15548. ><DIV
  15549. CLASS="sect2"
  15550. ><HR><H3
  15551. CLASS="sect2"
  15552. ><A
  15553. NAME="language.types.boolean.syntax"
  15554. ></A
  15555. >Syntax</H3
  15556. ><P
  15557. >       To specify a boolean literal, use either the keyword <TT
  15558. CLASS="constant"
  15559. ><B
  15560. >TRUE</B
  15561. ></TT
  15562.       or <TT
  15563. CLASS="constant"
  15564. ><B
  15565. >FALSE</B
  15566. ></TT
  15567. >. Both are case-insensitive.
  15568.       <DIV
  15569. CLASS="informalexample"
  15570. ><A
  15571. NAME="AEN3292"
  15572. ></A
  15573. ><P
  15574. ></P
  15575. ><TABLE
  15576. BORDER="0"
  15577. BGCOLOR="#E0E0E0"
  15578. CELLPADDING="5"
  15579. ><TR
  15580. ><TD
  15581. ><PRE
  15582. CLASS="php"
  15583. ><?php
  15584. $foo = True; // assign the value TRUE to $foo
  15585. ?></PRE
  15586. ></TD
  15587. ></TR
  15588. ></TABLE
  15589. ><P
  15590. ></P
  15591. ></DIV
  15592. >
  15593.      </P
  15594. ><P
  15595. >       Usually you 
  15596.       use some kind of <A
  15597. HREF="#language.operators"
  15598. >operator</A
  15599. >
  15600.       which returns a <A
  15601. HREF="#language.types.boolean"
  15602. ><B
  15603. CLASS="type"
  15604. >boolean</B
  15605. ></A
  15606. > value, and then pass it 
  15607.       on to a <A
  15608. HREF="#control-structures"
  15609. >control
  15610.       structure</A
  15611. >.
  15612.       <DIV
  15613. CLASS="informalexample"
  15614. ><A
  15615. NAME="AEN3298"
  15616. ></A
  15617. ><P
  15618. ></P
  15619. ><TABLE
  15620. BORDER="0"
  15621. BGCOLOR="#E0E0E0"
  15622. CELLPADDING="5"
  15623. ><TR
  15624. ><TD
  15625. ><PRE
  15626. CLASS="php"
  15627. ><?php
  15628. // == is an operator which test
  15629. // equality and returns a boolean
  15630. if ($action == "show_version") {
  15631.     echo "The version is 1.23";
  15632. }
  15633.  
  15634. // this is not necessary...
  15635. if ($show_separators == TRUE) {
  15636.     echo "<hr>\n";
  15637. }
  15638.  
  15639. // ...because you can simply type
  15640. if ($show_separators) {
  15641.     echo "<hr>\n";
  15642. }
  15643. ?></PRE
  15644. ></TD
  15645. ></TR
  15646. ></TABLE
  15647. ><P
  15648. ></P
  15649. ></DIV
  15650. >
  15651.      </P
  15652. ></DIV
  15653. ><DIV
  15654. CLASS="sect2"
  15655. ><HR><H3
  15656. CLASS="sect2"
  15657. ><A
  15658. NAME="language.types.boolean.casting"
  15659. ></A
  15660. >Converting to boolean</H3
  15661. ><P
  15662. >        To explicitly convert a value to <A
  15663. HREF="#language.types.boolean"
  15664. ><B
  15665. CLASS="type"
  15666. >boolean</B
  15667. ></A
  15668. >, use either
  15669.        the <TT
  15670. CLASS="literal"
  15671. >(bool)</TT
  15672. > or the <TT
  15673. CLASS="literal"
  15674. >(boolean)</TT
  15675. > cast.
  15676.        However, in most cases you do not need to use the cast, since a value
  15677.        will be automatically converted if an operator, function or 
  15678.        control structure requires a <A
  15679. HREF="#language.types.boolean"
  15680. ><B
  15681. CLASS="type"
  15682. >boolean</B
  15683. ></A
  15684. > argument.
  15685.       </P
  15686. ><P
  15687. >        See also <A
  15688. HREF="#language.types.type-juggling"
  15689. >Type Juggling</A
  15690. >.
  15691.       </P
  15692. ><P
  15693. >        When converting to <A
  15694. HREF="#language.types.boolean"
  15695. ><B
  15696. CLASS="type"
  15697. >boolean</B
  15698. ></A
  15699. >, the following values 
  15700.        are considered <TT
  15701. CLASS="constant"
  15702. ><B
  15703. >FALSE</B
  15704. ></TT
  15705. >:
  15706.   
  15707.        <P
  15708. ></P
  15709. ><UL
  15710. ><LI
  15711. ><P
  15712. >the <A
  15713. HREF="#language.types.boolean"
  15714. >boolean</A
  15715.           <TT
  15716. CLASS="constant"
  15717. ><B
  15718. >FALSE</B
  15719. ></TT
  15720. > itself</P
  15721. ></LI
  15722. ><LI
  15723. ><P
  15724. >the <A
  15725. HREF="#language.types.integer"
  15726. >integer</A
  15727. > 0 (zero) </P
  15728. ></LI
  15729. ><LI
  15730. ><P
  15731. >the <A
  15732. HREF="#language.types.float"
  15733. >float</A
  15734.          0.0 (zero) </P
  15735. ></LI
  15736. ><LI
  15737. ><P
  15738. >the empty <A
  15739. HREF="#language.types.string"
  15740. >string</A
  15741. >, and the <A
  15742. HREF="#language.types.string"
  15743. >string</A
  15744. >
  15745.            "0"</P
  15746. ></LI
  15747. ><LI
  15748. ><P
  15749. >an <A
  15750. HREF="#language.types.array"
  15751. >array</A
  15752.          with zero elements</P
  15753. ></LI
  15754. ><LI
  15755. ><P
  15756. >an <A
  15757. HREF="#language.types.object"
  15758. >object</A
  15759.          with zero member variables</P
  15760. ></LI
  15761. ><LI
  15762. ><P
  15763. >the special type <A
  15764. HREF="#language.types.null"
  15765. >NULL</A
  15766. > (including unset variables)
  15767.          </P
  15768. ></LI
  15769. ></UL
  15770. >
  15771.        
  15772.        Every other value is considered <TT
  15773. CLASS="constant"
  15774. ><B
  15775. >TRUE</B
  15776. ></TT
  15777. > (including any 
  15778.        <A
  15779. HREF="#language.types.resource"
  15780. >resource</A
  15781. >).
  15782.        <DIV
  15783. CLASS="warning"
  15784. ><P
  15785. ></P
  15786. ><TABLE
  15787. CLASS="warning"
  15788. BORDER="1"
  15789. WIDTH="100%"
  15790. ><TR
  15791. ><TD
  15792. ALIGN="CENTER"
  15793. ><B
  15794. >Varovßnφ</B
  15795. ></TD
  15796. ></TR
  15797. ><TR
  15798. ><TD
  15799. ALIGN="LEFT"
  15800. ><P
  15801. >          <TT
  15802. CLASS="literal"
  15803. >-1</TT
  15804. > is considered  
  15805.          <TT
  15806. CLASS="constant"
  15807. ><B
  15808. >TRUE</B
  15809. ></TT
  15810. >, like any other non-zero (whether negative
  15811.          or positive) number!
  15812.         </P
  15813. ></TD
  15814. ></TR
  15815. ></TABLE
  15816. ></DIV
  15817. >
  15818.        <DIV
  15819. CLASS="informalexample"
  15820. ><A
  15821. NAME="AEN3342"
  15822. ></A
  15823. ><P
  15824. ></P
  15825. ><TABLE
  15826. BORDER="0"
  15827. BGCOLOR="#E0E0E0"
  15828. CELLPADDING="5"
  15829. ><TR
  15830. ><TD
  15831. ><PRE
  15832. CLASS="php"
  15833. ><?php
  15834. echo gettype((bool) "");        // bool(false)
  15835. echo gettype((bool) 1);         // bool(true)
  15836. echo gettype((bool) -2);        // bool(true)
  15837. echo gettype((bool) "foo");     // bool(true)
  15838. echo gettype((bool) 2.3e5);     // bool(true)
  15839. echo gettype((bool) array(12)); // bool(true)
  15840. echo gettype((bool) array());   // bool(false)
  15841. ?></PRE
  15842. ></TD
  15843. ></TR
  15844. ></TABLE
  15845. ><P
  15846. ></P
  15847. ></DIV
  15848. >
  15849.       </P
  15850. ></DIV
  15851. ></DIV
  15852. ><DIV
  15853. CLASS="sect1"
  15854. ><HR><H2
  15855. CLASS="sect1"
  15856. ><A
  15857. NAME="language.types.integer"
  15858. ></A
  15859. >Integers</H2
  15860. ><P
  15861. >      An <A
  15862. HREF="#language.types.integer"
  15863. ><B
  15864. CLASS="type"
  15865. >integer</B
  15866. ></A
  15867. > is a number of the set 
  15868.      Z = {..., -2, -1, 0, 1, 2, ...}.
  15869.     </P
  15870. ><P
  15871. >      See also:
  15872.      <A
  15873. HREF="#ref.gmp"
  15874. >Arbitrary length integer / GMP</A
  15875. >,
  15876.      <A
  15877. HREF="#language.types.float"
  15878. >Floating point numbers</A
  15879. >, and
  15880.      <A
  15881. HREF="#ref.bc"
  15882. >Arbitrary precision / BCMath</A
  15883. >
  15884.     </P
  15885. ><DIV
  15886. CLASS="sect2"
  15887. ><HR><H3
  15888. CLASS="sect2"
  15889. ><A
  15890. NAME="language.types.integer.syntax"
  15891. ></A
  15892. >Syntax</H3
  15893. ><P
  15894. >       Integers can be specified in decimal (10-based), hexadecimal (16-based)
  15895.       or octal (8-based) notation, optionally preceded by a sign (- or +).
  15896.      </P
  15897. ><P
  15898. >       If you use the octal notation, you must precede the number with a 
  15899.       <TT
  15900. CLASS="literal"
  15901. >0</TT
  15902. > (zero), to use hexadecimal notation precede
  15903.       the number with <TT
  15904. CLASS="literal"
  15905. >0x</TT
  15906. >.
  15907.       <TABLE
  15908. WIDTH="100%"
  15909. BORDER="0"
  15910. CELLPADDING="0"
  15911. CELLSPACING="0"
  15912. CLASS="EXAMPLE"
  15913. ><TR
  15914. ><TD
  15915. ><DIV
  15916. CLASS="example"
  15917. ><A
  15918. NAME="AEN3358"
  15919. ></A
  15920. ><P
  15921. ><B
  15922. >P°φklad 6-1. Integer literals</B
  15923. ></P
  15924. ><TABLE
  15925. BORDER="0"
  15926. BGCOLOR="#E0E0E0"
  15927. CELLPADDING="5"
  15928. ><TR
  15929. ><TD
  15930. ><PRE
  15931. CLASS="php"
  15932. ><?php
  15933. $a = 1234; # decimal number
  15934. $a = -123; # a negative number
  15935. $a = 0123; # octal number (equivalent to 83 decimal)
  15936. $a = 0x1A; # hexadecimal number (equivalent to 26 decimal)
  15937. ?></PRE
  15938. ></TD
  15939. ></TR
  15940. ></TABLE
  15941. ></DIV
  15942. ></TD
  15943. ></TR
  15944. ></TABLE
  15945. >
  15946.       Formally the possible structure for integer literals is:
  15947.       <DIV
  15948. CLASS="informalexample"
  15949. ><A
  15950. NAME="AEN3361"
  15951. ></A
  15952. ><P
  15953. ></P
  15954. ><TABLE
  15955. BORDER="0"
  15956. BGCOLOR="#E0E0E0"
  15957. CELLPADDING="5"
  15958. ><TR
  15959. ><TD
  15960. ><PRE
  15961. CLASS="programlisting"
  15962. >decimal     : [1-9][0-9]*
  15963.             | 0
  15964.  
  15965. hexadecimal : 0[xX][0-9a-fA-F]+
  15966.  
  15967. octal       : 0[0-7]+
  15968.  
  15969. integer     : [+-]?decimal
  15970.             | [+-]?hexadecimal
  15971.             | [+-]?octal</PRE
  15972. ></TD
  15973. ></TR
  15974. ></TABLE
  15975. ><P
  15976. ></P
  15977. ></DIV
  15978. >
  15979.       The size of an integer is platform-dependent, although a 
  15980.       maximum value of about two billion is the usual value 
  15981.       (that's 32 bits signed). PHP does not support unsigned
  15982.       integers.
  15983.      </P
  15984. ></DIV
  15985. ><DIV
  15986. CLASS="sect2"
  15987. ><HR><H3
  15988. CLASS="sect2"
  15989. ><A
  15990. NAME="language.types.integer.overflow"
  15991. ></A
  15992. >Integer overflow</H3
  15993. ><P
  15994. >       If you specify a number beyond the bounds of the <A
  15995. HREF="#language.types.integer"
  15996. ><B
  15997. CLASS="type"
  15998. >integer</B
  15999. ></A
  16000. >
  16001.       type, it will be interpreted as a <A
  16002. HREF="#language.types.float"
  16003. ><B
  16004. CLASS="type"
  16005. >float</B
  16006. ></A
  16007. > instead. Also, if
  16008.       you perform an operation that results in a number beyond the bounds of
  16009.       the <A
  16010. HREF="#language.types.integer"
  16011. ><B
  16012. CLASS="type"
  16013. >integer</B
  16014. ></A
  16015. > type, a <A
  16016. HREF="#language.types.float"
  16017. ><B
  16018. CLASS="type"
  16019. >float</B
  16020. ></A
  16021. > will be returned
  16022.       instead.
  16023.  
  16024.       <DIV
  16025. CLASS="informalexample"
  16026. ><A
  16027. NAME="AEN3370"
  16028. ></A
  16029. ><P
  16030. ></P
  16031. ><TABLE
  16032. BORDER="0"
  16033. BGCOLOR="#E0E0E0"
  16034. CELLPADDING="5"
  16035. ><TR
  16036. ><TD
  16037. ><PRE
  16038. CLASS="php"
  16039. ><?php
  16040. $large_number =  2147483647;
  16041. var_dump($large_number);
  16042. // output: int(2147483647)
  16043.  
  16044. $large_number =  2147483648;
  16045. var_dump($large_number);
  16046. // output: float(2147483648)
  16047.  
  16048. // this goes also for hexadecimal specified integers:
  16049. var_dump( 0x80000000 );
  16050. // output: float(2147483648)
  16051.  
  16052. $million = 1000000;
  16053. $large_number =  50000 * $million;
  16054. var_dump($large_number);
  16055. // output: float(50000000000)
  16056. ?></PRE
  16057. ></TD
  16058. ></TR
  16059. ></TABLE
  16060. ><P
  16061. ></P
  16062. ></DIV
  16063. >
  16064.       <DIV
  16065. CLASS="warning"
  16066. ><P
  16067. ></P
  16068. ><TABLE
  16069. CLASS="warning"
  16070. BORDER="1"
  16071. WIDTH="100%"
  16072. ><TR
  16073. ><TD
  16074. ALIGN="CENTER"
  16075. ><B
  16076. >Varovßnφ</B
  16077. ></TD
  16078. ></TR
  16079. ><TR
  16080. ><TD
  16081. ALIGN="LEFT"
  16082. ><P
  16083. >         Unfortunately, there was a bug in PHP so that this
  16084.         does not always work correctly when there are negative numbers
  16085.         involved. For example: when you do <TT
  16086. CLASS="literal"
  16087. >-50000 *
  16088.         $million</TT
  16089. >, the result will be
  16090.         <TT
  16091. CLASS="literal"
  16092. >-429496728</TT
  16093. >. However, when both operands are
  16094.         positive there is no problem.
  16095.        </P
  16096. ><P
  16097. >         This is solved in PHP 4.1.0.
  16098.        </P
  16099. ></TD
  16100. ></TR
  16101. ></TABLE
  16102. ></DIV
  16103. >
  16104.      </P
  16105. ><P
  16106. >       There is no integer division operator in PHP.
  16107.       <TT
  16108. CLASS="literal"
  16109. >1/2</TT
  16110. > yields the <A
  16111. HREF="#language.types.float"
  16112. ><B
  16113. CLASS="type"
  16114. >float</B
  16115. ></A
  16116. >
  16117.       <TT
  16118. CLASS="literal"
  16119. >0.5</TT
  16120. >. You can cast the value to
  16121.       an integer to always round it downwards, or you can
  16122.       use the <A
  16123. HREF="#function.round"
  16124. ><B
  16125. CLASS="function"
  16126. >round()</B
  16127. ></A
  16128. > function.
  16129.       <DIV
  16130. CLASS="informalexample"
  16131. ><A
  16132. NAME="AEN3382"
  16133. ></A
  16134. ><P
  16135. ></P
  16136. ><TABLE
  16137. BORDER="0"
  16138. BGCOLOR="#E0E0E0"
  16139. CELLPADDING="5"
  16140. ><TR
  16141. ><TD
  16142. ><PRE
  16143. CLASS="php"
  16144. ><?php
  16145. var_dump(25/7);         // float(3.5714285714286) 
  16146. var_dump((int) (25/7)); // int(3)
  16147. var_dump(round(25/7));  // float(4) 
  16148. ?></PRE
  16149. ></TD
  16150. ></TR
  16151. ></TABLE
  16152. ><P
  16153. ></P
  16154. ></DIV
  16155. >
  16156.      </P
  16157. ></DIV
  16158. ><DIV
  16159. CLASS="sect2"
  16160. ><HR><H3
  16161. CLASS="sect2"
  16162. ><A
  16163. NAME="language.types.integer.casting"
  16164. ></A
  16165. >Converting to integer</H3
  16166. ><P
  16167. >        To explicitly convert a value to <A
  16168. HREF="#language.types.integer"
  16169. ><B
  16170. CLASS="type"
  16171. >integer</B
  16172. ></A
  16173. >, use either
  16174.        the <TT
  16175. CLASS="literal"
  16176. >(int)</TT
  16177. > or the <TT
  16178. CLASS="literal"
  16179. >(integer)</TT
  16180. > cast.
  16181.        However, in most cases you do not need to use the cast, since a value
  16182.        will be automatically converted if an operator, function or 
  16183.        control structure requires an <A
  16184. HREF="#language.types.integer"
  16185. ><B
  16186. CLASS="type"
  16187. >integer</B
  16188. ></A
  16189. > argument.
  16190.        You can also convert a value to integer with the function
  16191.        <A
  16192. HREF="#function.intval"
  16193. ><B
  16194. CLASS="function"
  16195. >intval()</B
  16196. ></A
  16197. >.
  16198.       </P
  16199. ><P
  16200. >        See also <A
  16201. HREF="#language.types.type-juggling"
  16202. >type-juggling</A
  16203. >.
  16204.       </P
  16205. ><DIV
  16206. CLASS="sect3"
  16207. ><HR><H4
  16208. CLASS="sect3"
  16209. ><A
  16210. NAME="language.types.integer.casting.from-boolean"
  16211. ></A
  16212. >From <A
  16213. HREF="#language.types.boolean"
  16214. >booleans</A
  16215. ></H4
  16216. ><P
  16217. >         <TT
  16218. CLASS="constant"
  16219. ><B
  16220. >FALSE</B
  16221. ></TT
  16222. > will yield 
  16223.         <TT
  16224. CLASS="literal"
  16225. >0</TT
  16226. > (zero), and <TT
  16227. CLASS="constant"
  16228. ><B
  16229. >TRUE</B
  16230. ></TT
  16231.         will yield <TT
  16232. CLASS="literal"
  16233. >1</TT
  16234. > (one).
  16235.        </P
  16236. ></DIV
  16237. ><DIV
  16238. CLASS="sect3"
  16239. ><HR><H4
  16240. CLASS="sect3"
  16241. ><A
  16242. NAME="language.types.integer.casting.from-float"
  16243. ></A
  16244. >From <A
  16245. HREF="#language.types.float"
  16246. >floating point numbers</A
  16247. ></H4
  16248. ><P
  16249. >         When converting from float to integer, the number will
  16250.         be rounded <SPAN
  16251. CLASS="emphasis"
  16252. ><I
  16253. CLASS="emphasis"
  16254. >towards zero</I
  16255. ></SPAN
  16256. >.
  16257.        </P
  16258. ><P
  16259. >         If the float is beyond the boundaries of integer
  16260.         (usually <TT
  16261. CLASS="literal"
  16262. >+/- 2.15e+9 = 2^31</TT
  16263. >), 
  16264.         the result is undefined, since the float hasn't
  16265.         got enough precision to give an exact integer result.
  16266.         No warning, not even a notice will be issued in this 
  16267.         case!
  16268.        </P
  16269. ><DIV
  16270. CLASS="warning"
  16271. ><P
  16272. ></P
  16273. ><TABLE
  16274. CLASS="warning"
  16275. BORDER="1"
  16276. WIDTH="100%"
  16277. ><TR
  16278. ><TD
  16279. ALIGN="CENTER"
  16280. ><B
  16281. >Varovßnφ</B
  16282. ></TD
  16283. ></TR
  16284. ><TR
  16285. ><TD
  16286. ALIGN="LEFT"
  16287. ><P
  16288. >         Never cast an unknown fraction to <A
  16289. HREF="#language.types.integer"
  16290. ><B
  16291. CLASS="type"
  16292. >integer</B
  16293. ></A
  16294. >, as this can
  16295.         sometimes lead to unexpected results.
  16296.         <DIV
  16297. CLASS="informalexample"
  16298. ><A
  16299. NAME="AEN3412"
  16300. ></A
  16301. ><P
  16302. ></P
  16303. ><TABLE
  16304. BORDER="0"
  16305. BGCOLOR="#E0E0E0"
  16306. CELLPADDING="5"
  16307. ><TR
  16308. ><TD
  16309. ><PRE
  16310. CLASS="php"
  16311. ><?php
  16312. echo (int) ( (0.1+0.7) * 10 ); // echoes 7!
  16313. ?></PRE
  16314. ></TD
  16315. ></TR
  16316. ></TABLE
  16317. ><P
  16318. ></P
  16319. ></DIV
  16320. >
  16321.         
  16322.         See for more information the <A
  16323. HREF="#warn.float-precision"
  16324. >warning 
  16325.         about float-precision</A
  16326. >.
  16327.        </P
  16328. ></TD
  16329. ></TR
  16330. ></TABLE
  16331. ></DIV
  16332. ></DIV
  16333. ><DIV
  16334. CLASS="sect3"
  16335. ><HR><H4
  16336. CLASS="sect3"
  16337. ><A
  16338. NAME="language.types.integer.casting.from-string"
  16339. ></A
  16340. >From strings</H4
  16341. ><P
  16342. >         See <A
  16343. HREF="#language.types.string.conversion"
  16344. >String 
  16345.         conversion to numbers</A
  16346. >
  16347.        </P
  16348. ></DIV
  16349. ><DIV
  16350. CLASS="sect3"
  16351. ><HR><H4
  16352. CLASS="sect3"
  16353. ><A
  16354. NAME="language.types.integer.casting.from-other"
  16355. ></A
  16356. >From other types</H4
  16357. ><P
  16358. >         <DIV
  16359. CLASS="caution"
  16360. ><P
  16361. ></P
  16362. ><TABLE
  16363. CLASS="caution"
  16364. BORDER="1"
  16365. WIDTH="100%"
  16366. ><TR
  16367. ><TD
  16368. ALIGN="CENTER"
  16369. ><B
  16370. >V²straha</B
  16371. ></TD
  16372. ></TR
  16373. ><TR
  16374. ><TD
  16375. ALIGN="LEFT"
  16376. ><P
  16377. >           Behaviour of converting to integer is undefined for other
  16378.           types. Currently, the behaviour is the same as if the value
  16379.           was first <A
  16380. HREF="#language.types.boolean.casting"
  16381. >converted to boolean</A
  16382. >. However, do
  16383.           <SPAN
  16384. CLASS="emphasis"
  16385. ><I
  16386. CLASS="emphasis"
  16387. >not</I
  16388. ></SPAN
  16389. > rely on this behaviour, as it can
  16390.           change without notice.
  16391.          </P
  16392. ></TD
  16393. ></TR
  16394. ></TABLE
  16395. ></DIV
  16396. >
  16397.        </P
  16398. ></DIV
  16399. ></DIV
  16400. ></DIV
  16401. ><DIV
  16402. CLASS="sect1"
  16403. ><HR><H2
  16404. CLASS="sect1"
  16405. ><A
  16406. NAME="language.types.float"
  16407. ></A
  16408. >Floating point numbers</H2
  16409. ><P
  16410. >     Floating point numbers (AKA "floats", "doubles" or "real numbers") can be 
  16411.     specified using any of the following syntaxes: 
  16412.     <DIV
  16413. CLASS="informalexample"
  16414. ><A
  16415. NAME="AEN3429"
  16416. ></A
  16417. ><P
  16418. ></P
  16419. ><TABLE
  16420. BORDER="0"
  16421. BGCOLOR="#E0E0E0"
  16422. CELLPADDING="5"
  16423. ><TR
  16424. ><TD
  16425. ><PRE
  16426. CLASS="php"
  16427. ><?php
  16428. $a = 1.234; 
  16429. $b = 1.2e3; 
  16430. $c = 7E-10;
  16431. ?></PRE
  16432. ></TD
  16433. ></TR
  16434. ></TABLE
  16435. ><P
  16436. ></P
  16437. ></DIV
  16438. >
  16439.     Formally:
  16440.     <DIV
  16441. CLASS="informalexample"
  16442. ><A
  16443. NAME="AEN3431"
  16444. ></A
  16445. ><P
  16446. ></P
  16447. ><TABLE
  16448. BORDER="0"
  16449. BGCOLOR="#E0E0E0"
  16450. CELLPADDING="5"
  16451. ><TR
  16452. ><TD
  16453. ><PRE
  16454. CLASS="php"
  16455. >LNUM          [0-9]+
  16456. DNUM          ([0-9]*[\.]{LNUM}) | ({LNUM}[\.][0-9]*)
  16457. EXPONENT_DNUM ( ({LNUM} | {DNUM}) [eE][+-]? {LNUM})</PRE
  16458. ></TD
  16459. ></TR
  16460. ></TABLE
  16461. ><P
  16462. ></P
  16463. ></DIV
  16464. >
  16465.     The size of a float is platform-dependent, 
  16466.     although a maximum of ~1.8e308 with a precision of roughly 14 
  16467.     decimal digits is a common value (that's 64 bit IEEE format).
  16468.    </P
  16469. ><DIV
  16470. CLASS="warning"
  16471. ><P
  16472. ></P
  16473. ><TABLE
  16474. CLASS="warning"
  16475. BORDER="1"
  16476. WIDTH="100%"
  16477. ><TR
  16478. ><TD
  16479. ALIGN="CENTER"
  16480. ><B
  16481. ><A
  16482. NAME="warn.float-precision"
  16483. ></A
  16484. >Floating point precision</B
  16485. ></TD
  16486. ></TR
  16487. ><TR
  16488. ><TD
  16489. ALIGN="LEFT"
  16490. ><P
  16491. >      It is quite usual that simple decimal fractions like
  16492.      <TT
  16493. CLASS="literal"
  16494. >0.1</TT
  16495. > or <TT
  16496. CLASS="literal"
  16497. >0.7</TT
  16498. > cannot be
  16499.      converted into their internal binary counterparts without a
  16500.      little loss of precision. This can lead to confusing results: for
  16501.      example, <TT
  16502. CLASS="literal"
  16503. >floor((0.1+0.7)*10)</TT
  16504. > will usually
  16505.      return <TT
  16506. CLASS="literal"
  16507. >7</TT
  16508. > instead of the expected
  16509.      <TT
  16510. CLASS="literal"
  16511. >8</TT
  16512. > as the result of the internal representation
  16513.      really being something like <TT
  16514. CLASS="literal"
  16515. >7.9999999999...</TT
  16516. >.
  16517.     </P
  16518. ><P
  16519. >      This is related to the fact that it is impossible to exactly
  16520.      express some fractions in decimal notation with a finite number
  16521.      of digits. For instance, <TT
  16522. CLASS="literal"
  16523. >1/3</TT
  16524. > in decimal form
  16525.      becomes <TT
  16526. CLASS="literal"
  16527. >0.3333333. . .</TT
  16528. >.
  16529.     </P
  16530. ><P
  16531. >      So never trust floating number results to the last digit and
  16532.      never compare floating point numbers for equality. If you really
  16533.      need higher precision, you should use the <A
  16534. HREF="#ref.bc"
  16535. >arbitrary precision math functions</A
  16536. >
  16537.      or <A
  16538. HREF="#ref.gmp"
  16539. >gmp</A
  16540. > functions instead.
  16541.     </P
  16542. ></TD
  16543. ></TR
  16544. ></TABLE
  16545. ></DIV
  16546. ><DIV
  16547. CLASS="sect2"
  16548. ><HR><H3
  16549. CLASS="sect2"
  16550. ><A
  16551. NAME="language.types.float.casting"
  16552. ></A
  16553. >Converting to float</H3
  16554. ><P
  16555. >      For information on when and how strings are converted to floats,
  16556.      see the section titled <A
  16557. HREF="#language.types.string.conversion"
  16558. >String
  16559.      conversion to numbers</A
  16560. >. For values of other types, the conversion
  16561.      is the same as if the value would have been converted to integer
  16562.      and then to float. See the <A
  16563. HREF="#language.types.integer.casting"
  16564. >Converting
  16565.      to integer</A
  16566. > section for more information.
  16567.     </P
  16568. ></DIV
  16569. ></DIV
  16570. ><DIV
  16571. CLASS="sect1"
  16572. ><HR><H2
  16573. CLASS="sect1"
  16574. ><A
  16575. NAME="language.types.string"
  16576. ></A
  16577. >Strings</H2
  16578. ><P
  16579. >     A <A
  16580. HREF="#language.types.string"
  16581. ><B
  16582. CLASS="type"
  16583. >string</B
  16584. ></A
  16585. > is series of characters. In PHP,
  16586.     a character is the same as a byte, that is, there are exactly
  16587.     256 different characters possible. This also implies that PHP
  16588.     has no native support of Unicode. See <A
  16589. HREF="#function.utf8-encode"
  16590. ><B
  16591. CLASS="function"
  16592. >utf8_encode()</B
  16593. ></A
  16594. >
  16595.     and <A
  16596. HREF="#function.utf8-decode"
  16597. ><B
  16598. CLASS="function"
  16599. >utf8_decode()</B
  16600. ></A
  16601. > for some Unicode support.
  16602.    </P
  16603. ><DIV
  16604. CLASS="note"
  16605. ><BLOCKQUOTE
  16606. CLASS="note"
  16607. ><P
  16608. ><B
  16609. >Poznßmka: </B
  16610. >
  16611.      It is no problem for a string to become very large. 
  16612.      There is no practical bound to the size
  16613.      of strings imposed by PHP, so there is no reason at all
  16614.      to worry about long strings.
  16615.     </P
  16616. ></BLOCKQUOTE
  16617. ></DIV
  16618. ><DIV
  16619. CLASS="sect2"
  16620. ><HR><H3
  16621. CLASS="sect2"
  16622. ><A
  16623. NAME="language.types.string.syntax"
  16624. ></A
  16625. >Syntax</H3
  16626. ><P
  16627. >      A string literal can be specified in three different
  16628.      ways.
  16629.      <P
  16630. ></P
  16631. ><UL
  16632. ><LI
  16633. ><P
  16634. >         <A
  16635. HREF="#language.types.string.syntax.single"
  16636. >single quoted</A
  16637. >
  16638.        </P
  16639. ></LI
  16640. ><LI
  16641. ><P
  16642. >         <A
  16643. HREF="#language.types.string.syntax.double"
  16644. >double quoted</A
  16645. >
  16646.        </P
  16647. ></LI
  16648. ><LI
  16649. ><P
  16650. >         <A
  16651. HREF="#language.types.string.syntax.heredoc"
  16652. >heredoc syntax</A
  16653. >
  16654.        </P
  16655. ></LI
  16656. ></UL
  16657. >
  16658.     </P
  16659. ><DIV
  16660. CLASS="sect3"
  16661. ><HR><H4
  16662. CLASS="sect3"
  16663. ><A
  16664. NAME="language.types.string.syntax.single"
  16665. ></A
  16666. >Single quoted</H4
  16667. ><P
  16668. >       The easiest way to specify a simple string is to
  16669.       enclose it in single quotes (the character <TT
  16670. CLASS="literal"
  16671. >'</TT
  16672. >). 
  16673.      </P
  16674. ><P
  16675. >       To specify a literal single
  16676.       quote, you will need to escape it with a backslash
  16677.       (<TT
  16678. CLASS="literal"
  16679. >\</TT
  16680. >), like in many other languages.
  16681.       If a backslash needs to occur before a single quote or at 
  16682.       the end of the string, you need to double it.
  16683.       Note that if you try to escape any
  16684.       other character, the backslash will also be printed! So
  16685.       usually there is no need to escape the backslash itself.
  16686.       <DIV
  16687. CLASS="note"
  16688. ><BLOCKQUOTE
  16689. CLASS="note"
  16690. ><P
  16691. ><B
  16692. >Poznßmka: </B
  16693. >
  16694.         In PHP 3, a warning will
  16695.         be issued at the <TT
  16696. CLASS="literal"
  16697. >E_NOTICE</TT
  16698. > level when this
  16699.         happens.
  16700.        </P
  16701. ></BLOCKQUOTE
  16702. ></DIV
  16703. >
  16704.       <DIV
  16705. CLASS="note"
  16706. ><BLOCKQUOTE
  16707. CLASS="note"
  16708. ><P
  16709. ><B
  16710. >Poznßmka: </B
  16711. >
  16712.         Unlike the two other syntaxes, <A
  16713. HREF="#language.variables"
  16714. >variables</A
  16715. > and escape sequences
  16716.         for special characters will <SPAN
  16717. CLASS="emphasis"
  16718. ><I
  16719. CLASS="emphasis"
  16720. >not</I
  16721. ></SPAN
  16722. > be expanded 
  16723.         when they occur in single quoted strings.
  16724.        </P
  16725. ></BLOCKQUOTE
  16726. ></DIV
  16727. >
  16728.       <DIV
  16729. CLASS="informalexample"
  16730. ><A
  16731. NAME="AEN3487"
  16732. ></A
  16733. ><P
  16734. ></P
  16735. ><TABLE
  16736. BORDER="0"
  16737. BGCOLOR="#E0E0E0"
  16738. CELLPADDING="5"
  16739. ><TR
  16740. ><TD
  16741. ><PRE
  16742. CLASS="php"
  16743. ><?php
  16744. echo 'this is a simple string';
  16745.  
  16746. echo 'You can also have embedded newlines in 
  16747. strings this way as it is
  16748. okay to do';
  16749.  
  16750. // Outputs: Arnold once said: "I'll be back"
  16751. echo 'Arnold once said: "I\'ll be back"';
  16752.  
  16753. // Outputs: You deleted C:\*.*?
  16754. echo 'You deleted C:\\*.*?';
  16755.  
  16756. // Outputs: You deleted C:\*.*?
  16757. echo 'You deleted C:\*.*?';
  16758.  
  16759. // Outputs: This will not expand: \n a newline
  16760. echo 'This will not expand: \n a newline';
  16761.  
  16762. // Outputs: Variables do not $expand $either
  16763. echo 'Variables do not $expand $either';
  16764. ?></PRE
  16765. ></TD
  16766. ></TR
  16767. ></TABLE
  16768. ><P
  16769. ></P
  16770. ></DIV
  16771. >
  16772.      </P
  16773. ></DIV
  16774. ><DIV
  16775. CLASS="sect3"
  16776. ><HR><H4
  16777. CLASS="sect3"
  16778. ><A
  16779. NAME="language.types.string.syntax.double"
  16780. ></A
  16781. >Double quoted</H4
  16782. ><P
  16783. >       If the string is enclosed in double-quotes ("),
  16784.       PHP understands more escape sequences for special
  16785.       characters:
  16786.      </P
  16787. ><DIV
  16788. CLASS="table"
  16789. ><A
  16790. NAME="AEN3492"
  16791. ></A
  16792. ><P
  16793. ><B
  16794. >Tabulka 6-1. Escaped characters</B
  16795. ></P
  16796. ><TABLE
  16797. BORDER="1"
  16798. CLASS="CALSTABLE"
  16799. ><THEAD
  16800. ><TR
  16801. ><TH
  16802. ALIGN="LEFT"
  16803. VALIGN="MIDDLE"
  16804. >sequence</TH
  16805. ><TH
  16806. ALIGN="LEFT"
  16807. VALIGN="MIDDLE"
  16808. >meaning</TH
  16809. ></TR
  16810. ></THEAD
  16811. ><TBODY
  16812. ><TR
  16813. ><TD
  16814. ALIGN="LEFT"
  16815. VALIGN="MIDDLE"
  16816. ><TT
  16817. CLASS="literal"
  16818. >\n</TT
  16819. ></TD
  16820. ><TD
  16821. ALIGN="LEFT"
  16822. VALIGN="MIDDLE"
  16823. >linefeed (LF or 0x0A (10) in ASCII)</TD
  16824. ></TR
  16825. ><TR
  16826. ><TD
  16827. ALIGN="LEFT"
  16828. VALIGN="MIDDLE"
  16829. ><TT
  16830. CLASS="literal"
  16831. >\r</TT
  16832. ></TD
  16833. ><TD
  16834. ALIGN="LEFT"
  16835. VALIGN="MIDDLE"
  16836. >carriage return (CR or 0x0D (13) in ASCII)</TD
  16837. ></TR
  16838. ><TR
  16839. ><TD
  16840. ALIGN="LEFT"
  16841. VALIGN="MIDDLE"
  16842. ><TT
  16843. CLASS="literal"
  16844. >\t</TT
  16845. ></TD
  16846. ><TD
  16847. ALIGN="LEFT"
  16848. VALIGN="MIDDLE"
  16849. >horizontal tab (HT or 0x09 (9) in ASCII)</TD
  16850. ></TR
  16851. ><TR
  16852. ><TD
  16853. ALIGN="LEFT"
  16854. VALIGN="MIDDLE"
  16855. ><TT
  16856. CLASS="literal"
  16857. >\\</TT
  16858. ></TD
  16859. ><TD
  16860. ALIGN="LEFT"
  16861. VALIGN="MIDDLE"
  16862. >backslash</TD
  16863. ></TR
  16864. ><TR
  16865. ><TD
  16866. ALIGN="LEFT"
  16867. VALIGN="MIDDLE"
  16868. ><TT
  16869. CLASS="literal"
  16870. >\$</TT
  16871. ></TD
  16872. ><TD
  16873. ALIGN="LEFT"
  16874. VALIGN="MIDDLE"
  16875. >dollar sign</TD
  16876. ></TR
  16877. ><TR
  16878. ><TD
  16879. ALIGN="LEFT"
  16880. VALIGN="MIDDLE"
  16881. ><TT
  16882. CLASS="literal"
  16883. >\"</TT
  16884. ></TD
  16885. ><TD
  16886. ALIGN="LEFT"
  16887. VALIGN="MIDDLE"
  16888. >double-quote</TD
  16889. ></TR
  16890. ><TR
  16891. ><TD
  16892. ALIGN="LEFT"
  16893. VALIGN="MIDDLE"
  16894. ><TT
  16895. CLASS="literal"
  16896. >\[0-7]{1,3}</TT
  16897. ></TD
  16898. ><TD
  16899. ALIGN="LEFT"
  16900. VALIGN="MIDDLE"
  16901. >           the sequence of characters matching the regular
  16902.           expression is a character in octal notation
  16903.          </TD
  16904. ></TR
  16905. ><TR
  16906. ><TD
  16907. ALIGN="LEFT"
  16908. VALIGN="MIDDLE"
  16909. ><TT
  16910. CLASS="literal"
  16911. >\x[0-9A-Fa-f]{1,2}</TT
  16912. ></TD
  16913. ><TD
  16914. ALIGN="LEFT"
  16915. VALIGN="MIDDLE"
  16916. >           the sequence of characters matching the regular
  16917.           expression is a character in hexadecimal notation
  16918.          </TD
  16919. ></TR
  16920. ></TBODY
  16921. ></TABLE
  16922. ></DIV
  16923. ><P
  16924. >       Again, if you try to escape any other character, the
  16925.       backslash will be printed too!
  16926.      </P
  16927. ><P
  16928. >       But the most important feature of double-quoted strings
  16929.       is the fact that variable names will be expanded.
  16930.       See <A
  16931. HREF="#language.types.string.parsing"
  16932. >string 
  16933.       parsing</A
  16934. > for details.
  16935.      </P
  16936. ></DIV
  16937. ><DIV
  16938. CLASS="sect3"
  16939. ><HR><H4
  16940. CLASS="sect3"
  16941. ><A
  16942. NAME="language.types.string.syntax.heredoc"
  16943. ></A
  16944. >Heredoc</H4
  16945. ><P
  16946. >       Another way to delimit strings is by using heredoc syntax
  16947.       ("<<<").  One should provide an identifier after
  16948.       <TT
  16949. CLASS="literal"
  16950. ><<<</TT
  16951. >, then the string, and then the
  16952.       same identifier to close the quotation. 
  16953.      </P
  16954. ><P
  16955. >       The closing identifier <SPAN
  16956. CLASS="emphasis"
  16957. ><I
  16958. CLASS="emphasis"
  16959. >must</I
  16960. ></SPAN
  16961. > begin in the
  16962.       first column of the line. Also, the identifier used must follow
  16963.       the same naming rules as any other label in PHP: it must contain
  16964.       only alphanumeric characters and underscores, and must start with
  16965.       a non-digit character or underscore.
  16966.      </P
  16967. ><DIV
  16968. CLASS="warning"
  16969. ><P
  16970. ></P
  16971. ><TABLE
  16972. CLASS="warning"
  16973. BORDER="1"
  16974. WIDTH="100%"
  16975. ><TR
  16976. ><TD
  16977. ALIGN="CENTER"
  16978. ><B
  16979. >Varovßnφ</B
  16980. ></TD
  16981. ></TR
  16982. ><TR
  16983. ><TD
  16984. ALIGN="LEFT"
  16985. ><P
  16986. >        It is very important to note that the line with the closing
  16987.        identifier contains no other characters, except 
  16988.        <SPAN
  16989. CLASS="emphasis"
  16990. ><I
  16991. CLASS="emphasis"
  16992. >possibly</I
  16993. ></SPAN
  16994. > a semicolon (<TT
  16995. CLASS="literal"
  16996. >;</TT
  16997. >).
  16998.        That means especially that the identifier 
  16999.        <SPAN
  17000. CLASS="emphasis"
  17001. ><I
  17002. CLASS="emphasis"
  17003. >may not be indented</I
  17004. ></SPAN
  17005. >, and there
  17006.        may not be any spaces or tabs after or before the semicolon.
  17007.        It's also important to realize that the first character before
  17008.        the closing identifier must be a newline as defined by your
  17009.        operating system. This is <TT
  17010. CLASS="literal"
  17011. >\r</TT
  17012. > on Macintosh
  17013.        for example.
  17014.       </P
  17015. ><P
  17016. >        If this rule is broken and the closing identifier is not "clean"
  17017.        then it's not considered to be a closing identifier and PHP 
  17018.        will continue looking for one.  If in this case a proper closing 
  17019.        identifier is not found then a parse error will result with the 
  17020.        line number being at the end of the script.
  17021.       </P
  17022. ></TD
  17023. ></TR
  17024. ></TABLE
  17025. ></DIV
  17026. ><P
  17027. >       Heredoc text behaves just like a double-quoted string, without
  17028.       the double-quotes. This means that you do not need to escape quotes
  17029.       in your here docs, but you can still use the escape codes listed
  17030.       above. Variables are expanded, but the same care must be taken
  17031.       when expressing complex variables inside a here doc as with
  17032.       strings.
  17033.       <TABLE
  17034. WIDTH="100%"
  17035. BORDER="0"
  17036. CELLPADDING="0"
  17037. CELLSPACING="0"
  17038. CLASS="EXAMPLE"
  17039. ><TR
  17040. ><TD
  17041. ><DIV
  17042. CLASS="example"
  17043. ><A
  17044. NAME="AEN3549"
  17045. ></A
  17046. ><P
  17047. ><B
  17048. >P°φklad 6-2. Heredoc string quoting example</B
  17049. ></P
  17050. ><TABLE
  17051. BORDER="0"
  17052. BGCOLOR="#E0E0E0"
  17053. CELLPADDING="5"
  17054. ><TR
  17055. ><TD
  17056. ><PRE
  17057. CLASS="php"
  17058. ><?php
  17059. $str = <<<EOD
  17060. Example of string
  17061. spanning multiple lines
  17062. using heredoc syntax.
  17063. EOD;
  17064.  
  17065. /* More complex example, with variables. */
  17066. class foo
  17067. {
  17068.     var $foo;
  17069.     var $bar;
  17070.  
  17071.     function foo()
  17072.     {
  17073.         $this->foo = 'Foo';
  17074.         $this->bar = array('Bar1', 'Bar2', 'Bar3');
  17075.     }
  17076. }
  17077.  
  17078. $foo = new foo();
  17079. $name = 'MyName';
  17080.  
  17081. echo <<<EOT
  17082. My name is "$name". I am printing some $foo->foo.
  17083. Now, I am printing some {$foo->bar[1]}.
  17084. This should print a capital 'A': \x41
  17085. EOT;
  17086. ?></PRE
  17087. ></TD
  17088. ></TR
  17089. ></TABLE
  17090. ></DIV
  17091. ></TD
  17092. ></TR
  17093. ></TABLE
  17094. >
  17095.      </P
  17096. ><DIV
  17097. CLASS="note"
  17098. ><BLOCKQUOTE
  17099. CLASS="note"
  17100. ><P
  17101. ><B
  17102. >Poznßmka: </B
  17103. >
  17104.        Heredoc support was added in PHP 4.
  17105.       </P
  17106. ></BLOCKQUOTE
  17107. ></DIV
  17108. ></DIV
  17109. ><DIV
  17110. CLASS="sect3"
  17111. ><HR><H4
  17112. CLASS="sect3"
  17113. ><A
  17114. NAME="language.types.string.parsing"
  17115. ></A
  17116. >Variable parsing</H4
  17117. ><P
  17118. >       When a string is specified in double quotes or with
  17119.       heredoc, <A
  17120. HREF="#language.variables"
  17121. >variables</A
  17122. > are 
  17123.       parsed within it. 
  17124.      </P
  17125. ><P
  17126. >       There are two types of syntax: a 
  17127.       <A
  17128. HREF="#language.types.string.parsing.simple"
  17129. >simple</A
  17130. >
  17131.       one and a 
  17132.       <A
  17133. HREF="#language.types.string.parsing.complex"
  17134. >complex</A
  17135. >
  17136.       one.
  17137.       The simple syntax is the most common and convenient. It provides a way
  17138.       to parse a variable, an <A
  17139. HREF="#language.types.array"
  17140. ><B
  17141. CLASS="type"
  17142. >array</B
  17143. ></A
  17144. > value, or an 
  17145.       object property.
  17146.      </P
  17147. ><P
  17148. >       The complex syntax was introduced in PHP 4, and can be recognised
  17149.       by the curly braces surrounding the expression.
  17150.      </P
  17151. ><DIV
  17152. CLASS="sect4"
  17153. ><HR><H5
  17154. CLASS="sect4"
  17155. ><A
  17156. NAME="language.types.string.parsing.simple"
  17157. ></A
  17158. >Simple syntax</H5
  17159. ><P
  17160. >        If a dollar sign (<TT
  17161. CLASS="literal"
  17162. >$</TT
  17163. >) is encountered, the
  17164.        parser will greedily take as many tokens as possible to form a
  17165.        valid variable name. Enclose the variable name in curly
  17166.        braces if you want to explicitly specify the end of the name.
  17167.       </P
  17168. ><DIV
  17169. CLASS="informalexample"
  17170. ><A
  17171. NAME="AEN3568"
  17172. ></A
  17173. ><P
  17174. ></P
  17175. ><TABLE
  17176. BORDER="0"
  17177. BGCOLOR="#E0E0E0"
  17178. CELLPADDING="5"
  17179. ><TR
  17180. ><TD
  17181. ><PRE
  17182. CLASS="php"
  17183. ><?php
  17184. $beer = 'Heineken';
  17185. echo "$beer's taste is great"; // works, "'" is an invalid character for varnames
  17186. echo "He drank some $beers";   // won't work, 's' is a valid character for varnames
  17187. echo "He drank some ${beer}s"; // works
  17188. echo "He drank some {$beer}s"; // works
  17189. ?></PRE
  17190. ></TD
  17191. ></TR
  17192. ></TABLE
  17193. ><P
  17194. ></P
  17195. ></DIV
  17196. ><P
  17197. >        Similarly, you can also have an <A
  17198. HREF="#language.types.array"
  17199. ><B
  17200. CLASS="type"
  17201. >array</B
  17202. ></A
  17203. > index or an 
  17204.        object property parsed. With array indices, the closing square 
  17205.        bracket (<TT
  17206. CLASS="literal"
  17207. >]</TT
  17208. >) marks the end of the index. For
  17209.        object properties the same rules apply as to simple variables,
  17210.        though with object properties there doesn't exist a trick like
  17211.        the one with variables.
  17212.        
  17213.        
  17214.       
  17215.       </P
  17216. ><DIV
  17217. CLASS="informalexample"
  17218. ><A
  17219. NAME="AEN3574"
  17220. ></A
  17221. ><P
  17222. ></P
  17223. ><TABLE
  17224. BORDER="0"
  17225. BGCOLOR="#E0E0E0"
  17226. CELLPADDING="5"
  17227. ><TR
  17228. ><TD
  17229. ><PRE
  17230. CLASS="php"
  17231. ><?php
  17232. // These examples are specific to using arrays inside of strings.
  17233. // When outside of a string, always quote your array string keys 
  17234. // and do not use {braces} when outside of strings either.
  17235.  
  17236. // Let's show all errors
  17237. error_reporting(E_ALL);
  17238.  
  17239. $fruits = array('strawberry' => 'red', 'banana' => 'yellow');
  17240.  
  17241. // Works but note that this works differently outside string-quotes
  17242. echo "A banana is $fruits[banana].";
  17243.  
  17244. // Works
  17245. echo "A banana is {$fruits['banana']}.";
  17246.  
  17247. // Works but PHP looks for a constant named banana first
  17248. // as described below.
  17249. echo "A banana is {$fruits[banana]}.";
  17250.  
  17251. // Won't work, use braces.  This results in a parse error.
  17252. echo "A banana is $fruits['banana'].";
  17253.  
  17254. // Works
  17255. echo "A banana is " . $fruits['banana'] . ".";
  17256.  
  17257. // Works
  17258. echo "This square is $square->width meters broad.";
  17259.  
  17260. // Won't work. For a solution, see the complex syntax.
  17261. echo "This square is $square->width00 centimeters broad.";
  17262. ?></PRE
  17263. ></TD
  17264. ></TR
  17265. ></TABLE
  17266. ><P
  17267. ></P
  17268. ></DIV
  17269. ><P
  17270. >        For anything more complex, you should use the complex syntax.
  17271.       </P
  17272. ></DIV
  17273. ><DIV
  17274. CLASS="sect4"
  17275. ><HR><H5
  17276. CLASS="sect4"
  17277. ><A
  17278. NAME="language.types.string.parsing.complex"
  17279. ></A
  17280. >Complex (curly) syntax</H5
  17281. ><P
  17282. >        This isn't called complex because the syntax is complex,
  17283.        but because you can include complex expressions this way.
  17284.      </P
  17285. ><P
  17286. >       In fact, you can include any value that is in the namespace
  17287.       in strings with this syntax. You simply write the expression
  17288.       the same way as you would outside the string, and then include
  17289.       it in { and }. Since you can't escape '{', this syntax will
  17290.       only be recognised when the $ is immediately following the {.
  17291.       (Use "{\$" or "\{$" to get a literal "{$").
  17292.       Some examples to make it clear:
  17293.      </P
  17294. ><DIV
  17295. CLASS="informalexample"
  17296. ><A
  17297. NAME="AEN3581"
  17298. ></A
  17299. ><P
  17300. ></P
  17301. ><TABLE
  17302. BORDER="0"
  17303. BGCOLOR="#E0E0E0"
  17304. CELLPADDING="5"
  17305. ><TR
  17306. ><TD
  17307. ><PRE
  17308. CLASS="php"
  17309. ><?php
  17310. // Let's show all errors
  17311. error_reporting(E_ALL);
  17312.  
  17313. $great = 'fantastic';
  17314.  
  17315. // Won't work, outputs: This is { fantastic}
  17316. echo "This is { $great}";
  17317.  
  17318. // Works, outputs: This is fantastic
  17319. echo "This is {$great}";
  17320. echo "This is ${great}";
  17321.  
  17322. // Works
  17323. echo "This square is {$square->width}00 centimeters broad."; 
  17324.  
  17325. // Works
  17326. echo "This works: {$arr[4][3]}";
  17327.  
  17328. // This is wrong for the same reason as $foo[bar] is wrong 
  17329. // outside a string.  In other words, it will still work but
  17330. // because PHP first looks for a constant named foo, it will
  17331. // throw an error of level E_NOTICE (undefined constant).
  17332. echo "This is wrong: {$arr[foo][3]}"; 
  17333.  
  17334. // Works.  When using multi-dimensional arrays, always use
  17335. // braces around arrays when inside of strings
  17336. echo "This works: {$arr['foo'][3]}";
  17337.  
  17338. // Works.
  17339. echo "This works: " . $arr['foo'][3];
  17340.  
  17341. echo "You can even write {$obj->values[3]->name}";
  17342.  
  17343. echo "This is the value of the var named $name: {${$name}}";
  17344. ?></PRE
  17345. ></TD
  17346. ></TR
  17347. ></TABLE
  17348. ><P
  17349. ></P
  17350. ></DIV
  17351. ></DIV
  17352. ></DIV
  17353. ><DIV
  17354. CLASS="sect3"
  17355. ><HR><H4
  17356. CLASS="sect3"
  17357. ><A
  17358. NAME="language.types.string.substr"
  17359. ></A
  17360. >String access and modification by character</H4
  17361. ><P
  17362. >       Characters within strings may be accessed and modified by specifying the
  17363.       zero-based offset of the desired character after the string 
  17364.       in curly braces.
  17365.      </P
  17366. ><DIV
  17367. CLASS="note"
  17368. ><BLOCKQUOTE
  17369. CLASS="note"
  17370. ><P
  17371. ><B
  17372. >Poznßmka: </B
  17373. >
  17374.        For backwards compatibility, you can still use array-brackets
  17375.        for the same purpose. However, this syntax is deprecated as
  17376.        of PHP 4.
  17377.       </P
  17378. ></BLOCKQUOTE
  17379. ></DIV
  17380. ><P
  17381. >       <TABLE
  17382. WIDTH="100%"
  17383. BORDER="0"
  17384. CELLPADDING="0"
  17385. CELLSPACING="0"
  17386. CLASS="EXAMPLE"
  17387. ><TR
  17388. ><TD
  17389. ><DIV
  17390. CLASS="example"
  17391. ><A
  17392. NAME="AEN3589"
  17393. ></A
  17394. ><P
  17395. ><B
  17396. >P°φklad 6-3. Some string examples</B
  17397. ></P
  17398. ><TABLE
  17399. BORDER="0"
  17400. BGCOLOR="#E0E0E0"
  17401. CELLPADDING="5"
  17402. ><TR
  17403. ><TD
  17404. ><PRE
  17405. CLASS="php"
  17406. ><?php
  17407. // Get the first character of a string
  17408. $str = 'This is a test.';
  17409. $first = $str{0};
  17410.  
  17411. // Get the third character of a string
  17412. $third = $str{2};
  17413.  
  17414. // Get the last character of a string.
  17415. $str = 'This is still a test.';
  17416. $last = $str{strlen($str)-1}; 
  17417.  
  17418. // Modify the last character of a string
  17419. $str = 'Look at the sea';
  17420. $str{strlen($str)-1} = 'e';
  17421.           
  17422. ?></PRE
  17423. ></TD
  17424. ></TR
  17425. ></TABLE
  17426. ></DIV
  17427. ></TD
  17428. ></TR
  17429. ></TABLE
  17430. >
  17431.      </P
  17432. ></DIV
  17433. ></DIV
  17434. ><DIV
  17435. CLASS="sect2"
  17436. ><HR><H3
  17437. CLASS="sect2"
  17438. ><A
  17439. NAME="language.types.string.useful-funcs"
  17440. ></A
  17441. >Useful functions and operators</H3
  17442. ><P
  17443. >      Strings may be concatenated using the '.' (dot) operator. Note
  17444.      that the '+' (addition) operator will not work for this. Please
  17445.      see <A
  17446. HREF="#language.operators.string"
  17447. >String
  17448.      operators</A
  17449. > for more information.
  17450.     </P
  17451. ><P
  17452. >      There are a lot of useful functions for string modification.
  17453.     </P
  17454. ><P
  17455. >      See the <A
  17456. HREF="#ref.strings"
  17457. >string functions section</A
  17458.      for general functions, the regular expression functions for
  17459.      advanced find&replacing (in two tastes: 
  17460.      <A
  17461. HREF="#ref.pcre"
  17462. >Perl</A
  17463. > and 
  17464.      <A
  17465. HREF="#ref.regex"
  17466. >POSIX extended</A
  17467. >).
  17468.     </P
  17469. ><P
  17470. >      There are also <A
  17471. HREF="#ref.url"
  17472. >functions for URL-strings</A
  17473. >,
  17474.      and functions to encrypt/decrypt strings 
  17475.      (<A
  17476. HREF="#ref.mcrypt"
  17477. >mcrypt</A
  17478. > and 
  17479.      <A
  17480. HREF="#ref.mhash"
  17481. >mhash</A
  17482. >).
  17483.     </P
  17484. ><P
  17485. >      Finally, if you still didn't find what you're looking for,
  17486.      see also the <A
  17487. HREF="#ref.ctype"
  17488. >character type functions</A
  17489. >.
  17490.     </P
  17491. ></DIV
  17492. ><DIV
  17493. CLASS="sect2"
  17494. ><HR><H3
  17495. CLASS="sect2"
  17496. ><A
  17497. NAME="language.types.string.casting"
  17498. ></A
  17499. >Converting to string</H3
  17500. ><P
  17501. >      You can convert a value to a string using the <TT
  17502. CLASS="literal"
  17503. >(string)</TT
  17504. >
  17505.      cast, or the <A
  17506. HREF="#function.strval"
  17507. ><B
  17508. CLASS="function"
  17509. >strval()</B
  17510. ></A
  17511. > function. String conversion
  17512.      is automatically done in the scope of an expression for you where a
  17513.      string is needed. This happens when you use the <A
  17514. HREF="#function.echo"
  17515. ><B
  17516. CLASS="function"
  17517. >echo()</B
  17518. ></A
  17519. >
  17520.      or <A
  17521. HREF="#function.print"
  17522. ><B
  17523. CLASS="function"
  17524. >print()</B
  17525. ></A
  17526. > functions, or when you compare a variable
  17527.      value to a string.  Reading the manual sections on <A
  17528. HREF="#language.types"
  17529. >Types</A
  17530. > and <A
  17531. HREF="#language.types.type-juggling"
  17532. >Type Juggling</A
  17533. > will make
  17534.      the following clearer.  See also <A
  17535. HREF="#function.settype"
  17536. ><B
  17537. CLASS="function"
  17538. >settype()</B
  17539. ></A
  17540. >.
  17541.     </P
  17542. ><P
  17543. >      A <A
  17544. HREF="#language.types.boolean"
  17545. ><B
  17546. CLASS="type"
  17547. >boolean</B
  17548. ></A
  17549. > <TT
  17550. CLASS="constant"
  17551. ><B
  17552. >TRUE</B
  17553. ></TT
  17554. > value is converted to the string <TT
  17555. CLASS="literal"
  17556. >"1"</TT
  17557. >,
  17558.      the <TT
  17559. CLASS="constant"
  17560. ><B
  17561. >FALSE</B
  17562. ></TT
  17563. > value is represented as <TT
  17564. CLASS="literal"
  17565. >""</TT
  17566. > (empty string).
  17567.      This way you can convert back and forth between boolean and string values.
  17568.     </P
  17569. ><P
  17570.      An <A
  17571. HREF="#language.types.integer"
  17572. ><B
  17573. CLASS="type"
  17574. >integer</B
  17575. ></A
  17576. > or a floating point number (<A
  17577. HREF="#language.types.float"
  17578. ><B
  17579. CLASS="type"
  17580. >float</B
  17581. ></A
  17582. >) 
  17583.      is converted to a string representing the number with its digits
  17584.      (including the exponent part for floating point numbers).
  17585.     </P
  17586. ><P
  17587. >      Arrays are always converted to the string <TT
  17588. CLASS="literal"
  17589. >"Array"</TT
  17590. >,
  17591.      so you cannot dump out the contents of an <A
  17592. HREF="#language.types.array"
  17593. ><B
  17594. CLASS="type"
  17595. >array</B
  17596. ></A
  17597. > with 
  17598.      <A
  17599. HREF="#function.echo"
  17600. ><B
  17601. CLASS="function"
  17602. >echo()</B
  17603. ></A
  17604. > or <A
  17605. HREF="#function.print"
  17606. ><B
  17607. CLASS="function"
  17608. >print()</B
  17609. ></A
  17610. > to see what is inside 
  17611.      them.  To view one element, you'd do something like <TT
  17612. CLASS="literal"
  17613. >      echo $arr['foo']</TT
  17614. >.  See below for tips on dumping/viewing the 
  17615.      entire contents.
  17616.     </P
  17617. ><P
  17618. >      Objects are always converted to the string <TT
  17619. CLASS="literal"
  17620. >"Object"</TT
  17621. >.
  17622.      If you would like to print out the member variable values of an 
  17623.      <A
  17624. HREF="#language.types.object"
  17625. ><B
  17626. CLASS="type"
  17627. >object</B
  17628. ></A
  17629. > for debugging reasons, read the paragraphs 
  17630.      below. If you would like to find out the class name of which an object 
  17631.      is an instance of, use <A
  17632. HREF="#function.get-class"
  17633. ><B
  17634. CLASS="function"
  17635. >get_class()</B
  17636. ></A
  17637. >.
  17638.     </P
  17639. ><P
  17640. >      Resources are always converted to strings with the structure
  17641.      <TT
  17642. CLASS="literal"
  17643. >"Resource id #1"</TT
  17644. > where <TT
  17645. CLASS="literal"
  17646. >1</TT
  17647. > is
  17648.      the unique number of the <A
  17649. HREF="#language.types.resource"
  17650. ><B
  17651. CLASS="type"
  17652. >resource</B
  17653. ></A
  17654. > assigned by PHP during runtime.
  17655.      If you would like to get the type of the resource, use
  17656.      <A
  17657. HREF="#function.get-resource-type"
  17658. ><B
  17659. CLASS="function"
  17660. >get_resource_type()</B
  17661. ></A
  17662. >.
  17663.     </P
  17664. ><P
  17665. >      <TT
  17666. CLASS="constant"
  17667. ><B
  17668. >NULL</B
  17669. ></TT
  17670. > is always converted to an empty string.
  17671.     </P
  17672. ><P
  17673. >      As you can see above, printing out the arrays, objects or resources does not
  17674.      provide you any useful information about the values themselfs. Look at the
  17675.      functions <A
  17676. HREF="#function.print-r"
  17677. ><B
  17678. CLASS="function"
  17679. >print_r()</B
  17680. ></A
  17681. > and <A
  17682. HREF="#function.var-dump"
  17683. ><B
  17684. CLASS="function"
  17685. >var_dump()</B
  17686. ></A
  17687. >
  17688.      for better ways to print out values for debugging.
  17689.     </P
  17690. ><P
  17691. >      You can also convert PHP values to strings to store them permanently. This
  17692.      method is called serialization, and can be done with the function
  17693.      <A
  17694. HREF="#function.serialize"
  17695. ><B
  17696. CLASS="function"
  17697. >serialize()</B
  17698. ></A
  17699. >. You can also serialize PHP values to
  17700.      XML structures, if you have <A
  17701. HREF="#ref.wddx"
  17702. >WDDX</A
  17703. > support
  17704.      in your PHP setup.
  17705.     </P
  17706. ></DIV
  17707. ><DIV
  17708. CLASS="sect2"
  17709. ><HR><H3
  17710. CLASS="sect2"
  17711. ><A
  17712. NAME="language.types.string.conversion"
  17713. ></A
  17714. >String conversion to numbers</H3
  17715. ><P
  17716. >      When a string is evaluated as a numeric value, the resulting
  17717.      value and type are determined as follows.
  17718.     </P
  17719. ><P
  17720. >      The string will evaluate as a <A
  17721. HREF="#language.types.float"
  17722. ><B
  17723. CLASS="type"
  17724. >float</B
  17725. ></A
  17726. > if it contains any of the
  17727.      characters '.', 'e', or 'E'. Otherwise, it will evaluate as an
  17728.      integer.
  17729.     </P
  17730. ><P
  17731. >      The value is given by the initial portion of the string. If the
  17732.      string starts with valid numeric data, this will be the value
  17733.      used. Otherwise, the value will be 0 (zero). Valid numeric data
  17734.      is an optional sign, followed by one or more digits (optionally
  17735.      containing a decimal point), followed by an optional
  17736.      exponent. The exponent is an 'e' or 'E' followed by one or more
  17737.      digits.
  17738.     </P
  17739. ><DIV
  17740. CLASS="informalexample"
  17741. ><A
  17742. NAME="AEN3655"
  17743. ></A
  17744. ><P
  17745. ></P
  17746. ><TABLE
  17747. BORDER="0"
  17748. BGCOLOR="#E0E0E0"
  17749. CELLPADDING="5"
  17750. ><TR
  17751. ><TD
  17752. ><PRE
  17753. CLASS="php"
  17754. ><?php
  17755. $foo = 1 + "10.5";                // $foo is float (11.5)
  17756. $foo = 1 + "-1.3e3";              // $foo is float (-1299)
  17757. $foo = 1 + "bob-1.3e3";           // $foo is integer (1)
  17758. $foo = 1 + "bob3";                // $foo is integer (1)
  17759. $foo = 1 + "10 Small Pigs";       // $foo is integer (11)
  17760. $foo = 4 + "10.2 Little Piggies"; // $foo is float (14.2)
  17761. $foo = "10.0 pigs " + 1;          // $foo is float (11)
  17762. $foo = "10.0 pigs " + 1.0;        // $foo is float (11)     
  17763. ?></PRE
  17764. ></TD
  17765. ></TR
  17766. ></TABLE
  17767. ><P
  17768. ></P
  17769. ></DIV
  17770. ><P
  17771. >      For more information on this conversion, see the Unix manual page
  17772.      for strtod(3).
  17773.     </P
  17774. ><P
  17775. >      If you would like to test any of the examples in this section,
  17776.      you can cut and paste the examples and insert the following line
  17777.      to see for yourself what's going on:
  17778.      <DIV
  17779. CLASS="informalexample"
  17780. ><A
  17781. NAME="AEN3659"
  17782. ></A
  17783. ><P
  17784. ></P
  17785. ><TABLE
  17786. BORDER="0"
  17787. BGCOLOR="#E0E0E0"
  17788. CELLPADDING="5"
  17789. ><TR
  17790. ><TD
  17791. ><PRE
  17792. CLASS="php"
  17793. ><?php
  17794. echo "\$foo==$foo; type is " . gettype ($foo) . "<br />\n";
  17795. ?></PRE
  17796. ></TD
  17797. ></TR
  17798. ></TABLE
  17799. ><P
  17800. ></P
  17801. ></DIV
  17802. >
  17803.     </P
  17804. ><P
  17805. >      Do not expect to get the code of one character by converting it
  17806.      to integer (as you would do in C for example). Use the functions
  17807.      <A
  17808. HREF="#function.ord"
  17809. ><B
  17810. CLASS="function"
  17811. >ord()</B
  17812. ></A
  17813. > and <A
  17814. HREF="#function.chr"
  17815. ><B
  17816. CLASS="function"
  17817. >chr()</B
  17818. ></A
  17819. > to convert
  17820.      between charcodes and characters.
  17821.     </P
  17822. ></DIV
  17823. ></DIV
  17824. ><DIV
  17825. CLASS="sect1"
  17826. ><HR><H2
  17827. CLASS="sect1"
  17828. ><A
  17829. NAME="language.types.array"
  17830. ></A
  17831. >Arrays</H2
  17832. ><P
  17833. >     An array in PHP is actually an ordered map. A map is a type that
  17834.     maps <SPAN
  17835. CLASS="emphasis"
  17836. ><I
  17837. CLASS="emphasis"
  17838. >values</I
  17839. ></SPAN
  17840. > to <SPAN
  17841. CLASS="emphasis"
  17842. ><I
  17843. CLASS="emphasis"
  17844. >keys</I
  17845. ></SPAN
  17846. >. 
  17847.     This type is optimized in several ways,
  17848.     so you can use it as a real array, or a list (vector), 
  17849.     hashtable (which is an implementation of a map), 
  17850.     dictionary, collection,
  17851.     stack, queue and probably more. Because you can have another
  17852.     PHP array as a value, you can also quite easily simulate
  17853.     trees.
  17854.    </P
  17855. ><P
  17856. >     Explanation of those data structures is beyond the scope of this
  17857.     manual, but you'll find at least one example for each of them.
  17858.     For more information we refer you to external literature about
  17859.     this broad topic.
  17860.    </P
  17861. ><DIV
  17862. CLASS="sect2"
  17863. ><HR><H3
  17864. CLASS="sect2"
  17865. ><A
  17866. NAME="language.types.array.syntax"
  17867. ></A
  17868. >Syntax</H3
  17869. ><DIV
  17870. CLASS="sect3"
  17871. ><H4
  17872. CLASS="sect3"
  17873. ><A
  17874. NAME="language.types.array.syntax.array-func"
  17875. ></A
  17876. >Specifying with <A
  17877. HREF="#function.array"
  17878. ><B
  17879. CLASS="function"
  17880. >array()</B
  17881. ></A
  17882. ></H4
  17883. ><P
  17884. >       An <A
  17885. HREF="#language.types.array"
  17886. ><B
  17887. CLASS="type"
  17888. >array</B
  17889. ></A
  17890. > can be created by the <A
  17891. HREF="#function.array"
  17892. ><B
  17893. CLASS="function"
  17894. >array()</B
  17895. ></A
  17896.       language-construct. It takes a certain number of comma-separated
  17897.       <TT
  17898. CLASS="literal"
  17899. ><TT
  17900. CLASS="replaceable"
  17901. ><I
  17902. >key</I
  17903. ></TT
  17904. > => <TT
  17905. CLASS="replaceable"
  17906. ><I
  17907. >value</I
  17908. ></TT
  17909. ></TT
  17910. >
  17911.       pairs.
  17912.      </P
  17913. ><P
  17914. >       <TABLE
  17915. BORDER="0"
  17916. BGCOLOR="#E0E0E0"
  17917. CELLPADDING="5"
  17918. ><TR
  17919. ><TD
  17920. ><PRE
  17921. CLASS="synopsis"
  17922. >array( [<TT
  17923. CLASS="replaceable"
  17924. ><I
  17925. >key</I
  17926. ></TT
  17927. > =>] <TT
  17928. CLASS="replaceable"
  17929. ><I
  17930. >value</I
  17931. ></TT
  17932. >
  17933.      , ...
  17934.      )
  17935. // <TT
  17936. CLASS="replaceable"
  17937. ><I
  17938. >key</I
  17939. ></TT
  17940. > may be an <A
  17941. HREF="#language.types.integer"
  17942. ><B
  17943. CLASS="type"
  17944. >integer</B
  17945. ></A
  17946. > or <A
  17947. HREF="#language.types.string"
  17948. ><B
  17949. CLASS="type"
  17950. >string</B
  17951. ></A
  17952. >
  17953. // <TT
  17954. CLASS="replaceable"
  17955. ><I
  17956. >value</I
  17957. ></TT
  17958. > may be any value</PRE
  17959. ></TD
  17960. ></TR
  17961. ></TABLE
  17962. >
  17963.      </P
  17964. ><P
  17965. >       <DIV
  17966. CLASS="informalexample"
  17967. ><A
  17968. NAME="AEN3691"
  17969. ></A
  17970. ><P
  17971. ></P
  17972. ><TABLE
  17973. BORDER="0"
  17974. BGCOLOR="#E0E0E0"
  17975. CELLPADDING="5"
  17976. ><TR
  17977. ><TD
  17978. ><PRE
  17979. CLASS="php"
  17980. ><?php
  17981. $arr = array("foo" => "bar", 12 => true);
  17982.  
  17983. echo $arr["foo"]; // bar
  17984. echo $arr[12];    // 1
  17985. ?></PRE
  17986. ></TD
  17987. ></TR
  17988. ></TABLE
  17989. ><P
  17990. ></P
  17991. ></DIV
  17992. >
  17993.      </P
  17994. ><P
  17995. >       A <TT
  17996. CLASS="varname"
  17997. >key</TT
  17998. > may be either an
  17999.       <TT
  18000. CLASS="literal"
  18001. >integer</TT
  18002. > or a <A
  18003. HREF="#language.types.string"
  18004. ><B
  18005. CLASS="type"
  18006. >string</B
  18007. ></A
  18008. >. If a key is
  18009.       the standard representation of an <A
  18010. HREF="#language.types.integer"
  18011. ><B
  18012. CLASS="type"
  18013. >integer</B
  18014. ></A
  18015. >, it will
  18016.       be interpreted as such (i.e.  <TT
  18017. CLASS="literal"
  18018. >"8"</TT
  18019. > will be
  18020.       interpreted as <TT
  18021. CLASS="literal"
  18022. >8</TT
  18023. >, while
  18024.       <TT
  18025. CLASS="literal"
  18026. >"08"</TT
  18027. > will be interpreted as
  18028.       <TT
  18029. CLASS="literal"
  18030. >"08"</TT
  18031. >). There are no different indexed and
  18032.       associative array types in PHP; there is only one array type,
  18033.       which can both contain integer and string indices.
  18034.      </P
  18035. ><P
  18036. >       A value can be of any PHP type.
  18037.       <DIV
  18038. CLASS="informalexample"
  18039. ><A
  18040. NAME="AEN3703"
  18041. ></A
  18042. ><P
  18043. ></P
  18044. ><TABLE
  18045. BORDER="0"
  18046. BGCOLOR="#E0E0E0"
  18047. CELLPADDING="5"
  18048. ><TR
  18049. ><TD
  18050. ><PRE
  18051. CLASS="php"
  18052. ><?php
  18053. $arr = array("somearray" => array(6 => 5, 13 => 9, "a" => 42));
  18054.  
  18055. echo $arr["somearray"][6];    // 5
  18056. echo $arr["somearray"][13];   // 9
  18057. echo $arr["somearray"]["a"];  // 42
  18058. ?></PRE
  18059. ></TD
  18060. ></TR
  18061. ></TABLE
  18062. ><P
  18063. ></P
  18064. ></DIV
  18065. >
  18066.      </P
  18067. ><P
  18068. >       If you do not specify a key for a given value, then the maximum
  18069.       of the integer indices is taken, and the new key will be that
  18070.       maximum value + 1. If you specify a key that already has a value
  18071.       assigned to it, that value will be overwritten.
  18072.       <DIV
  18073. CLASS="informalexample"
  18074. ><A
  18075. NAME="AEN3706"
  18076. ></A
  18077. ><P
  18078. ></P
  18079. ><TABLE
  18080. BORDER="0"
  18081. BGCOLOR="#E0E0E0"
  18082. CELLPADDING="5"
  18083. ><TR
  18084. ><TD
  18085. ><PRE
  18086. CLASS="php"
  18087. ><?php
  18088. // This array is the same as ...
  18089. array(5 => 43, 32, 56, "b" => 12);
  18090.  
  18091. // ...this array
  18092. array(5 => 43, 6 => 32, 7 => 56, "b" => 12);
  18093. ?></PRE
  18094. ></TD
  18095. ></TR
  18096. ></TABLE
  18097. ><P
  18098. ></P
  18099. ></DIV
  18100. >
  18101.      </P
  18102. ><DIV
  18103. CLASS="warning"
  18104. ><P
  18105. ></P
  18106. ><TABLE
  18107. CLASS="warning"
  18108. BORDER="1"
  18109. WIDTH="100%"
  18110. ><TR
  18111. ><TD
  18112. ALIGN="CENTER"
  18113. ><B
  18114. >Varovßnφ</B
  18115. ></TD
  18116. ></TR
  18117. ><TR
  18118. ><TD
  18119. ALIGN="LEFT"
  18120. ><P
  18121. >          As of PHP 4.3.0, the index generation behaviour described
  18122.          above has changed. Now, if you append to an array in which
  18123.          the current maximum key is negative, then the next key
  18124.          created will be zero (<TT
  18125. CLASS="literal"
  18126. >0</TT
  18127. >). Before, the new
  18128.          index would have been set to the largest existing key + 1,
  18129.          the same as positive indices are.
  18130.       </P
  18131. ></TD
  18132. ></TR
  18133. ></TABLE
  18134. ></DIV
  18135. ><P
  18136. >       Using <TT
  18137. CLASS="constant"
  18138. ><B
  18139. >TRUE</B
  18140. ></TT
  18141. > as a key will evaluate to <A
  18142. HREF="#language.types.integer"
  18143. ><B
  18144. CLASS="type"
  18145. >integer</B
  18146. ></A
  18147. >
  18148.       <TT
  18149. CLASS="literal"
  18150. >1</TT
  18151. > as key. Using <TT
  18152. CLASS="constant"
  18153. ><B
  18154. >FALSE</B
  18155. ></TT
  18156. > as a key will evaluate
  18157.       to <A
  18158. HREF="#language.types.integer"
  18159. ><B
  18160. CLASS="type"
  18161. >integer</B
  18162. ></A
  18163. > <TT
  18164. CLASS="literal"
  18165. >0</TT
  18166. > as key. Using
  18167.       <TT
  18168. CLASS="literal"
  18169. >NULL</TT
  18170. > as a key will evaluate to the empty
  18171.       string. Using the empty string as key will create (or overwrite)
  18172.       a key with the empty string and its value; it is not the same as
  18173.       using empty brackets.
  18174.      </P
  18175. ><P
  18176. >       You cannot use arrays or objects as keys. Doing so will result in a
  18177.       warning: <TT
  18178. CLASS="literal"
  18179. >Illegal offset type</TT
  18180. >.
  18181.      </P
  18182. ></DIV
  18183. ><DIV
  18184. CLASS="sect3"
  18185. ><HR><H4
  18186. CLASS="sect3"
  18187. ><A
  18188. NAME="language.types.array.syntax.modifying"
  18189. ></A
  18190. >Creating/modifying with square-bracket syntax</H4
  18191. ><P
  18192. >       You can also modify an existing array by explicitly setting
  18193.       values in it.
  18194.      </P
  18195. ><P
  18196. >       This is done by assigning values to the array while specifying the 
  18197.       key in brackets. You can also omit the key, add an empty pair
  18198.       of brackets ("<TT
  18199. CLASS="literal"
  18200. >[]</TT
  18201. >") to the variable name in that case.
  18202.       <TABLE
  18203. BORDER="0"
  18204. BGCOLOR="#E0E0E0"
  18205. CELLPADDING="5"
  18206. ><TR
  18207. ><TD
  18208. ><PRE
  18209. CLASS="synopsis"
  18210. >$arr[<TT
  18211. CLASS="replaceable"
  18212. ><I
  18213. >key</I
  18214. ></TT
  18215. >] = <TT
  18216. CLASS="replaceable"
  18217. ><I
  18218. >value</I
  18219. ></TT
  18220. >;
  18221. $arr[] = <TT
  18222. CLASS="replaceable"
  18223. ><I
  18224. >value</I
  18225. ></TT
  18226. >;
  18227. // <TT
  18228. CLASS="replaceable"
  18229. ><I
  18230. >key</I
  18231. ></TT
  18232. > may be an <A
  18233. HREF="#language.types.integer"
  18234. ><B
  18235. CLASS="type"
  18236. >integer</B
  18237. ></A
  18238. > or <A
  18239. HREF="#language.types.string"
  18240. ><B
  18241. CLASS="type"
  18242. >string</B
  18243. ></A
  18244. >
  18245. // <TT
  18246. CLASS="replaceable"
  18247. ><I
  18248. >value</I
  18249. ></TT
  18250. > may be any value</PRE
  18251. ></TD
  18252. ></TR
  18253. ></TABLE
  18254. >
  18255.       If <TT
  18256. CLASS="varname"
  18257. >$arr</TT
  18258. > doesn't exist yet, it will be created. 
  18259.       So this is also an alternative way to specify an array.
  18260.       To change a certain value, just assign a new value
  18261.       to an element specified with its key. If you want to
  18262.       remove a key/value pair, you need to <A
  18263. HREF="#function.unset"
  18264. ><B
  18265. CLASS="function"
  18266. >unset()</B
  18267. ></A
  18268. > it. 
  18269.       <DIV
  18270. CLASS="informalexample"
  18271. ><A
  18272. NAME="AEN3736"
  18273. ></A
  18274. ><P
  18275. ></P
  18276. ><TABLE
  18277. BORDER="0"
  18278. BGCOLOR="#E0E0E0"
  18279. CELLPADDING="5"
  18280. ><TR
  18281. ><TD
  18282. ><PRE
  18283. CLASS="php"
  18284. ><?php
  18285. $arr = array(5 => 1, 12 => 2);
  18286.  
  18287. $arr[] = 56;    // This is the same as $arr[13] = 56;
  18288.                 // at this point of the script
  18289.  
  18290. $arr["x"] = 42; // This adds a new element to
  18291.                 // the array with key "x"
  18292.                 
  18293. unset($arr[5]); // This removes the element from the array
  18294.  
  18295. unset($arr);    // This deletes the whole array
  18296. ?></PRE
  18297. ></TD
  18298. ></TR
  18299. ></TABLE
  18300. ><P
  18301. ></P
  18302. ></DIV
  18303. >
  18304.      </P
  18305. ><DIV
  18306. CLASS="note"
  18307. ><BLOCKQUOTE
  18308. CLASS="note"
  18309. ><P
  18310. ><B
  18311. >Poznßmka: </B
  18312. >
  18313.        As mentioned above, if you provide the brackets with no key
  18314.        specified, then the maximum of the existing integer indices is
  18315.        taken, and the new key will be that maximum value + 1 . If no
  18316.        integer indices exist yet, the key will be <TT
  18317. CLASS="literal"
  18318. >0</TT
  18319. >
  18320.        (zero). If you specify a key that already has a value assigned
  18321.        to it, that value will be overwritten.
  18322.       </P
  18323. ><P
  18324. >        <DIV
  18325. CLASS="warning"
  18326. ><P
  18327. ></P
  18328. ><TABLE
  18329. CLASS="warning"
  18330. BORDER="1"
  18331. WIDTH="100%"
  18332. ><TR
  18333. ><TD
  18334. ALIGN="CENTER"
  18335. ><B
  18336. >Varovßnφ</B
  18337. ></TD
  18338. ></TR
  18339. ><TR
  18340. ><TD
  18341. ALIGN="LEFT"
  18342. ><P
  18343. >          As of PHP 4.3.0, the index generation behaviour described
  18344.          above has changed. Now, if you append to an array in which
  18345.          the current maximum key is negative, then the next key
  18346.          created will be zero (<TT
  18347. CLASS="literal"
  18348. >0</TT
  18349. >). Before, the new
  18350.          index would have been set to the largest existing key + 1,
  18351.          the same as positive indices are.
  18352.         </P
  18353. ></TD
  18354. ></TR
  18355. ></TABLE
  18356. ></DIV
  18357. >
  18358.       </P
  18359. ><P
  18360. >        Note that the maximum integer key used for this <SPAN
  18361. CLASS="emphasis"
  18362. ><I
  18363. CLASS="emphasis"
  18364. >need
  18365.        not currently exist in the array</I
  18366. ></SPAN
  18367. >. It simply must
  18368.        have existed in the array at some time since the last time the
  18369.        array was re-indexed. The following example illustrates:
  18370.       </P
  18371. ><DIV
  18372. CLASS="informalexample"
  18373. ><A
  18374. NAME="AEN3747"
  18375. ></A
  18376. ><P
  18377. ></P
  18378. ><TABLE
  18379. BORDER="0"
  18380. BGCOLOR="#E0E0E0"
  18381. CELLPADDING="5"
  18382. ><TR
  18383. ><TD
  18384. ><PRE
  18385. CLASS="php"
  18386. ><?php
  18387. // Create a simple array.
  18388. $array = array(1, 2, 3, 4, 5);
  18389. print_r($array);
  18390.  
  18391. // Now delete every item, but leave the array itself intact:
  18392. foreach ($array as $i => $value) {
  18393.     unset($array[$i]);
  18394. }
  18395. print_r($array);
  18396.  
  18397. // Append an item (note that the new key is 5, instead of 0 as you
  18398. // might expect).
  18399. $array[] = 6;
  18400. print_r($array);
  18401.  
  18402. // Re-index:
  18403. $array = array_values($array);
  18404. $array[] = 7;
  18405. print_r($array);
  18406. ?></PRE
  18407. ></TD
  18408. ></TR
  18409. ></TABLE
  18410. ><P
  18411. >         The above example would produce the following output:
  18412.         <TABLE
  18413. BORDER="0"
  18414. BGCOLOR="#E0E0E0"
  18415. CELLPADDING="5"
  18416. ><TR
  18417. ><TD
  18418. ><PRE
  18419. CLASS="screen"
  18420. >Array
  18421. (
  18422.     [0] => 1
  18423.     [1] => 2
  18424.     [2] => 3
  18425.     [3] => 4
  18426.     [4] => 5
  18427. )
  18428. Array
  18429. (
  18430. )
  18431. Array
  18432. (
  18433.     [5] => 6
  18434. )
  18435. Array
  18436. (
  18437.     [0] => 6
  18438.     [1] => 7
  18439. )</PRE
  18440. ></TD
  18441. ></TR
  18442. ></TABLE
  18443. >
  18444.        </P
  18445. ><P
  18446. ></P
  18447. ></DIV
  18448. ></BLOCKQUOTE
  18449. ></DIV
  18450. ></DIV
  18451. ></DIV
  18452. ><DIV
  18453. CLASS="sect2"
  18454. ><HR><H3
  18455. CLASS="sect2"
  18456. ><A
  18457. NAME="language.types.array.useful-funcs"
  18458. ></A
  18459. >Useful functions</H3
  18460. ><P
  18461. >      There are quite a few useful functions for working with arrays.
  18462.      See the <A
  18463. HREF="#ref.array"
  18464. >array functions</A
  18465. > section.
  18466.     </P
  18467. ><DIV
  18468. CLASS="note"
  18469. ><BLOCKQUOTE
  18470. CLASS="note"
  18471. ><P
  18472. ><B
  18473. >Poznßmka: </B
  18474. >
  18475.       The <A
  18476. HREF="#function.unset"
  18477. ><B
  18478. CLASS="function"
  18479. >unset()</B
  18480. ></A
  18481. > function allows unsetting keys of an 
  18482.       array. Be aware that the array will NOT be reindexed. If you only
  18483.       use "usual integer indices" (starting from zero, increasing by one),
  18484.       you can achieve the reindex effect by using <A
  18485. HREF="#function.array-values"
  18486. ><B
  18487. CLASS="function"
  18488. >array_values()</B
  18489. ></A
  18490. >.
  18491.       <DIV
  18492. CLASS="informalexample"
  18493. ><A
  18494. NAME="AEN3759"
  18495. ></A
  18496. ><P
  18497. ></P
  18498. ><TABLE
  18499. BORDER="0"
  18500. BGCOLOR="#E0E0E0"
  18501. CELLPADDING="5"
  18502. ><TR
  18503. ><TD
  18504. ><PRE
  18505. CLASS="php"
  18506. ><?php
  18507. $a = array(1 => 'one', 2 => 'two', 3 => 'three');
  18508. unset($a[2]);
  18509. /* will produce an array that would have been defined as
  18510.    $a = array(1 => 'one', 3 => 'three');
  18511.    and NOT
  18512.    $a = array(1 => 'one', 2 =>'three');
  18513. */
  18514.  
  18515. $b = array_values($a);
  18516. // Now $b is array(0 => 'one', 1 =>'three')
  18517. ?></PRE
  18518. ></TD
  18519. ></TR
  18520. ></TABLE
  18521. ><P
  18522. ></P
  18523. ></DIV
  18524. >
  18525.      
  18526.      </P
  18527. ></BLOCKQUOTE
  18528. ></DIV
  18529. ><P
  18530. >      The <A
  18531. HREF="#control-structures.foreach"
  18532. >foreach</A
  18533.      control structure exists specifically for arrays. It 
  18534.      provides an easy way to traverse an array.
  18535.     </P
  18536. ></DIV
  18537. ><DIV
  18538. CLASS="sect2"
  18539. ><HR><H3
  18540. CLASS="sect2"
  18541. ><A
  18542. NAME="language.types.array.donts"
  18543. ></A
  18544. >Array do's and don'ts</H3
  18545. ><DIV
  18546. CLASS="sect3"
  18547. ><H4
  18548. CLASS="sect3"
  18549. ><A
  18550. NAME="language.types.array.foo-bar"
  18551. ></A
  18552. >Why is <TT
  18553. CLASS="literal"
  18554. >$foo[bar]</TT
  18555. > wrong?</H4
  18556. ><P
  18557. >       You should always use quotes around a string literal
  18558.       array index.  For example, use $foo['bar'] and not
  18559.       $foo[bar]. But why is $foo[bar] wrong? You might have seen the
  18560.       following syntax in old scripts:
  18561.       <DIV
  18562. CLASS="informalexample"
  18563. ><A
  18564. NAME="AEN3769"
  18565. ></A
  18566. ><P
  18567. ></P
  18568. ><TABLE
  18569. BORDER="0"
  18570. BGCOLOR="#E0E0E0"
  18571. CELLPADDING="5"
  18572. ><TR
  18573. ><TD
  18574. ><PRE
  18575. CLASS="php"
  18576. ><?php
  18577. $foo[bar] = 'enemy';
  18578. echo $foo[bar];
  18579. // etc
  18580. ?></PRE
  18581. ></TD
  18582. ></TR
  18583. ></TABLE
  18584. ><P
  18585. ></P
  18586. ></DIV
  18587. >
  18588.       This is wrong, but it works. Then, why is it wrong? The reason
  18589.       is that this code has an undefined constant (bar) rather than a
  18590.       string ('bar' - notice the quotes), and PHP may in future define
  18591.       constants which, unfortunately for your code, have the same
  18592.       name.  It works because PHP automatically converts a
  18593.       <SPAN
  18594. CLASS="emphasis"
  18595. ><I
  18596. CLASS="emphasis"
  18597. >bare string</I
  18598. ></SPAN
  18599. > (an unquoted string which does
  18600.       not correspond to any known symbol) into a string which contains
  18601.       the bare string. For instance, if there is no defined constant
  18602.       named <TT
  18603. CLASS="constant"
  18604. ><B
  18605. >bar</B
  18606. ></TT
  18607. >, then PHP will substitute in the
  18608.       string <TT
  18609. CLASS="literal"
  18610. >'bar'</TT
  18611. > and use that.
  18612.      </P
  18613. ><DIV
  18614. CLASS="note"
  18615. ><BLOCKQUOTE
  18616. CLASS="note"
  18617. ><P
  18618. ><B
  18619. >Poznßmka: </B
  18620. >
  18621.        This does not mean to <SPAN
  18622. CLASS="emphasis"
  18623. ><I
  18624. CLASS="emphasis"
  18625. >always</I
  18626. ></SPAN
  18627. > quote the
  18628.        key. You do not want to quote keys which are <A
  18629. HREF="#language.constants"
  18630. >constants</A
  18631. > or <A
  18632. HREF="#language.variables"
  18633. >variables</A
  18634. >, as this will
  18635.        prevent PHP from interpreting them.
  18636.       </P
  18637. ><DIV
  18638. CLASS="informalexample"
  18639. ><A
  18640. NAME="AEN3779"
  18641. ></A
  18642. ><P
  18643. ></P
  18644. ><TABLE
  18645. BORDER="0"
  18646. BGCOLOR="#E0E0E0"
  18647. CELLPADDING="5"
  18648. ><TR
  18649. ><TD
  18650. ><PRE
  18651. CLASS="php"
  18652. ><?php
  18653. error_reporting(E_ALL);
  18654. ini_set('display_errors', true);
  18655. ini_set('html_errors', false);
  18656. // Simple array:
  18657. $array = array(1, 2);
  18658. $count = count($array);
  18659. for ($i = 0; $i < $count; $i++) {
  18660.     echo "\nChecking $i: \n";
  18661.     echo "Bad: " . $array['$i'] . "\n";
  18662.     echo "Good: " . $array[$i] . "\n";
  18663.     echo "Bad: {$array['$i']}\n";
  18664.     echo "Good: {$array[$i]}\n";
  18665. }
  18666. ?></PRE
  18667. ></TD
  18668. ></TR
  18669. ></TABLE
  18670. ><P
  18671. ></P
  18672. ></DIV
  18673. ><P
  18674. ><B
  18675. >Poznßmka: </B
  18676. >
  18677.        The output from the above is:
  18678.        <TABLE
  18679. BORDER="0"
  18680. BGCOLOR="#E0E0E0"
  18681. CELLPADDING="5"
  18682. ><TR
  18683. ><TD
  18684. ><PRE
  18685. CLASS="screen"
  18686. >Checking 0: 
  18687. Notice: Undefined index:  $i in /path/to/script.html on line 9
  18688. Bad: 
  18689. Good: 1
  18690. Notice: Undefined index:  $i in /path/to/script.html on line 11
  18691. Bad: 
  18692. Good: 1
  18693.  
  18694. Checking 1: 
  18695. Notice: Undefined index:  $i in /path/to/script.html on line 9
  18696. Bad: 
  18697. Good: 2
  18698. Notice: Undefined index:  $i in /path/to/script.html on line 11
  18699. Bad: 
  18700. Good: 2</PRE
  18701. ></TD
  18702. ></TR
  18703. ></TABLE
  18704. >
  18705.       </P
  18706. ></BLOCKQUOTE
  18707. ></DIV
  18708. ><P
  18709. >       More examples to demonstrate this fact:
  18710.       <DIV
  18711. CLASS="informalexample"
  18712. ><A
  18713. NAME="AEN3784"
  18714. ></A
  18715. ><P
  18716. ></P
  18717. ><TABLE
  18718. BORDER="0"
  18719. BGCOLOR="#E0E0E0"
  18720. CELLPADDING="5"
  18721. ><TR
  18722. ><TD
  18723. ><PRE
  18724. CLASS="php"
  18725. ><?php
  18726. // Let's show all errors
  18727. error_reporting(E_ALL);
  18728.  
  18729. $arr = array('fruit' => 'apple', 'veggie' => 'carrot');
  18730.  
  18731. // Correct
  18732. print $arr['fruit'];  // apple
  18733. print $arr['veggie']; // carrot
  18734.  
  18735. // Incorrect.  This works but also throws a PHP error of
  18736. // level E_NOTICE because of an undefined constant named fruit
  18737. // 
  18738. // Notice: Use of undefined constant fruit - assumed 'fruit' in...
  18739. print $arr[fruit];    // apple
  18740.  
  18741. // Let's define a constant to demonstrate what's going on.  We
  18742. // will assign value 'veggie' to a constant named fruit.
  18743. define('fruit', 'veggie');
  18744.  
  18745. // Notice the difference now
  18746. print $arr['fruit'];  // apple
  18747. print $arr[fruit];    // carrot
  18748.  
  18749. // The following is okay as it's inside a string.  Constants are not
  18750. // looked for within strings so no E_NOTICE error here
  18751. print "Hello $arr[fruit]";      // Hello apple
  18752.  
  18753. // With one exception, braces surrounding arrays within strings
  18754. // allows constants to be looked for
  18755. print "Hello {$arr[fruit]}";    // Hello carrot
  18756. print "Hello {$arr['fruit']}";  // Hello apple
  18757.  
  18758. // This will not work, results in a parse error such as:
  18759. // Parse error: parse error, expecting T_STRING' or T_VARIABLE' or T_NUM_STRING'
  18760. // This of course applies to using autoglobals in strings as well
  18761. print "Hello $arr['fruit']";
  18762. print "Hello $_GET['foo']";
  18763.  
  18764. // Concatenation is another option
  18765. print "Hello " . $arr['fruit']; // Hello apple
  18766. ?></PRE
  18767. ></TD
  18768. ></TR
  18769. ></TABLE
  18770. ><P
  18771. ></P
  18772. ></DIV
  18773. >
  18774.      </P
  18775. ><P
  18776. >       When you turn <A
  18777. HREF="#function.error-reporting"
  18778. ><B
  18779. CLASS="function"
  18780. >error_reporting()</B
  18781. ></A
  18782. > up to show
  18783.       <TT
  18784. CLASS="constant"
  18785. ><B
  18786. >E_NOTICE</B
  18787. ></TT
  18788. > level errors (such as setting
  18789.       it to <TT
  18790. CLASS="constant"
  18791. ><B
  18792. >E_ALL</B
  18793. ></TT
  18794. >) then you will see these
  18795.       errors.  By default, <A
  18796. HREF="#ini.error-reporting"
  18797. >       error_reporting</A
  18798. > is turned down to not show them.
  18799.      </P
  18800. ><P
  18801. >       As stated in the <A
  18802. HREF="#language.types.array.syntax"
  18803. >syntax</A
  18804. > section,
  18805.       there must be an expression between the square brackets
  18806.       ('<TT
  18807. CLASS="literal"
  18808. >[</TT
  18809. >' and '<TT
  18810. CLASS="literal"
  18811. >]</TT
  18812. >').  That means
  18813.       that you can write things like this:
  18814.       <DIV
  18815. CLASS="informalexample"
  18816. ><A
  18817. NAME="AEN3795"
  18818. ></A
  18819. ><P
  18820. ></P
  18821. ><TABLE
  18822. BORDER="0"
  18823. BGCOLOR="#E0E0E0"
  18824. CELLPADDING="5"
  18825. ><TR
  18826. ><TD
  18827. ><PRE
  18828. CLASS="php"
  18829. ><?php
  18830. echo $arr[somefunc($bar)];
  18831. ?></PRE
  18832. ></TD
  18833. ></TR
  18834. ></TABLE
  18835. ><P
  18836. ></P
  18837. ></DIV
  18838. >
  18839.       This is an example of using a function return value
  18840.       as the array index. PHP also knows about constants,
  18841.       as you may have seen the <TT
  18842. CLASS="literal"
  18843. >E_*</TT
  18844. > ones
  18845.       before.      
  18846.  
  18847.       <DIV
  18848. CLASS="informalexample"
  18849. ><A
  18850. NAME="AEN3798"
  18851. ></A
  18852. ><P
  18853. ></P
  18854. ><TABLE
  18855. BORDER="0"
  18856. BGCOLOR="#E0E0E0"
  18857. CELLPADDING="5"
  18858. ><TR
  18859. ><TD
  18860. ><PRE
  18861. CLASS="php"
  18862. ><?php
  18863. $error_descriptions[E_ERROR]   = "A fatal error has occured";
  18864. $error_descriptions[E_WARNING] = "PHP issued a warning";
  18865. $error_descriptions[E_NOTICE]  = "This is just an informal notice";
  18866. ?></PRE
  18867. ></TD
  18868. ></TR
  18869. ></TABLE
  18870. ><P
  18871. ></P
  18872. ></DIV
  18873. >
  18874.       Note that <TT
  18875. CLASS="literal"
  18876. >E_ERROR</TT
  18877. > is also a valid identifier, 
  18878.       just like <TT
  18879. CLASS="literal"
  18880. >bar</TT
  18881. > in the first example. But the last
  18882.       example is in fact the same as writing:
  18883.       <DIV
  18884. CLASS="informalexample"
  18885. ><A
  18886. NAME="AEN3802"
  18887. ></A
  18888. ><P
  18889. ></P
  18890. ><TABLE
  18891. BORDER="0"
  18892. BGCOLOR="#E0E0E0"
  18893. CELLPADDING="5"
  18894. ><TR
  18895. ><TD
  18896. ><PRE
  18897. CLASS="php"
  18898. ><?php
  18899. $error_descriptions[1] = "A fatal error has occured";
  18900. $error_descriptions[2] = "PHP issued a warning";
  18901. $error_descriptions[8] = "This is just an informal notice";
  18902. ?></PRE
  18903. ></TD
  18904. ></TR
  18905. ></TABLE
  18906. ><P
  18907. ></P
  18908. ></DIV
  18909. >
  18910.       because <TT
  18911. CLASS="literal"
  18912. >E_ERROR</TT
  18913. > equals <TT
  18914. CLASS="literal"
  18915. >1</TT
  18916. >, etc.
  18917.      </P
  18918. ><P
  18919. >       As we already explained in the above examples, 
  18920.       <TT
  18921. CLASS="literal"
  18922. >$foo[bar]</TT
  18923. > still works but is wrong.
  18924.       It works, because <TT
  18925. CLASS="literal"
  18926. >bar</TT
  18927. > is due to its syntax
  18928.       expected to be a constant expression. However, in this case no 
  18929.       constant with the name <TT
  18930. CLASS="literal"
  18931. >bar</TT
  18932. > exists. PHP now
  18933.       assumes that you meant <TT
  18934. CLASS="literal"
  18935. >bar</TT
  18936. > literally, 
  18937.       as the string <TT
  18938. CLASS="literal"
  18939. >"bar"</TT
  18940. >, but that you forgot
  18941.       to write the quotes.
  18942.      </P
  18943. ><DIV
  18944. CLASS="sect4"
  18945. ><HR><H5
  18946. CLASS="sect4"
  18947. ><A
  18948. NAME="AEN3812"
  18949. ></A
  18950. >So why is it bad then?</H5
  18951. ><P
  18952. >        At some point in the future, the PHP team might want to add another
  18953.        constant or keyword, or you may introduce another constant into your
  18954.        application, and then you get in trouble. For example,
  18955.        you already cannot use the words <TT
  18956. CLASS="literal"
  18957. >empty</TT
  18958. > and 
  18959.        <TT
  18960. CLASS="literal"
  18961. >default</TT
  18962. > this way, since they are special 
  18963.        <A
  18964. HREF="#reserved"
  18965. >reserved keywords</A
  18966. >.
  18967.       </P
  18968. ><DIV
  18969. CLASS="note"
  18970. ><BLOCKQUOTE
  18971. CLASS="note"
  18972. ><P
  18973. ><B
  18974. >Poznßmka: </B
  18975. >
  18976.         To reiterate, inside a double-quoted <A
  18977. HREF="#language.types.string"
  18978. ><B
  18979. CLASS="type"
  18980. >string</B
  18981. ></A
  18982. >, it's
  18983.         valid to not surround array indexes with quotes so
  18984.         <TT
  18985. CLASS="literal"
  18986. >"$foo[bar]"</TT
  18987. > is valid.  See the above 
  18988.         examples for details on why as well as the section on
  18989.         <A
  18990. HREF="#language.types.string.parsing"
  18991. >variable parsing 
  18992.         in strings</A
  18993. >.
  18994.        </P
  18995. ></BLOCKQUOTE
  18996. ></DIV
  18997. ></DIV
  18998. ></DIV
  18999. ></DIV
  19000. ><DIV
  19001. CLASS="sect2"
  19002. ><HR><H3
  19003. CLASS="sect2"
  19004. ><A
  19005. NAME="language.types.array.casting"
  19006. ></A
  19007. >Converting to array</H3
  19008. ><P
  19009. >      For any of the types: <A
  19010. HREF="#language.types.integer"
  19011. ><B
  19012. CLASS="type"
  19013. >integer</B
  19014. ></A
  19015. >, <A
  19016. HREF="#language.types.float"
  19017. ><B
  19018. CLASS="type"
  19019. >float</B
  19020. ></A
  19021. >,
  19022.      <A
  19023. HREF="#language.types.string"
  19024. ><B
  19025. CLASS="type"
  19026. >string</B
  19027. ></A
  19028. >, <A
  19029. HREF="#language.types.boolean"
  19030. ><B
  19031. CLASS="type"
  19032. >boolean</B
  19033. ></A
  19034. > and <A
  19035. HREF="#language.types.resource"
  19036. ><B
  19037. CLASS="type"
  19038. >resource</B
  19039. ></A
  19040. >,
  19041.      if you convert a value to an <A
  19042. HREF="#language.types.array"
  19043. ><B
  19044. CLASS="type"
  19045. >array</B
  19046. ></A
  19047. >, you get an array 
  19048.      with one element (with index 0), which is the scalar value you 
  19049.      started with.
  19050.     </P
  19051. ><P
  19052. >      If you convert an <A
  19053. HREF="#language.types.object"
  19054. ><B
  19055. CLASS="type"
  19056. >object</B
  19057. ></A
  19058. > to an array, you get the
  19059.      properties (member variables) of that object as the array's elements. 
  19060.      The keys are the member variable names.
  19061.     </P
  19062. ><P
  19063. >      If you convert a <TT
  19064. CLASS="constant"
  19065. ><B
  19066. >NULL</B
  19067. ></TT
  19068. > value to an array, you get an empty array.
  19069.     </P
  19070. ></DIV
  19071. ><DIV
  19072. CLASS="sect2"
  19073. ><HR><H3
  19074. CLASS="sect2"
  19075. ><A
  19076. NAME="language.types.array.examples"
  19077. ></A
  19078. >Examples</H3
  19079. ><P
  19080. >      The array type in PHP is very versatile, so here will be some 
  19081.      examples to show you the full power of arrays.
  19082.     </P
  19083. ><P
  19084. >       <DIV
  19085. CLASS="informalexample"
  19086. ><A
  19087. NAME="AEN3840"
  19088. ></A
  19089. ><P
  19090. ></P
  19091. ><TABLE
  19092. BORDER="0"
  19093. BGCOLOR="#E0E0E0"
  19094. CELLPADDING="5"
  19095. ><TR
  19096. ><TD
  19097. ><PRE
  19098. CLASS="php"
  19099. ><?php
  19100. // this
  19101. $a = array( 'color' => 'red',
  19102.             'taste' => 'sweet',
  19103.             'shape' => 'round',
  19104.             'name'  => 'apple',
  19105.                        4        // key will be 0
  19106.           );
  19107.  
  19108. // is completely equivalent with
  19109. $a['color'] = 'red';
  19110. $a['taste'] = 'sweet';
  19111. $a['shape'] = 'round';
  19112. $a['name']  = 'apple';
  19113. $a[]        = 4;        // key will be 0
  19114.  
  19115. $b[] = 'a';
  19116. $b[] = 'b';
  19117. $b[] = 'c';
  19118. // will result in the array array(0 => 'a' , 1 => 'b' , 2 => 'c'),
  19119. // or simply array('a', 'b', 'c')
  19120. ?></PRE
  19121. ></TD
  19122. ></TR
  19123. ></TABLE
  19124. ><P
  19125. ></P
  19126. ></DIV
  19127. >
  19128.      </P
  19129. ><TABLE
  19130. WIDTH="100%"
  19131. BORDER="0"
  19132. CELLPADDING="0"
  19133. CELLSPACING="0"
  19134. CLASS="EXAMPLE"
  19135. ><TR
  19136. ><TD
  19137. ><DIV
  19138. CLASS="example"
  19139. ><A
  19140. NAME="AEN3842"
  19141. ></A
  19142. ><P
  19143. ><B
  19144. >P°φklad 6-4. Using array()</B
  19145. ></P
  19146. ><TABLE
  19147. BORDER="0"
  19148. BGCOLOR="#E0E0E0"
  19149. CELLPADDING="5"
  19150. ><TR
  19151. ><TD
  19152. ><PRE
  19153. CLASS="php"
  19154. ><?php
  19155. // Array as (property-)map
  19156. $map = array( 'version'    => 4,
  19157.               'OS'         => 'Linux',
  19158.               'lang'       => 'english',
  19159.               'short_tags' => true
  19160.             );
  19161.             
  19162. // strictly numerical keys
  19163. $array = array( 7,
  19164.                 8,
  19165.                 0,
  19166.                 156,
  19167.                 -10
  19168.               );
  19169. // this is the same as array(0 => 7, 1 => 8, ...)
  19170.  
  19171. $switching = array(         10, // key = 0
  19172.                     5    =>  6,
  19173.                     3    =>  7, 
  19174.                     'a'  =>  4,
  19175.                             11, // key = 6 (maximum of integer-indices was 5)
  19176.                     '8'  =>  2, // key = 8 (integer!)
  19177.                     '02' => 77, // key = '02'
  19178.                     0    => 12  // the value 10 will be overwritten by 12
  19179.                   );
  19180.                   
  19181. // empty array
  19182. $empty = array();         
  19183. ?></PRE
  19184. ></TD
  19185. ></TR
  19186. ></TABLE
  19187. ></DIV
  19188. ></TD
  19189. ></TR
  19190. ></TABLE
  19191. ><TABLE
  19192. WIDTH="100%"
  19193. BORDER="0"
  19194. CELLPADDING="0"
  19195. CELLSPACING="0"
  19196. CLASS="EXAMPLE"
  19197. ><TR
  19198. ><TD
  19199. ><DIV
  19200. CLASS="example"
  19201. ><A
  19202. NAME="language.types.array.examples.loop"
  19203. ></A
  19204. ><P
  19205. ><B
  19206. >P°φklad 6-5. Collection</B
  19207. ></P
  19208. ><TABLE
  19209. BORDER="0"
  19210. BGCOLOR="#E0E0E0"
  19211. CELLPADDING="5"
  19212. ><TR
  19213. ><TD
  19214. ><PRE
  19215. CLASS="php"
  19216. ><?php
  19217. $colors = array('red', 'blue', 'green', 'yellow');
  19218.  
  19219. foreach ($colors as $color) {
  19220.     echo "Do you like $color?\n";
  19221. }
  19222.  
  19223. /* output:
  19224. Do you like red?
  19225. Do you like blue?
  19226. Do you like green?
  19227. Do you like yellow?
  19228. */
  19229. ?></PRE
  19230. ></TD
  19231. ></TR
  19232. ></TABLE
  19233. ></DIV
  19234. ></TD
  19235. ></TR
  19236. ></TABLE
  19237. ><P
  19238. >      Note that it is currently not possible to change the values of the array
  19239.      directly in such a loop. 
  19240.       
  19241.      A workaround is the following: 
  19242.      <TABLE
  19243. WIDTH="100%"
  19244. BORDER="0"
  19245. CELLPADDING="0"
  19246. CELLSPACING="0"
  19247. CLASS="EXAMPLE"
  19248. ><TR
  19249. ><TD
  19250. ><DIV
  19251. CLASS="example"
  19252. ><A
  19253. NAME="language.types.array.examples.changeloop"
  19254. ></A
  19255. ><P
  19256. ><B
  19257. >P°φklad 6-6. Collection</B
  19258. ></P
  19259. ><TABLE
  19260. BORDER="0"
  19261. BGCOLOR="#E0E0E0"
  19262. CELLPADDING="5"
  19263. ><TR
  19264. ><TD
  19265. ><PRE
  19266. CLASS="php"
  19267. ><?php
  19268. foreach ($colors as $key => $color) {
  19269.     // won't work:
  19270.     //$color = strtoupper($color);
  19271.     
  19272.     // works:
  19273.     $colors[$key] = strtoupper($color);
  19274. }
  19275. print_r($colors);
  19276.  
  19277. /* output:
  19278. Array
  19279. (
  19280.     [0] => RED
  19281.     [1] => BLUE
  19282.     [2] => GREEN
  19283.     [3] => YELLOW
  19284. )
  19285. */
  19286. ?></PRE
  19287. ></TD
  19288. ></TR
  19289. ></TABLE
  19290. ></DIV
  19291. ></TD
  19292. ></TR
  19293. ></TABLE
  19294. >
  19295.     </P
  19296. ><P
  19297. >      This example creates a one-based array.
  19298.      <TABLE
  19299. WIDTH="100%"
  19300. BORDER="0"
  19301. CELLPADDING="0"
  19302. CELLSPACING="0"
  19303. CLASS="EXAMPLE"
  19304. ><TR
  19305. ><TD
  19306. ><DIV
  19307. CLASS="example"
  19308. ><A
  19309. NAME="AEN3853"
  19310. ></A
  19311. ><P
  19312. ><B
  19313. >P°φklad 6-7. One-based index</B
  19314. ></P
  19315. ><TABLE
  19316. BORDER="0"
  19317. BGCOLOR="#E0E0E0"
  19318. CELLPADDING="5"
  19319. ><TR
  19320. ><TD
  19321. ><PRE
  19322. CLASS="php"
  19323. ><?php
  19324. $firstquarter  = array(1 => 'January', 'February', 'March');
  19325. print_r($firstquarter);
  19326.  
  19327. /* output:
  19328. Array 
  19329. (
  19330.     [1] => 'January'
  19331.     [2] => 'February'
  19332.     [3] => 'March'
  19333. )
  19334. */
  19335. ?></PRE
  19336. ></TD
  19337. ></TR
  19338. ></TABLE
  19339. ></DIV
  19340. ></TD
  19341. ></TR
  19342. ></TABLE
  19343. >
  19344.     </P
  19345. ><TABLE
  19346. WIDTH="100%"
  19347. BORDER="0"
  19348. CELLPADDING="0"
  19349. CELLSPACING="0"
  19350. CLASS="EXAMPLE"
  19351. ><TR
  19352. ><TD
  19353. ><DIV
  19354. CLASS="example"
  19355. ><A
  19356. NAME="AEN3856"
  19357. ></A
  19358. ><P
  19359. ><B
  19360. >P°φklad 6-8. Filling an array</B
  19361. ></P
  19362. ><TABLE
  19363. BORDER="0"
  19364. BGCOLOR="#E0E0E0"
  19365. CELLPADDING="5"
  19366. ><TR
  19367. ><TD
  19368. ><PRE
  19369. CLASS="php"
  19370. ><?php
  19371. // fill an array with all items from a directory
  19372. $handle = opendir('.');
  19373. while (false !== ($file = readdir($handle))) {
  19374.     $files[] = $file;
  19375. }
  19376. closedir($handle); 
  19377. ?></PRE
  19378. ></TD
  19379. ></TR
  19380. ></TABLE
  19381. ></DIV
  19382. ></TD
  19383. ></TR
  19384. ></TABLE
  19385. ><P
  19386. >      Arrays are ordered. You can also change the order using various
  19387.      sorting functions. See the <A
  19388. HREF="#ref.array"
  19389. >array
  19390.      functions</A
  19391. > section for more information. You can count
  19392.      the number of items in an array using the
  19393.      <A
  19394. HREF="#function.count"
  19395. ><B
  19396. CLASS="function"
  19397. >count()</B
  19398. ></A
  19399. > function.
  19400.     </P
  19401. ><TABLE
  19402. WIDTH="100%"
  19403. BORDER="0"
  19404. CELLPADDING="0"
  19405. CELLSPACING="0"
  19406. CLASS="EXAMPLE"
  19407. ><TR
  19408. ><TD
  19409. ><DIV
  19410. CLASS="example"
  19411. ><A
  19412. NAME="AEN3862"
  19413. ></A
  19414. ><P
  19415. ><B
  19416. >P°φklad 6-9. Sorting an array</B
  19417. ></P
  19418. ><TABLE
  19419. BORDER="0"
  19420. BGCOLOR="#E0E0E0"
  19421. CELLPADDING="5"
  19422. ><TR
  19423. ><TD
  19424. ><PRE
  19425. CLASS="php"
  19426. ><?php
  19427. sort($files);
  19428. print_r($files);
  19429. ?></PRE
  19430. ></TD
  19431. ></TR
  19432. ></TABLE
  19433. ></DIV
  19434. ></TD
  19435. ></TR
  19436. ></TABLE
  19437. ><P
  19438. >      Because the value of an array can be anything, it can also be
  19439.      another array. This way you can make recursive and
  19440.      multi-dimensional arrays.
  19441.     </P
  19442. ><TABLE
  19443. WIDTH="100%"
  19444. BORDER="0"
  19445. CELLPADDING="0"
  19446. CELLSPACING="0"
  19447. CLASS="EXAMPLE"
  19448. ><TR
  19449. ><TD
  19450. ><DIV
  19451. CLASS="example"
  19452. ><A
  19453. NAME="AEN3866"
  19454. ></A
  19455. ><P
  19456. ><B
  19457. >P°φklad 6-10. Recursive and multi-dimensional arrays</B
  19458. ></P
  19459. ><TABLE
  19460. BORDER="0"
  19461. BGCOLOR="#E0E0E0"
  19462. CELLPADDING="5"
  19463. ><TR
  19464. ><TD
  19465. ><PRE
  19466. CLASS="php"
  19467. ><?php
  19468. $fruits = array ( "fruits"  => array ( "a" => "orange",
  19469.                                        "b" => "banana",
  19470.                                        "c" => "apple"
  19471.                                      ),
  19472.                   "numbers" => array ( 1,
  19473.                                        2,
  19474.                                        3,
  19475.                                        4,
  19476.                                        5,
  19477.                                        6
  19478.                                      ),
  19479.                   "holes"   => array (      "first",
  19480.                                        5 => "second",
  19481.                                             "third"
  19482.                                      )
  19483.                 );
  19484.  
  19485. // Some examples to address values in the array above 
  19486. echo $fruits["holes"][5];    // prints "second"
  19487. echo $fruits["fruits"]["a"]; // prints "orange"
  19488. unset($fruits["holes"][0]);  // remove "first"
  19489.  
  19490. // Create a new multi-dimensional array
  19491. $juices["apple"]["green"] = "good"; 
  19492. ?></PRE
  19493. ></TD
  19494. ></TR
  19495. ></TABLE
  19496. ></DIV
  19497. ></TD
  19498. ></TR
  19499. ></TABLE
  19500. ><P
  19501. >      You should be aware that array assignment always involves
  19502.      value copying. You need to use the reference operator to copy
  19503.      an array by reference.
  19504.      <DIV
  19505. CLASS="informalexample"
  19506. ><A
  19507. NAME="AEN3870"
  19508. ></A
  19509. ><P
  19510. ></P
  19511. ><TABLE
  19512. BORDER="0"
  19513. BGCOLOR="#E0E0E0"
  19514. CELLPADDING="5"
  19515. ><TR
  19516. ><TD
  19517. ><PRE
  19518. CLASS="php"
  19519. ><?php
  19520. $arr1 = array(2, 3);
  19521. $arr2 = $arr1;
  19522. $arr2[] = 4; // $arr2 is changed,
  19523.              // $arr1 is still array(2, 3)
  19524.              
  19525. $arr3 = &$arr1;
  19526. $arr3[] = 4; // now $arr1 and $arr3 are the same
  19527. ?></PRE
  19528. ></TD
  19529. ></TR
  19530. ></TABLE
  19531. ><P
  19532. ></P
  19533. ></DIV
  19534. >
  19535.     </P
  19536. ></DIV
  19537. ></DIV
  19538. ><DIV
  19539. CLASS="sect1"
  19540. ><HR><H2
  19541. CLASS="sect1"
  19542. ><A
  19543. NAME="language.types.object"
  19544. ></A
  19545. >Objects</H2
  19546. ><DIV
  19547. CLASS="sect2"
  19548. ><H3
  19549. CLASS="sect2"
  19550. ><A
  19551. NAME="language.types.object.init"
  19552. ></A
  19553. >Object Initialization</H3
  19554. ><P
  19555. >      To initialize an object, you use the <TT
  19556. CLASS="literal"
  19557. >new</TT
  19558. >
  19559.      statement to instantiate the object to a variable.
  19560.  
  19561.      <DIV
  19562. CLASS="informalexample"
  19563. ><A
  19564. NAME="AEN3878"
  19565. ></A
  19566. ><P
  19567. ></P
  19568. ><TABLE
  19569. BORDER="0"
  19570. BGCOLOR="#E0E0E0"
  19571. CELLPADDING="5"
  19572. ><TR
  19573. ><TD
  19574. ><PRE
  19575. CLASS="php"
  19576. ><?php
  19577. class foo
  19578. {
  19579.     function do_foo()
  19580.     {
  19581.         echo "Doing foo."; 
  19582.     }
  19583. }
  19584.  
  19585. $bar = new foo;
  19586. $bar->do_foo();
  19587. ?></PRE
  19588. ></TD
  19589. ></TR
  19590. ></TABLE
  19591. ><P
  19592. ></P
  19593. ></DIV
  19594. >
  19595.     </P
  19596. ><P
  19597. >      For a full discussion, please read the section <A
  19598. HREF="#language.oop"
  19599. >Classes and Objects</A
  19600. >.
  19601.     </P
  19602. ></DIV
  19603. ><DIV
  19604. CLASS="sect2"
  19605. ><HR><H3
  19606. CLASS="sect2"
  19607. ><A
  19608. NAME="language.types.object.casting"
  19609. ></A
  19610. >Converting to object</H3
  19611. ><P
  19612. >      If an object is converted to an object, it is not modified. If a value
  19613.      of any other type is converted to an object, a new instance of the
  19614.      <TT
  19615. CLASS="literal"
  19616. >stdClass</TT
  19617. > built in class is created. If the value
  19618.      was null, the new instance will be empty. For any other value, a
  19619.      member variable named <TT
  19620. CLASS="literal"
  19621. >scalar</TT
  19622. > will contain the
  19623.      value.
  19624.      <DIV
  19625. CLASS="informalexample"
  19626. ><A
  19627. NAME="AEN3887"
  19628. ></A
  19629. ><P
  19630. ></P
  19631. ><TABLE
  19632. BORDER="0"
  19633. BGCOLOR="#E0E0E0"
  19634. CELLPADDING="5"
  19635. ><TR
  19636. ><TD
  19637. ><PRE
  19638. CLASS="php"
  19639. ><?php
  19640. $obj = (object) 'ciao';
  19641. echo $obj->scalar;  // outputs 'ciao'
  19642. ?></PRE
  19643. ></TD
  19644. ></TR
  19645. ></TABLE
  19646. ><P
  19647. ></P
  19648. ></DIV
  19649. >
  19650.     </P
  19651. ></DIV
  19652. ></DIV
  19653. ><DIV
  19654. CLASS="sect1"
  19655. ><HR><H2
  19656. CLASS="sect1"
  19657. ><A
  19658. NAME="language.types.resource"
  19659. ></A
  19660. >Resource</H2
  19661. ><P
  19662. >      A resource is a special variable, holding
  19663.      a reference to an external resource. Resources
  19664.      are created and used by special functions.
  19665.      See the <A
  19666. HREF="#resource"
  19667. >appendix</A
  19668.      for a listing of all these
  19669.      functions and the corresponding resource types.
  19670.     </P
  19671. ><DIV
  19672. CLASS="note"
  19673. ><BLOCKQUOTE
  19674. CLASS="note"
  19675. ><P
  19676. ><B
  19677. >Poznßmka: </B
  19678. >
  19679.       The resource type was introduced in PHP 4
  19680.      </P
  19681. ></BLOCKQUOTE
  19682. ></DIV
  19683. ><DIV
  19684. CLASS="sect2"
  19685. ><HR><H3
  19686. CLASS="sect2"
  19687. ><A
  19688. NAME="language.types.resource.casting"
  19689. ></A
  19690. >Converting to resource</H3
  19691. ><P
  19692. >      As resource types hold special handlers to opened
  19693.      files, database connections, image canvas areas and
  19694.      the like, you cannot convert any value to a resource.
  19695.     </P
  19696. ></DIV
  19697. ><DIV
  19698. CLASS="sect2"
  19699. ><HR><H3
  19700. CLASS="sect2"
  19701. ><A
  19702. NAME="language.types.resource.self-destruct"
  19703. ></A
  19704. >Freeing resources</H3
  19705. ><P
  19706. >      Due to the reference-counting system introduced
  19707.      with PHP 4's Zend-engine, it is automatically detected
  19708.      when a resource is no longer referred to (just
  19709.      like Java). When this is
  19710.      the case, all resources that were in use for this 
  19711.      resource are made free by the garbage collector.
  19712.      For this reason, it is rarely ever necessary to
  19713.      free the memory manually by using some free_result
  19714.      function.
  19715.      <DIV
  19716. CLASS="note"
  19717. ><BLOCKQUOTE
  19718. CLASS="note"
  19719. ><P
  19720. ><B
  19721. >Poznßmka: </B
  19722. >
  19723.        Persistent database links are special, they 
  19724.        are <SPAN
  19725. CLASS="emphasis"
  19726. ><I
  19727. CLASS="emphasis"
  19728. >not</I
  19729. ></SPAN
  19730. > destroyed by the 
  19731.        garbage collector. See also the section about <A
  19732. HREF="#features.persistent-connections"
  19733. >persistent 
  19734.        connections</A
  19735. >.
  19736.       </P
  19737. ></BLOCKQUOTE
  19738. ></DIV
  19739. >
  19740.     </P
  19741. ></DIV
  19742. ></DIV
  19743. ><DIV
  19744. CLASS="sect1"
  19745. ><HR><H2
  19746. CLASS="sect1"
  19747. ><A
  19748. NAME="language.types.null"
  19749. ></A
  19750. >NULL</H2
  19751. ><P
  19752. >     The special <TT
  19753. CLASS="constant"
  19754. ><B
  19755. >NULL</B
  19756. ></TT
  19757. > value represents 
  19758.     that a variable has no value. <TT
  19759. CLASS="constant"
  19760. ><B
  19761. >NULL</B
  19762. ></TT
  19763. > is the only possible value of type
  19764.     <A
  19765. HREF="#language.types.null"
  19766. ><B
  19767. CLASS="type"
  19768. >NULL</B
  19769. ></A
  19770. >.
  19771.    </P
  19772. ><DIV
  19773. CLASS="note"
  19774. ><BLOCKQUOTE
  19775. CLASS="note"
  19776. ><P
  19777. ><B
  19778. >Poznßmka: </B
  19779. >
  19780.       The null type was introduced in PHP 4
  19781.      </P
  19782. ></BLOCKQUOTE
  19783. ></DIV
  19784. ><P
  19785. >      A variable is considered to be <TT
  19786. CLASS="constant"
  19787. ><B
  19788. >NULL</B
  19789. ></TT
  19790. > if
  19791.      <P
  19792. ></P
  19793. ><UL
  19794. ><LI
  19795. ><P
  19796. >         it has been assigned the constant <TT
  19797. CLASS="constant"
  19798. ><B
  19799. >NULL</B
  19800. ></TT
  19801. >.
  19802.        </P
  19803. ></LI
  19804. ><LI
  19805. ><P
  19806. >         it has not been set to any value yet.
  19807.        </P
  19808. ></LI
  19809. ><LI
  19810. ><P
  19811. >         it has been <A
  19812. HREF="#function.unset"
  19813. ><B
  19814. CLASS="function"
  19815. >unset()</B
  19816. ></A
  19817. >.
  19818.        </P
  19819. ></LI
  19820. ></UL
  19821. >
  19822.     </P
  19823. ><DIV
  19824. CLASS="sect2"
  19825. ><HR><H3
  19826. CLASS="sect2"
  19827. ><A
  19828. NAME="language.types.null.syntax"
  19829. ></A
  19830. >Syntax</H3
  19831. ><P
  19832. >      There is only one value of type <TT
  19833. CLASS="constant"
  19834. ><B
  19835. >NULL</B
  19836. ></TT
  19837. >, and that is 
  19838.      the case-insensitive keyword <TT
  19839. CLASS="constant"
  19840. ><B
  19841. >NULL</B
  19842. ></TT
  19843. >.
  19844.      <DIV
  19845. CLASS="informalexample"
  19846. ><A
  19847. NAME="AEN3929"
  19848. ></A
  19849. ><P
  19850. ></P
  19851. ><TABLE
  19852. BORDER="0"
  19853. BGCOLOR="#E0E0E0"
  19854. CELLPADDING="5"
  19855. ><TR
  19856. ><TD
  19857. ><PRE
  19858. CLASS="php"
  19859. ><?php
  19860. $var = NULL;       
  19861. ?></PRE
  19862. ></TD
  19863. ></TR
  19864. ></TABLE
  19865. ><P
  19866. ></P
  19867. ></DIV
  19868. >
  19869.     </P
  19870. ><P
  19871. >      See also <A
  19872. HREF="#function.is-null"
  19873. ><B
  19874. CLASS="function"
  19875. >is_null()</B
  19876. ></A
  19877. > and <A
  19878. HREF="#function.unset"
  19879. ><B
  19880. CLASS="function"
  19881. >unset()</B
  19882. ></A
  19883. >.
  19884.     </P
  19885. ></DIV
  19886. ></DIV
  19887. ><DIV
  19888. CLASS="sect1"
  19889. ><HR><H2
  19890. CLASS="sect1"
  19891. ><A
  19892. NAME="language.pseudo-types"
  19893. ></A
  19894. >Pseudo-types used in this documentation</H2
  19895. ><DIV
  19896. CLASS="sect2"
  19897. ><H3
  19898. CLASS="sect2"
  19899. ><A
  19900. NAME="language.types.mixed"
  19901. ></A
  19902. >mixed</H3
  19903. ><P
  19904. >      <TT
  19905. CLASS="literal"
  19906. >mixed</TT
  19907. > indicates that a parameter may accept multiple (but not
  19908.      necessarily all) types.
  19909.     </P
  19910. ><P
  19911. >      <A
  19912. HREF="#function.gettype"
  19913. ><B
  19914. CLASS="function"
  19915. >gettype()</B
  19916. ></A
  19917. > for example will accept all PHP types,
  19918.      while <A
  19919. HREF="#function.str-replace"
  19920. ><B
  19921. CLASS="function"
  19922. >str_replace()</B
  19923. ></A
  19924. > will accept strings and arrays.
  19925.     </P
  19926. ></DIV
  19927. ><DIV
  19928. CLASS="sect2"
  19929. ><HR><H3
  19930. CLASS="sect2"
  19931. ><A
  19932. NAME="language.types.number"
  19933. ></A
  19934. >number</H3
  19935. ><P
  19936. >      <TT
  19937. CLASS="literal"
  19938. >number</TT
  19939. > indicates that a parameter can be either
  19940.      <A
  19941. HREF="#language.types.integer"
  19942. ><B
  19943. CLASS="type"
  19944. >integer</B
  19945. ></A
  19946. > or <A
  19947. HREF="#language.types.float"
  19948. ><B
  19949. CLASS="type"
  19950. >float</B
  19951. ></A
  19952. >.
  19953.     </P
  19954. ></DIV
  19955. ><DIV
  19956. CLASS="sect2"
  19957. ><HR><H3
  19958. CLASS="sect2"
  19959. ><A
  19960. NAME="language.types.callback"
  19961. ></A
  19962. >callback</H3
  19963. ><P
  19964. >      Some functions like <A
  19965. HREF="#function.call-user-func"
  19966. ><B
  19967. CLASS="function"
  19968. >call_user_func()</B
  19969. ></A
  19970.      or <A
  19971. HREF="#function.usort"
  19972. ><B
  19973. CLASS="function"
  19974. >usort()</B
  19975. ></A
  19976. > accept user defined 
  19977.      callback functions as a parameter. Callback functions can not only
  19978.      be simple functions but also object methods including static class
  19979.      methods. 
  19980.     </P
  19981. ><P
  19982. >      A PHP function is simply passed by its name as a string. You can
  19983.      pass any builtin or user defined function with the exception of 
  19984.      <A
  19985. HREF="#function.array"
  19986. ><B
  19987. CLASS="function"
  19988. >array()</B
  19989. ></A
  19990. >, 
  19991.      <A
  19992. HREF="#function.echo"
  19993. ><B
  19994. CLASS="function"
  19995. >echo()</B
  19996. ></A
  19997. >, 
  19998.      <A
  19999. HREF="#function.empty"
  20000. ><B
  20001. CLASS="function"
  20002. >empty()</B
  20003. ></A
  20004. >, 
  20005.      <A
  20006. HREF="#function.eval"
  20007. ><B
  20008. CLASS="function"
  20009. >eval()</B
  20010. ></A
  20011. >, 
  20012.      <A
  20013. HREF="#function.exit"
  20014. ><B
  20015. CLASS="function"
  20016. >exit()</B
  20017. ></A
  20018. >, 
  20019.      <A
  20020. HREF="#function.isset"
  20021. ><B
  20022. CLASS="function"
  20023. >isset()</B
  20024. ></A
  20025. >, 
  20026.      <A
  20027. HREF="#function.list"
  20028. ><B
  20029. CLASS="function"
  20030. >list()</B
  20031. ></A
  20032. >, 
  20033.      <A
  20034. HREF="#function.print"
  20035. ><B
  20036. CLASS="function"
  20037. >print()</B
  20038. ></A
  20039. > and 
  20040.      <A
  20041. HREF="#function.unset"
  20042. ><B
  20043. CLASS="function"
  20044. >unset()</B
  20045. ></A
  20046. >.
  20047.     </P
  20048. ><P
  20049. >      A method of an instantiated object is passed as an array containing
  20050.      an object as the element with index 0 and a method name as the 
  20051.      element with index 1.
  20052.     </P
  20053. ><P
  20054. >      Static class methods can also be passed without instantiating an
  20055.      object of that class by passing the class name instead of an 
  20056.      object as the element with index 0.
  20057.     </P
  20058. ><P
  20059. >      <TABLE
  20060. WIDTH="100%"
  20061. BORDER="0"
  20062. CELLPADDING="0"
  20063. CELLSPACING="0"
  20064. CLASS="EXAMPLE"
  20065. ><TR
  20066. ><TD
  20067. ><DIV
  20068. CLASS="example"
  20069. ><A
  20070. NAME="AEN3967"
  20071. ></A
  20072. ><P
  20073. ><B
  20074. >P°φklad 6-11. 
  20075.        Callback function examples
  20076.       </B
  20077. ></P
  20078. ><TABLE
  20079. BORDER="0"
  20080. BGCOLOR="#E0E0E0"
  20081. CELLPADDING="5"
  20082. ><TR
  20083. ><TD
  20084. ><PRE
  20085. CLASS="php"
  20086. ><?php 
  20087.  
  20088. // simple callback example
  20089. function my_callback_function() {
  20090.     echo 'hello world!';
  20091. }
  20092. call_user_func('my_callback_function'); 
  20093.  
  20094. // method callback examples
  20095. class MyClass {
  20096.     function myCallbackMethod() {
  20097.         echo 'Hello World!';
  20098.     }
  20099. }
  20100.  
  20101. // static class method call without instantiating an object
  20102. call_user_func(array('MyClass', 'myCallbackMethod')); 
  20103.  
  20104. // object method call
  20105. $obj = new MyClass();
  20106. call_user_func(array(&$obj, 'myCallbackMethod'));
  20107. ?></PRE
  20108. ></TD
  20109. ></TR
  20110. ></TABLE
  20111. ></DIV
  20112. ></TD
  20113. ></TR
  20114. ></TABLE
  20115. >
  20116.     </P
  20117. ></DIV
  20118. ></DIV
  20119. ><DIV
  20120. CLASS="sect1"
  20121. ><HR><H2
  20122. CLASS="sect1"
  20123. ><A
  20124. NAME="language.types.type-juggling"
  20125. ></A
  20126. >Type Juggling</H2
  20127. ><P
  20128. >     PHP does not require (or support) explicit type definition in
  20129.     variable declaration; a variable's type is determined by the
  20130.     context in which that variable is used. That is to say, if you
  20131.     assign a string value to variable <TT
  20132. CLASS="parameter"
  20133. ><I
  20134. >$var</I
  20135. ></TT
  20136. >,
  20137.     <TT
  20138. CLASS="parameter"
  20139. ><I
  20140. >$var</I
  20141. ></TT
  20142. > becomes a string. If you then assign an
  20143.     integer value to <TT
  20144. CLASS="parameter"
  20145. ><I
  20146. >$var</I
  20147. ></TT
  20148. >, it becomes an
  20149.     integer.
  20150.    </P
  20151. ><P
  20152. >     An example of PHP's automatic type conversion is the addition
  20153.     operator '+'. If any of the operands is a float, then all
  20154.     operands are evaluated as floats, and the result will be a
  20155.     float. Otherwise, the operands will be interpreted as integers,
  20156.     and the result will also be an integer. Note that this does NOT
  20157.     change the types of the operands themselves; the only change is in
  20158.     how the operands are evaluated.
  20159.     <DIV
  20160. CLASS="informalexample"
  20161. ><A
  20162. NAME="AEN3977"
  20163. ></A
  20164. ><P
  20165. ></P
  20166. ><TABLE
  20167. BORDER="0"
  20168. BGCOLOR="#E0E0E0"
  20169. CELLPADDING="5"
  20170. ><TR
  20171. ><TD
  20172. ><PRE
  20173. CLASS="php"
  20174. ><?php
  20175. $foo = "0";  // $foo is string (ASCII 48)
  20176. $foo += 2;   // $foo is now an integer (2)
  20177. $foo = $foo + 1.3;  // $foo is now a float (3.3)
  20178. $foo = 5 + "10 Little Piggies"; // $foo is integer (15)
  20179. $foo = 5 + "10 Small Pigs";     // $foo is integer (15)
  20180. ?></PRE
  20181. ></TD
  20182. ></TR
  20183. ></TABLE
  20184. ><P
  20185. ></P
  20186. ></DIV
  20187. >
  20188.    </P
  20189. ><P
  20190. >     If the last two examples above seem odd, see <A
  20191. HREF="#language.types.string.conversion"
  20192. >String
  20193.     conversion to numbers</A
  20194. >.
  20195.    </P
  20196. ><P
  20197. >     If you wish to force a variable to be evaluated as a certain type,
  20198.     see the section on <A
  20199. HREF="#language.types.typecasting"
  20200. >Type
  20201.     casting</A
  20202. >. If you wish to change the type of a variable, see
  20203.     <A
  20204. HREF="#function.settype"
  20205. ><B
  20206. CLASS="function"
  20207. >settype()</B
  20208. ></A
  20209. >.
  20210.    </P
  20211. ><P
  20212. >     If you would like to test any of the examples in this section, you
  20213.     can use the <A
  20214. HREF="#function.var-dump"
  20215. ><B
  20216. CLASS="function"
  20217. >var_dump()</B
  20218. ></A
  20219. > function.
  20220.    </P
  20221. ><DIV
  20222. CLASS="note"
  20223. ><BLOCKQUOTE
  20224. CLASS="note"
  20225. ><P
  20226. ><B
  20227. >Poznßmka: </B
  20228. >
  20229.      The behaviour of an automatic conversion to array is currently
  20230.      undefined.
  20231.     </P
  20232. ><P
  20233. >      <DIV
  20234. CLASS="informalexample"
  20235. ><A
  20236. NAME="AEN3989"
  20237. ></A
  20238. ><P
  20239. ></P
  20240. ><TABLE
  20241. BORDER="0"
  20242. BGCOLOR="#E0E0E0"
  20243. CELLPADDING="5"
  20244. ><TR
  20245. ><TD
  20246. ><PRE
  20247. CLASS="php"
  20248. ><?php
  20249. $a = "1";     // $a is a string
  20250. $a[0] = "f";  // What about string offsets? What happens?
  20251. ?></PRE
  20252. ></TD
  20253. ></TR
  20254. ></TABLE
  20255. ><P
  20256. ></P
  20257. ></DIV
  20258. >
  20259.     </P
  20260. ><P
  20261. >      Since PHP (for historical reasons) supports indexing into strings
  20262.      via offsets using the same syntax as array indexing, the example
  20263.      above leads to a problem: should $a become an array with its first
  20264.      element being "f", or should "f" become the first character of the
  20265.      string $a?
  20266.     </P
  20267. ><P
  20268. >      The current versions of PHP interpret the second assignment as
  20269.      a string offset identification, so $a becomes "f", the result
  20270.      of this automatic conversion however should be considered
  20271.      undefined. PHP 4 introduced the new curly bracket syntax to access
  20272.      characters in string, use this syntax instead of the one presented
  20273.      above: 
  20274.      <DIV
  20275. CLASS="informalexample"
  20276. ><A
  20277. NAME="AEN3993"
  20278. ></A
  20279. ><P
  20280. ></P
  20281. ><TABLE
  20282. BORDER="0"
  20283. BGCOLOR="#E0E0E0"
  20284. CELLPADDING="5"
  20285. ><TR
  20286. ><TD
  20287. ><PRE
  20288. CLASS="php"
  20289. ><?php
  20290. $a    = "abc"; // $a is a string
  20291. $a{1} = "f";   // $a is now "afc"
  20292. ?></PRE
  20293. ></TD
  20294. ></TR
  20295. ></TABLE
  20296. ><P
  20297. ></P
  20298. ></DIV
  20299. >
  20300.      See the section titled <A
  20301. HREF="#language.types.string.substr"
  20302. >String
  20303.      access by character</A
  20304. > for more information.
  20305.     </P
  20306. ></BLOCKQUOTE
  20307. ></DIV
  20308. ><DIV
  20309. CLASS="sect2"
  20310. ><HR><H3
  20311. CLASS="sect2"
  20312. ><A
  20313. NAME="language.types.typecasting"
  20314. ></A
  20315. >Type Casting</H3
  20316. ><P
  20317. >      Type casting in PHP works much as it does in C: the name of the
  20318.      desired type is written in parentheses before the variable which
  20319.      is to be cast.
  20320.      <DIV
  20321. CLASS="informalexample"
  20322. ><A
  20323. NAME="AEN3999"
  20324. ></A
  20325. ><P
  20326. ></P
  20327. ><TABLE
  20328. BORDER="0"
  20329. BGCOLOR="#E0E0E0"
  20330. CELLPADDING="5"
  20331. ><TR
  20332. ><TD
  20333. ><PRE
  20334. CLASS="php"
  20335. ><?php
  20336. $foo = 10;   // $foo is an integer
  20337. $bar = (boolean) $foo;   // $bar is a boolean
  20338. ?></PRE
  20339. ></TD
  20340. ></TR
  20341. ></TABLE
  20342. ><P
  20343. ></P
  20344. ></DIV
  20345. >
  20346.     </P
  20347. ><P
  20348. >      The casts allowed are:
  20349.      <P
  20350. ></P
  20351. ><UL
  20352. ><LI
  20353. ><P
  20354. >(int), (integer) - cast to integer</P
  20355. ></LI
  20356. ><LI
  20357. ><P
  20358. >(bool), (boolean) - cast to boolean</P
  20359. ></LI
  20360. ><LI
  20361. ><P
  20362. >(float), (double), (real) - cast to float</P
  20363. ></LI
  20364. ><LI
  20365. ><P
  20366. >(string) - cast to string</P
  20367. ></LI
  20368. ><LI
  20369. ><P
  20370. >(array) - cast to array</P
  20371. ></LI
  20372. ><LI
  20373. ><P
  20374. >(object) - cast to object</P
  20375. ></LI
  20376. ></UL
  20377. >
  20378.     </P
  20379. ><P
  20380. >      Note that tabs and spaces are allowed inside the parentheses, so
  20381.      the following are functionally equivalent:
  20382.      <DIV
  20383. CLASS="informalexample"
  20384. ><A
  20385. NAME="AEN4016"
  20386. ></A
  20387. ><P
  20388. ></P
  20389. ><TABLE
  20390. BORDER="0"
  20391. BGCOLOR="#E0E0E0"
  20392. CELLPADDING="5"
  20393. ><TR
  20394. ><TD
  20395. ><PRE
  20396. CLASS="php"
  20397. ><?php
  20398. $foo = (int) $bar;
  20399. $foo = ( int ) $bar;
  20400. ?></PRE
  20401. ></TD
  20402. ></TR
  20403. ></TABLE
  20404. ><P
  20405. ></P
  20406. ></DIV
  20407. >
  20408.     </P
  20409. ><DIV
  20410. CLASS="note"
  20411. ><BLOCKQUOTE
  20412. CLASS="note"
  20413. ><P
  20414. ><B
  20415. >Poznßmka: </B
  20416. >
  20417.       Instead of casting a variable to string, you can also enclose
  20418.       the variable in double quotes.
  20419.      <DIV
  20420. CLASS="informalexample"
  20421. ><A
  20422. NAME="AEN4020"
  20423. ></A
  20424. ><P
  20425. ></P
  20426. ><TABLE
  20427. BORDER="0"
  20428. BGCOLOR="#E0E0E0"
  20429. CELLPADDING="5"
  20430. ><TR
  20431. ><TD
  20432. ><PRE
  20433. CLASS="php"
  20434. ><?php
  20435. $foo = 10;            // $foo is an integer
  20436. $str = "$foo";        // $str is a string
  20437. $fst = (string) $foo; // $fst is also a string
  20438.  
  20439. // This prints out that "they are the same"
  20440. if ($fst === $str) {
  20441.     echo "they are the same";
  20442. }
  20443. ?></PRE
  20444. ></TD
  20445. ></TR
  20446. ></TABLE
  20447. ><P
  20448. ></P
  20449. ></DIV
  20450. >
  20451.      </P
  20452. ></BLOCKQUOTE
  20453. ></DIV
  20454. ><P
  20455. >      It may not be obvious exactly what will happen when casting
  20456.      between certain types. For more info, see these sections:
  20457.     
  20458.      <P
  20459. ></P
  20460. ><UL
  20461. ><LI
  20462. ><P
  20463. ><A
  20464. HREF="#language.types.boolean.casting"
  20465. >Converting to 
  20466.         boolean</A
  20467. ></P
  20468. ></LI
  20469. ><LI
  20470. ><P
  20471. ><A
  20472. HREF="#language.types.integer.casting"
  20473. >Converting to 
  20474.         integer</A
  20475. ></P
  20476. ></LI
  20477. ><LI
  20478. ><P
  20479. ><A
  20480. HREF="#language.types.float.casting"
  20481. >Converting to 
  20482.         float</A
  20483. ></P
  20484. ></LI
  20485. ><LI
  20486. ><P
  20487. ><A
  20488. HREF="#language.types.string.casting"
  20489. >Converting to 
  20490.         string</A
  20491. ></P
  20492. ></LI
  20493. ><LI
  20494. ><P
  20495. ><A
  20496. HREF="#language.types.array.casting"
  20497. >Converting to 
  20498.         array</A
  20499. ></P
  20500. ></LI
  20501. ><LI
  20502. ><P
  20503. ><A
  20504. HREF="#language.types.object.casting"
  20505. >Converting to 
  20506.         object</A
  20507. ></P
  20508. ></LI
  20509. ><LI
  20510. ><P
  20511. ><A
  20512. HREF="#language.types.resource.casting"
  20513. >Converting to 
  20514.         resource</A
  20515. ></P
  20516. ></LI
  20517. ><LI
  20518. ><P
  20519. >         <A
  20520. HREF="#types.comparisons"
  20521. >The type comparison tables</A
  20522. >
  20523.        </P
  20524. ></LI
  20525. ></UL
  20526. >
  20527.     </P
  20528. ></DIV
  20529. ></DIV
  20530. ></DIV
  20531. ><DIV
  20532. CLASS="chapter"
  20533. ><HR><H1
  20534. ><A
  20535. NAME="language.variables"
  20536. >Kapitola 7. Prom∞nnΘ</A
  20537. ></H1
  20538. ><DIV
  20539. CLASS="sect1"
  20540. ><H2
  20541. CLASS="sect1"
  20542. ><A
  20543. NAME="language.variables.basics"
  20544. ></A
  20545. >Zßklady</H2
  20546. ><P
  20547. >     Prom∞nnΘ jsou v PHP reprezentovßny znakem dolaru, nßsledovan²m nßzvem
  20548.     p°φslu╣nΘ prom∞nnΘ. V nßzvech prom∞nn²ch se rozli╣uje velikost pφsmen.
  20549.    </P
  20550. ><P
  20551. >     Nßzvy prom∞nn²ch jsou pod°φzeny stejn²m pravidl∙m jako jinß nßv∞╣tφ
  20552.     v PHP. Platn² nßzev prom∞nnΘ zaΦφnß pφsmenem nebo podtr╛φtkem,
  20553.     nßsledovan²m libovoln²m poΦtem pφsmen, Φφslic nebo potr╛φtek. Jako
  20554.     regulßrnφ v²raz to lze zapsat takto:
  20555.     '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
  20556.    </P
  20557. ><DIV
  20558. CLASS="note"
  20559. ><BLOCKQUOTE
  20560. CLASS="note"
  20561. ><P
  20562. ><B
  20563. >Poznßmka: </B
  20564. >
  20565.      Pro na╣e ·Φely zde budeme za pφsmena pova╛ovat znaky a-z, A-Z
  20566.      a ASCII znaky od 127 do 255 (0x7f-0xff).
  20567.     </P
  20568. ></BLOCKQUOTE
  20569. ></DIV
  20570. ><P
  20571. >     <DIV
  20572. CLASS="informalexample"
  20573. ><A
  20574. NAME="AEN4057"
  20575. ></A
  20576. ><P
  20577. ></P
  20578. ><TABLE
  20579. BORDER="0"
  20580. BGCOLOR="#E0E0E0"
  20581. CELLPADDING="5"
  20582. ><TR
  20583. ><TD
  20584. ><PRE
  20585. CLASS="php"
  20586. >$var = "Bob";
  20587. $Var = "Joe";
  20588. echo "$var, $Var";      // vypφ╣e "Bob, Joe"
  20589.  
  20590. $4site = 'not yet';     // neplatnΘ; zaΦφnß Φφslicφ
  20591. $_4site = 'not yet';    // platnΘ; zaΦφnß podtr╛φtkem
  20592. $tΣyte = 'mansikka';    // platnΘ; 'Σ' je ASCII 228.</PRE
  20593. ></TD
  20594. ></TR
  20595. ></TABLE
  20596. ><P
  20597. ></P
  20598. ></DIV
  20599. >
  20600.    </P
  20601. ><P
  20602. >     V PHP 3 majφ prom∞nnΘ v╛dy p°i°azenu hodnotu. To znamenß, ╛e kdy╛
  20603.     p°i°adφte v²raz do prom∞nnΘ, celß hodnota p∙vodnφho v²razu se
  20604.     zkopφruje do cφlovΘ prom∞nnΘ. Tedy, nap°φklad, po p°i°azenφ hodnoty
  20605.     jednΘ prom∞nnΘ do druhΘ, zm∞na jednΘ z nich se na druhΘ neprojevφ.
  20606.     Vφce informacφ o tomto zp∙sobu p°i°azenφ viz
  20607.     <A
  20608. HREF="#language.expressions"
  20609. >V²razy</A
  20610. >.
  20611.    </P
  20612. ><P
  20613. >     PHP nabφzφ jin² zp∙sob p°i°azenφ hodnot prom∞nn²m:
  20614.     <SPAN
  20615. CLASS="emphasis"
  20616. ><I
  20617. CLASS="emphasis"
  20618. >p°i°azenφ odkazu</I
  20619. ></SPAN
  20620. >. To znamenß, ╛e novß prom∞nnß
  20621.     jednodu╣e odkazuje (jin²mi slovy, "stßvß se aliasem" nebo "ukazuje na")
  20622.     na p∙vodnφ prom∞nnou. Zm∞ny na novΘ prom∞nnΘ se projevφ na tΘ p∙vodnφ
  20623.     a naopak. To takΘ znamenß, ╛e se nic nekopφruje; proto je p°i°azenφ
  20624.     rychlej╣φ. Av╣ak toto zrychlenφ bude zjistitelnΘ pouze v t∞sn²ch cyklech
  20625.     nebo p°i p°i°azovßnφ velk²ch polφ Φi objekt∙.
  20626.    </P
  20627. ><P
  20628. >     Pro p°i°azenφ odkazu staΦφ jednodu╣e p°ed prom∞nnou, kterß bude
  20629.     p°i°azovßna (zdrojovß prom∞nnß), p°ed°adit ampersand (&). Nap°φklad
  20630.     nßsledujφcφ kus k≤du vypφ╣e dvakrßt 'Jmenuji se Bob':
  20631.  
  20632.     <DIV
  20633. CLASS="informalexample"
  20634. ><A
  20635. NAME="AEN4064"
  20636. ></A
  20637. ><P
  20638. ></P
  20639. ><TABLE
  20640. BORDER="0"
  20641. BGCOLOR="#E0E0E0"
  20642. CELLPADDING="5"
  20643. ><TR
  20644. ><TD
  20645. ><PRE
  20646. CLASS="php"
  20647. ><?php
  20648. $foo = 'Bob';              // P°i°adφ hodnotu 'Bob' do $foo
  20649. $bar = &$foo;              // Odkaz $foo p°es $bar.
  20650. $bar = "Jmenuji se $bar";  // Zm∞na $bar...
  20651. echo $bar;
  20652. echo $foo;                 // $foo je takΘ zm∞n∞no.
  20653. ?></PRE
  20654. ></TD
  20655. ></TR
  20656. ></TABLE
  20657. ><P
  20658. ></P
  20659. ></DIV
  20660. >
  20661.    </P
  20662. ><P
  20663. >     Jednou z d∙le╛it²ch v∞cφ, kterΘ je t°eba si uv∞domit, je to, ╛e p°es
  20664.     odkazy lze p°i°azovat pouze pojmenovanΘ prom∞nnΘ.
  20665.     <DIV
  20666. CLASS="informalexample"
  20667. ><A
  20668. NAME="AEN4067"
  20669. ></A
  20670. ><P
  20671. ></P
  20672. ><TABLE
  20673. BORDER="0"
  20674. BGCOLOR="#E0E0E0"
  20675. CELLPADDING="5"
  20676. ><TR
  20677. ><TD
  20678. ><PRE
  20679. CLASS="php"
  20680. ><?php
  20681. $foo = 25;
  20682. $bar = &$foo;      // Toto je platnΘ p°i°azenφ.
  20683. $bar = &(24 * 7);  // NeplatnΘ; odkazuje se nepojmenovan² v²raz.
  20684.  
  20685. function test()
  20686. {
  20687.    return 25;
  20688. }
  20689.  
  20690. $bar = &test();    // NeplatnΘ.
  20691. ?></PRE
  20692. ></TD
  20693. ></TR
  20694. ></TABLE
  20695. ><P
  20696. ></P
  20697. ></DIV
  20698. >
  20699.    </P
  20700. ></DIV
  20701. ><DIV
  20702. CLASS="sect1"
  20703. ><HR><H2
  20704. CLASS="sect1"
  20705. ><A
  20706. NAME="language.variables.predefined"
  20707. ></A
  20708. >P°eddefinovanΘ prom∞nnΘ</H2
  20709. ><P
  20710. >     PHP poskytuje velkΘ mno╛stvφ p°eddefinovan²ch prom∞nn²ch jakΘmukoli
  20711.     skriptu, kter² provßdφ. Mnoho t∞chto prom∞nn²ch, bohu╛el, nem∙╛e b²t
  20712.     pln∞ zdokumentovßno, proto╛e zßvisejφ na tom, na kterΘm serveru skript
  20713.     b∞╛φ, na verzi a nastavenφ serveru a dal╣φch faktorech. N∞kterΘ z t∞chto
  20714.     prom∞nn²ch nebudou dostupnΘ, kdy╛ PHP pob∞╛φ z p°φkazovΘ °ßdky. Seznam
  20715.     prom∞nn²ch - viz sekce 
  20716.     <A
  20717. HREF="#reserved.variables"
  20718. >P°eddefinovanΘ prom∞nnΘ</A
  20719. >.
  20720.    </P
  20721. ><DIV
  20722. CLASS="warning"
  20723. ><P
  20724. ></P
  20725. ><TABLE
  20726. CLASS="warning"
  20727. BORDER="1"
  20728. WIDTH="100%"
  20729. ><TR
  20730. ><TD
  20731. ALIGN="CENTER"
  20732. ><B
  20733. >Varovßnφ</B
  20734. ></TD
  20735. ></TR
  20736. ><TR
  20737. ><TD
  20738. ALIGN="LEFT"
  20739. ><P
  20740. >      V PHP 4.2.0 a pozd∞j╣φch se zm∞nila implicitnφ sada p°eddefinovan²ch
  20741.      prom∞nn²ch, kterΘ jsou globßln∞ dostupnΘ. Individußlnφ vstupnφ a
  20742.      serverovΘ prom∞nnΘ se <SPAN
  20743. CLASS="emphasis"
  20744. ><I
  20745. CLASS="emphasis"
  20746. >implicitn∞</I
  20747. ></SPAN
  20748. > neumφs╗ujφ do
  20749.      globßlnφho kontextu; namφsto toho jsou v nßsledujφcφch
  20750.      <A
  20751. HREF="#language.variables.superglobals"
  20752. >superglobßlnφch
  20753.      polφch</A
  20754. >.
  20755.     </P
  20756. ><P
  20757. >      M∙╛ete v╣ak stßle vynutit starΘ chovßnφ nastavenφm
  20758.      <A
  20759. HREF="#ini.register-globals"
  20760. >register_globals</A
  20761. > v souboru
  20762.      <TT
  20763. CLASS="filename"
  20764. >php.ini</TT
  20765. > na 'On'.
  20766.     </P
  20767. ><P
  20768. >      Pro vφce informacφ a pozadφ t∞chto zm∞n prosφm nahlΘdn∞te do
  20769.      <A
  20770. HREF="http://www.php.net/release_4_1_0.php"
  20771. TARGET="_top"
  20772. >PHP 4.1.0 Release Announcement</A
  20773. >.
  20774.     </P
  20775. ></TD
  20776. ></TR
  20777. ></TABLE
  20778. ></DIV
  20779. ><P
  20780. >     Od verze 4.1.0 poskytuje PHP sadu p°eddefinovan²ch polφ, obsahujφcφch
  20781.     prom∞nnΘ WWW serveru (pokud to jde), prost°edφ a u╛ivatelskΘho vstupu.
  20782.     Tato novß pole majφ tu zvlß╣tnost, ╛e jsou automaticky globßlnφ -- tedy
  20783.     nap°. automaticky dostupnΘ v ka╛dΘm kontextu. Z tohoto d∙vodu jsou
  20784.     Φasto znßma jako "autoglobßlnφ" nebo "superglobßlnφ". (V PHP neexistuje
  20785.     mechanismus pro u╛ivatelskou definici superglobßlnφch prom∞nn²ch).
  20786.     Superglobßlnφ prom∞nnΘ jsou vypsßny nφ╛e; pro seznam jejich obsah∙ a
  20787.     dal╣φ diskusi o p°eddefinovan²ch prom∞nn²ch v PHP a jejich charakteru
  20788.     v╣ak musφte nahlΘdnout do Φßsti 
  20789.     <A
  20790. HREF="#reserved.variables"
  20791. >P°eddefinovanΘ prom∞nnΘ</A
  20792. >.
  20793.    </P
  20794. ><P
  20795. ></P
  20796. ><DIV
  20797. CLASS="variablelist"
  20798. ><P
  20799. ><B
  20800. >PHP superglobals (superglobßlnφ prom∞nnΘ)</B
  20801. ></P
  20802. ><DL
  20803. ><DT
  20804. ><A
  20805. HREF="#reserved.variables.globals"
  20806. >$GLOBALS</A
  20807. ></DT
  20808. ><DD
  20809. ><P
  20810. >        Obsahuje odkaz na ka╛dou prom∞nnou, kterß je momentßln∞ dostupnß
  20811.        v globßlnφm kontextu skriptu. KlφΦi tohoto pole jsou nßzvy globßlnφch
  20812.        prom∞nn²ch.
  20813.       </P
  20814. ></DD
  20815. ><DT
  20816. ><A
  20817. HREF="#reserved.variables.server"
  20818. >$_SERVER</A
  20819. ></DT
  20820. ><DD
  20821. ><P
  20822. >        Prom∞nnΘ nastavovanΘ WWW serveru nebo jinak p°φmo spjatΘ s provßd∞cφm
  20823.        prost°edφm aktußlnφho skriptu. AnalogickΘ starΘmu poli
  20824.        <TT
  20825. CLASS="varname"
  20826. >$HTTP_SERVER_VARS</TT
  20827. > (kterΘ je stßle dostupnΘ, ale
  20828.        zavr╛enΘ).
  20829.       </P
  20830. ></DD
  20831. ><DT
  20832. ><A
  20833. HREF="#reserved.variables.get"
  20834. >$_GET</A
  20835. ></DT
  20836. ><DD
  20837. ><P
  20838. >        Prom∞nnΘ poskytovanΘ skriptu p°es HTTP GET. AnalogickΘ starΘmu poli
  20839.        <TT
  20840. CLASS="varname"
  20841. >$HTTP_GET_VARS</TT
  20842. > (kterΘ je stßle dostupnΘ, ale
  20843.        zavr╛enΘ).
  20844.       </P
  20845. ></DD
  20846. ><DT
  20847. ><A
  20848. HREF="#reserved.variables.post"
  20849. >$_POST</A
  20850. ></DT
  20851. ><DD
  20852. ><P
  20853. >        Prom∞nnΘ poskytovanΘ skriptu p°es HTTP POST. AnalogickΘ starΘmu poli
  20854.        <TT
  20855. CLASS="varname"
  20856. >$HTTP_POST_VARS</TT
  20857. > (kterΘ je stßle dostupnΘ, ale
  20858.        zavr╛enΘ).
  20859.       </P
  20860. ></DD
  20861. ><DT
  20862. ><A
  20863. HREF="#reserved.variables.cookies"
  20864. >$_COOKIE</A
  20865. ></DT
  20866. ><DD
  20867. ><P
  20868. >        Prom∞nnΘ poskytovanΘ skriptu p°es HTTP cookies. AnalogickΘ starΘmu poli
  20869.        <TT
  20870. CLASS="varname"
  20871. >$HTTP_COOKIE_VARS</TT
  20872. > (kterΘ je stßle dostupnΘ, ale
  20873.        zavr╛enΘ).
  20874.       </P
  20875. ></DD
  20876. ><DT
  20877. ><A
  20878. HREF="#reserved.variables.files"
  20879. >$_FILES</A
  20880. ></DT
  20881. ><DD
  20882. ><P
  20883. >        Prom∞nnΘ poskytovanΘ skriptu p°es HTTP post uploady soubor∙. AnalogickΘ
  20884.        uploads. AnalogickΘ starΘmu poli
  20885.        <TT
  20886. CLASS="varname"
  20887. >$HTTP_POST_FILES</TT
  20888. > (kterΘ je stßle dostupnΘ, ale
  20889.        zavr╛enΘ). Vφce informacφ - viz
  20890.        <A
  20891. HREF="#features.file-upload.post-method"
  20892. >Upload metodou
  20893.        POST</A
  20894. >.
  20895.       </P
  20896. ></DD
  20897. ><DT
  20898. ><A
  20899. HREF="#reserved.variables.environment"
  20900. >$_ENV</A
  20901. ></DT
  20902. ><DD
  20903. ><P
  20904. >Prom∞nnΘ poskytovanΘ skriptu z prost°edφ. AnalogickΘ starΘmu
  20905.       poli <TT
  20906. CLASS="varname"
  20907. >$HTTP_ENV_VARS</TT
  20908. > (kterΘ je stßle dostupnΘ, ale
  20909.        zavr╛enΘ).
  20910.       </P
  20911. ></DD
  20912. ><DT
  20913. ><A
  20914. HREF="#reserved.variables.request"
  20915. >$_REQUEST</A
  20916. ></DT
  20917. ><DD
  20918. ><P
  20919. >        Prom∞nnΘ poskytovanΘ skriptu p°es libovoln² vstupnφ mechanismus a
  20920.        kter²m proto nelze d∙v∞°ovat. Pozn.: p°i b∞hu z p°φkazovΘ °ßdky zde
  20921.        <SPAN
  20922. CLASS="emphasis"
  20923. ><I
  20924. CLASS="emphasis"
  20925. >nebudou</I
  20926. ></SPAN
  20927. > p°φtomny polo╛ky <TT
  20928. CLASS="varname"
  20929. >argv</TT
  20930. >
  20931.        a <TT
  20932. CLASS="varname"
  20933. >argc</TT
  20934. >; nachßzejφ se v poli
  20935.        <TT
  20936. CLASS="varname"
  20937. >$_SERVER</TT
  20938. >. P°φtomnost a po°adφ prom∞nn²ch v tomto
  20939.        poli se definuje podle konfiguraΦnφ direktivy
  20940.        <A
  20941. HREF="#ini.variables-order"
  20942. >variables_order</A
  20943. >. Toto pole
  20944.        nemß p°φmou analogii ve verzφch PHP p°ed 4.1.0.
  20945.       </P
  20946. ></DD
  20947. ><DT
  20948. ><A
  20949. HREF="#reserved.variables.session"
  20950. >$_SESSION</A
  20951. ></DT
  20952. ><DD
  20953. ><P
  20954. >        Prom∞nnΘ, kterΘ jsou momentßln∞ registrovßny v aktußlnφ relaci skriptu.
  20955.        AnalogickΘ starΘmu poli
  20956.        <TT
  20957. CLASS="varname"
  20958. >$HTTP_SESSION_VARS</TT
  20959. > (kterΘ je stßle dostupnΘ, ale
  20960.        zavr╛enΘ). Vφce informacφ - viz <A
  20961. HREF="#ref.session"
  20962. >Funkce pro obsluhu sessions</A
  20963. >.
  20964.       </P
  20965. ></DD
  20966. ></DL
  20967. ></DIV
  20968. ></DIV
  20969. ><DIV
  20970. CLASS="sect1"
  20971. ><HR><H2
  20972. CLASS="sect1"
  20973. ><A
  20974. NAME="language.variables.scope"
  20975. ></A
  20976. >Kontext ("scope") prom∞nnΘ</H2
  20977. ><P
  20978. >     Kontext prom∞nnΘ je oblast, ve kterΘ je definovßna. V∞t╣ina prom∞nn²ch
  20979.     v PHP mß pouze jedin² kontext. Ten zahrnuje i soubory vlo╛enΘ pomocφ
  20980.     "include" nebo "require". Nap°φklad:
  20981.    </P
  20982. ><DIV
  20983. CLASS="informalexample"
  20984. ><A
  20985. NAME="AEN4148"
  20986. ></A
  20987. ><P
  20988. ></P
  20989. ><TABLE
  20990. BORDER="0"
  20991. BGCOLOR="#E0E0E0"
  20992. CELLPADDING="5"
  20993. ><TR
  20994. ><TD
  20995. ><PRE
  20996. CLASS="php"
  20997. >$a = 1;
  20998. include "b.inc";</PRE
  20999. ></TD
  21000. ></TR
  21001. ></TABLE
  21002. ><P
  21003. ></P
  21004. ></DIV
  21005. ><P
  21006. >     Zde bude prom∞nnß <TT
  21007. CLASS="varname"
  21008. >$a</TT
  21009. > dostupnß ve vlo╛enΘm skriptu
  21010.     <TT
  21011. CLASS="filename"
  21012. >b.inc</TT
  21013. >. Av╣ak uvnit° u╛ivatelsky definovan²ch funkcφ
  21014.     se zaklßdß jejich lokßlnφ kontext. Jakßkoli prom∞nnß pou╛itß uvnit°
  21015.     funkce je implicitn∞ omezena na tento mφstnφ kontext. Nap°φklad:
  21016.    </P
  21017. ><DIV
  21018. CLASS="informalexample"
  21019. ><A
  21020. NAME="AEN4153"
  21021. ></A
  21022. ><P
  21023. ></P
  21024. ><TABLE
  21025. BORDER="0"
  21026. BGCOLOR="#E0E0E0"
  21027. CELLPADDING="5"
  21028. ><TR
  21029. ><TD
  21030. ><PRE
  21031. CLASS="php"
  21032. >$a = 1; /* globßlnφ kontext */ 
  21033.  
  21034. function Test()
  21035.     echo $a; /* odkaz na prom∞nnou v lokßlnφm kontextu */ 
  21036.  
  21037. Test();</PRE
  21038. ></TD
  21039. ></TR
  21040. ></TABLE
  21041. ><P
  21042. ></P
  21043. ></DIV
  21044. ><P
  21045. >     Tento skript nevyprodukuje ╛ßdn² v²stup, proto╛e konstrukt "echo"
  21046.     odkazuje na lokßlnφ verzi prom∞nnΘ <TT
  21047. CLASS="varname"
  21048. >$a</TT
  21049. >, a ta nemß
  21050.     v tomto kontextu p°i°azenu ╛ßdnou hodnotu. M∙╛ete si v╣imnout, ╛e to je
  21051.     trochu jinΘ ne╛ v jazyce C, kde jsou globßlnφ funkce automaticky
  21052.     dostupnΘ ve funkcφch, pokud nejsou specificky zastφn∞ny lokßlnφ definicφ.
  21053.     To m∙╛e zp∙sobit problΘmy tφm, ╛e Φlov∞k m∙╛e necht∞n∞ zm∞nit globßlnφ
  21054.     prom∞nnou. V PHP musφ b²t globßlnφ prom∞nnΘ deklarovßny uvnit° funkce
  21055.     jako globßlnφ, pokud se v nφ majφ pou╛φvat. P°φklad:
  21056.    </P
  21057. ><DIV
  21058. CLASS="informalexample"
  21059. ><A
  21060. NAME="AEN4157"
  21061. ></A
  21062. ><P
  21063. ></P
  21064. ><TABLE
  21065. BORDER="0"
  21066. BGCOLOR="#E0E0E0"
  21067. CELLPADDING="5"
  21068. ><TR
  21069. ><TD
  21070. ><PRE
  21071. CLASS="php"
  21072. >$a = 1;
  21073. $b = 2;
  21074.  
  21075. function Sum()
  21076. {
  21077.     global $a, $b;
  21078.  
  21079.     $b = $a + $b;
  21080.  
  21081. Sum();
  21082. echo $b;</PRE
  21083. ></TD
  21084. ></TR
  21085. ></TABLE
  21086. ><P
  21087. ></P
  21088. ></DIV
  21089. ><P
  21090. >     V²╣e uveden² skript vytiskne "3". Deklaracφ
  21091.     <TT
  21092. CLASS="varname"
  21093. >$a</TT
  21094. > a <TT
  21095. CLASS="varname"
  21096. >$b</TT
  21097. > ve funkci jako globßlnφch
  21098.     prom∞nn²ch se dosßhne toho, ╛e p°i odkazovßnφ na prom∞nnΘ se pracuje
  21099.     s jejich globßlnφ verzφ. PoΦet globßlnφch prom∞nn²ch, se kter²mi lze ve
  21100.     funkci manipulovat, nenφ omezen.
  21101.    </P
  21102. ><P
  21103. >     Druh²m zp∙sobem, jak p°istupovat k prom∞nn²m z globßlnφho kontextu, je
  21104.     pou╛itφ specißlnφho pole <TT
  21105. CLASS="varname"
  21106. >$GLOBALS</TT
  21107. >, definovanΘho
  21108.     v PHP. P°edchozφ p°φklad lze p°epsat:
  21109.    </P
  21110. ><DIV
  21111. CLASS="informalexample"
  21112. ><A
  21113. NAME="AEN4164"
  21114. ></A
  21115. ><P
  21116. ></P
  21117. ><TABLE
  21118. BORDER="0"
  21119. BGCOLOR="#E0E0E0"
  21120. CELLPADDING="5"
  21121. ><TR
  21122. ><TD
  21123. ><PRE
  21124. CLASS="php"
  21125. >$a = 1;
  21126. $b = 2;
  21127.  
  21128. function Sum()
  21129. {
  21130.     $GLOBALS["b"] = $GLOBALS["a"] + $GLOBALS["b"];
  21131.  
  21132. Sum();
  21133. echo $b;</PRE
  21134. ></TD
  21135. ></TR
  21136. ></TABLE
  21137. ><P
  21138. ></P
  21139. ></DIV
  21140. ><P
  21141. >     Pole <TT
  21142. CLASS="varname"
  21143. >$GLOBALS</TT
  21144. > je asociativnφ pole s nßzvem globßlnφ
  21145.     prom∞nnΘ jako klφΦem a obsahem p°φslu╣nΘ prom∞nnΘ jako obsahem elementu
  21146.     pole.
  21147.    </P
  21148. ><P
  21149. >     Jinou d∙le╛itou vlastnostφ rozli╣ovßnφ kontext∙ prom∞nn²ch je mo╛nost
  21150.     pou╛φvßnφ <SPAN
  21151. CLASS="emphasis"
  21152. ><I
  21153. CLASS="emphasis"
  21154. >static</I
  21155. ></SPAN
  21156. > prom∞nn²ch. Statickß prom∞nnß
  21157.     existuje pouze v lokßlnφm kontextu funkce, ale neztrßcφ svoji hodnotu,
  21158.     pokud provßd∞nφ programu tento kontext opustφ. Uva╛ujme nßsledujφcφ
  21159.     p°φklad:
  21160.    </P
  21161. ><DIV
  21162. CLASS="informalexample"
  21163. ><A
  21164. NAME="AEN4170"
  21165. ></A
  21166. ><P
  21167. ></P
  21168. ><TABLE
  21169. BORDER="0"
  21170. BGCOLOR="#E0E0E0"
  21171. CELLPADDING="5"
  21172. ><TR
  21173. ><TD
  21174. ><PRE
  21175. CLASS="php"
  21176. >function Test ()
  21177. {
  21178.     $a = 0;
  21179.     echo $a;
  21180.     $a++;
  21181. }</PRE
  21182. ></TD
  21183. ></TR
  21184. ></TABLE
  21185. ><P
  21186. ></P
  21187. ></DIV
  21188. ><P
  21189. >     Tato funkce je pon∞kud neu╛iteΦnß, nebo╗ p°i ka╛dΘm volßnφ nastavuje
  21190.     <TT
  21191. CLASS="varname"
  21192. >$a</TT
  21193. > na <TT
  21194. CLASS="literal"
  21195. >0</TT
  21196. > a tiskne "0".
  21197.     Konstrukt <TT
  21198. CLASS="varname"
  21199. >$a</TT
  21200. >++, kter² inkrementuje prom∞nnou, nemß
  21201.     ╛ßdn² v²znam, proto╛e p°i skonΦenφ vykonßvßnφ funkce se obsah prom∞nnΘ    
  21202.     <TT
  21203. CLASS="varname"
  21204. >$a</TT
  21205. > ztrßcφ. Aby m∞la funkce skuteΦn² v²znam ΦφtaΦe a
  21206.     hodnota se neztrßcela, deklaruje se prom∞nnß <TT
  21207. CLASS="varname"
  21208. >$a</TT
  21209. >
  21210.     jako statickß:
  21211.    </P
  21212. ><DIV
  21213. CLASS="informalexample"
  21214. ><A
  21215. NAME="AEN4178"
  21216. ></A
  21217. ><P
  21218. ></P
  21219. ><TABLE
  21220. BORDER="0"
  21221. BGCOLOR="#E0E0E0"
  21222. CELLPADDING="5"
  21223. ><TR
  21224. ><TD
  21225. ><PRE
  21226. CLASS="php"
  21227. >function Test()
  21228. {
  21229.     static $a = 0;
  21230.     echo $a;
  21231.     $a++;
  21232. }</PRE
  21233. ></TD
  21234. ></TR
  21235. ></TABLE
  21236. ><P
  21237. ></P
  21238. ></DIV
  21239. ><P
  21240. >     Nynφ se p°i ka╛dΘm volßnφ funkce Test() vytiskne hodnota prom∞nnΘ
  21241.     <TT
  21242. CLASS="varname"
  21243. >$a</TT
  21244. > a inkrementuje se.
  21245.    </P
  21246. ><P
  21247. >     StatickΘ prom∞nnΘ takΘ poskytujφ zp∙sob, jak °e╣it rekurzφvnφ funkce.
  21248.     Rekurzφvnφ funkce je takovß funkce, kterß volß sama sebe. Psanφ
  21249.     rekurzφvnφch funkcφ je t°eba v∞novat zvlß╣tnφ pΘΦi, proto╛e m∙╛e vzniknout
  21250.     nekoneΦn² cyklus volßnφ. Musφte se ujistit, ╛e mßte rekurzi adekvßtn∞
  21251.     ukonΦenu. Nßsledujφcφ jednoduchß funkce rekurzφvn∞ poΦφtß do 10 za pou╛itφ
  21252.     statickΘ prom∞nnΘ <TT
  21253. CLASS="varname"
  21254. >$count</TT
  21255. > ke zji╣t∞nφ okam╛iku pro
  21256.     ukonΦenφ:
  21257.    </P
  21258. ><DIV
  21259. CLASS="informalexample"
  21260. ><A
  21261. NAME="AEN4184"
  21262. ></A
  21263. ><P
  21264. ></P
  21265. ><TABLE
  21266. BORDER="0"
  21267. BGCOLOR="#E0E0E0"
  21268. CELLPADDING="5"
  21269. ><TR
  21270. ><TD
  21271. ><PRE
  21272. CLASS="php"
  21273. >function Test()
  21274. {
  21275.     static $count = 0;
  21276.  
  21277.     $count++;
  21278.     echo $count;
  21279.     if ($count < 10) {
  21280.         Test ();
  21281.     }
  21282.     $count--;
  21283. }</PRE
  21284. ></TD
  21285. ></TR
  21286. ></TABLE
  21287. ><P
  21288. ></P
  21289. ></DIV
  21290. ></DIV
  21291. ><DIV
  21292. CLASS="sect1"
  21293. ><HR><H2
  21294. CLASS="sect1"
  21295. ><A
  21296. NAME="language.variables.variable"
  21297. ></A
  21298. >Prom∞nnΘ s prom∞nn²mi nßzvy</H2
  21299. ><P
  21300. >     N∞kdy je vhodnΘ, aby se nßzvy prom∞nn²ch mohly m∞nit, tj. aby mohly b²t
  21301.     dynamicky nastavovßny a pou╛φvßny. Normßlnφ prom∞nnß se nastavuje
  21302.     takov²mto konstruktem:
  21303.    </P
  21304. ><DIV
  21305. CLASS="informalexample"
  21306. ><A
  21307. NAME="AEN4189"
  21308. ></A
  21309. ><P
  21310. ></P
  21311. ><TABLE
  21312. BORDER="0"
  21313. BGCOLOR="#E0E0E0"
  21314. CELLPADDING="5"
  21315. ><TR
  21316. ><TD
  21317. ><PRE
  21318. CLASS="php"
  21319. >$a = "ahoj";</PRE
  21320. ></TD
  21321. ></TR
  21322. ></TABLE
  21323. ><P
  21324. ></P
  21325. ></DIV
  21326. ><P
  21327. >     Prom∞nnß s prom∞nn²m nßzvem vezme hodnotu prom∞nnΘ a pou╛ije ji jako
  21328.     nßzev prom∞nnΘ. Ve v²╣e uvedenΘm p°φkladu,
  21329.     <SPAN
  21330. CLASS="emphasis"
  21331. ><I
  21332. CLASS="emphasis"
  21333. >ahoj</I
  21334. ></SPAN
  21335. > lze pou╛φt jako nßzev prom∞nnΘ uvedenφm dvou
  21336.     symbol∙ dolaru:
  21337.    </P
  21338. ><DIV
  21339. CLASS="informalexample"
  21340. ><A
  21341. NAME="AEN4193"
  21342. ></A
  21343. ><P
  21344. ></P
  21345. ><TABLE
  21346. BORDER="0"
  21347. BGCOLOR="#E0E0E0"
  21348. CELLPADDING="5"
  21349. ><TR
  21350. ><TD
  21351. ><PRE
  21352. CLASS="php"
  21353. >$$a = "sv∞te";</PRE
  21354. ></TD
  21355. ></TR
  21356. ></TABLE
  21357. ><P
  21358. ></P
  21359. ></DIV
  21360. ><P
  21361. >     V tΘto chvφli byly definovßny dv∞ prom∞nnΘ a byly ulo╛eny do stromu
  21362.     symbol∙ PHP: <TT
  21363. CLASS="varname"
  21364. >$a</TT
  21365. > s obsahem "ahoj" a
  21366.     <TT
  21367. CLASS="varname"
  21368. >$ahoj</TT
  21369. > s obsahem "sv∞te". Proto konstrukt:
  21370.    </P
  21371. ><DIV
  21372. CLASS="informalexample"
  21373. ><A
  21374. NAME="AEN4198"
  21375. ></A
  21376. ><P
  21377. ></P
  21378. ><TABLE
  21379. BORDER="0"
  21380. BGCOLOR="#E0E0E0"
  21381. CELLPADDING="5"
  21382. ><TR
  21383. ><TD
  21384. ><PRE
  21385. CLASS="php"
  21386. >echo "$a ${$a}";</PRE
  21387. ></TD
  21388. ></TR
  21389. ></TABLE
  21390. ><P
  21391. ></P
  21392. ></DIV
  21393. ><P
  21394. >     provede p°esn∞ totΘ╛ jako:
  21395.    </P
  21396. ><DIV
  21397. CLASS="informalexample"
  21398. ><A
  21399. NAME="AEN4201"
  21400. ></A
  21401. ><P
  21402. ></P
  21403. ><TABLE
  21404. BORDER="0"
  21405. BGCOLOR="#E0E0E0"
  21406. CELLPADDING="5"
  21407. ><TR
  21408. ><TD
  21409. ><PRE
  21410. CLASS="php"
  21411. >echo "$a $ahoj";</PRE
  21412. ></TD
  21413. ></TR
  21414. ></TABLE
  21415. ><P
  21416. ></P
  21417. ></DIV
  21418. ><P
  21419. >     tedy oba vyprodukujφ: <TT
  21420. CLASS="computeroutput"
  21421. >ahoj sv∞te</TT
  21422. >.
  21423.    </P
  21424. ><P
  21425. >     P°i pou╛itφ prom∞nn²ch s prom∞nn²mi nßzvy s poli musφte vy°e╣it problΘm
  21426.     vφceznaΦnosti. Tj. kdy╛ napφ╣ete
  21427.     <TT
  21428. CLASS="varname"
  21429. >$$a[1]</TT
  21430. >, parser pot°ebuje v∞d∞t, mßte-li na mysli pou╛itφ
  21431.     <TT
  21432. CLASS="varname"
  21433. >$a[1]</TT
  21434. > jako prom∞nnΘ nebo chcete <TT
  21435. CLASS="varname"
  21436. >$$a</TT
  21437. >
  21438.     jako prom∞nnou a potom index [1] v tΘto prom∞nnΘ. Syntaxe pro °e╣enφ
  21439.     tΘto vφceznaΦnosti je <TT
  21440. CLASS="varname"
  21441. >${$a[1]}</TT
  21442. > pro prvnφ p°φpad a
  21443.     <TT
  21444. CLASS="varname"
  21445. >${$a}[1]</TT
  21446. > pro druh².
  21447.    </P
  21448. ></DIV
  21449. ><DIV
  21450. CLASS="sect1"
  21451. ><HR><H2
  21452. CLASS="sect1"
  21453. ><A
  21454. NAME="language.variables.external"
  21455. ></A
  21456. >Promm∞nΘ zvenΦφ PHP</H2
  21457. ><DIV
  21458. CLASS="sect2"
  21459. ><H3
  21460. CLASS="sect2"
  21461. ><A
  21462. NAME="language.variables.external.form"
  21463. ></A
  21464. >HTML formulß°e (GET a POST)</H3
  21465. ><P
  21466. >      Kdy╛ se ode╣le formulß° do PHP skriptu, jakΘkoli prom∞nnΘ z tohoto
  21467.      formulß°e budou automaticky dostupnΘ v tomto skriptu.
  21468.      Je-li zapnuta konfiguraΦnφ volba
  21469.      <A
  21470. HREF="#ini.track-vars"
  21471. >track_vars</A
  21472. >, budou tyto prom∞nnΘ
  21473.      umφst∞ny v asociativnφch polφch
  21474.      <TT
  21475. CLASS="varname"
  21476. >$HTTP_POST_VARS</TT
  21477. >,
  21478.      <TT
  21479. CLASS="varname"
  21480. >$HTTP_GET_VARS</TT
  21481. >, a/nebo
  21482.      <TT
  21483. CLASS="varname"
  21484. >$HTTP_POST_FILES</TT
  21485. > v zßvislosti na zdroji prom∞nn²ch.
  21486.     </P
  21487. ><P
  21488. >      Pro vφce informacφ o t∞chto prom∞nn²ch si laskav∞ p°eΦt∞te <A
  21489. HREF="#language.variables.predefined"
  21490. >P°eddefinovanΘ prom∞nnΘ</A
  21491. >.
  21492.     </P
  21493. ><P
  21494. >      <TABLE
  21495. WIDTH="100%"
  21496. BORDER="0"
  21497. CELLPADDING="0"
  21498. CELLSPACING="0"
  21499. CLASS="EXAMPLE"
  21500. ><TR
  21501. ><TD
  21502. ><DIV
  21503. CLASS="example"
  21504. ><A
  21505. NAME="AEN4223"
  21506. ></A
  21507. ><P
  21508. ><B
  21509. >P°φklad 7-1. Jednoduchß prom∞nnß formulß°e</B
  21510. ></P
  21511. ><TABLE
  21512. BORDER="0"
  21513. BGCOLOR="#E0E0E0"
  21514. CELLPADDING="5"
  21515. ><TR
  21516. ><TD
  21517. ><PRE
  21518. CLASS="php"
  21519. ><form action="foo.php" method="post">
  21520.     Name: <input type="text" name="username"><br>
  21521.     <input type="submit">
  21522. </form></PRE
  21523. ></TD
  21524. ></TR
  21525. ></TABLE
  21526. ></DIV
  21527. ></TD
  21528. ></TR
  21529. ></TABLE
  21530. >
  21531.     </P
  21532. ><P
  21533. >      Kdy╛ se v²╣e uveden² formulß° ode╣le, hodnota vstupnφho textu bude
  21534.      dostupnß v <TT
  21535. CLASS="varname"
  21536. >$HTTP_POST_VARS['username']</TT
  21537. >. Je-li
  21538.      zapnuta konfiguraΦnφ direktiva
  21539.      <A
  21540. HREF="#ini.register-globals"
  21541. >register_globals</A
  21542. >,
  21543.      prom∞nnß bude dostupnß i jako <TT
  21544. CLASS="varname"
  21545. >$username</TT
  21546. > v globßlnφm
  21547.      kontextu.
  21548.     </P
  21549. ><DIV
  21550. CLASS="note"
  21551. ><BLOCKQUOTE
  21552. CLASS="note"
  21553. ><P
  21554. ><B
  21555. >Poznßmka: </B
  21556. >
  21557.       The <A
  21558. HREF="#ini.magic-quotes-gpc"
  21559. >magic_quotes_gpc</A
  21560.       configuration directive affects Get, Post and Cookie values.  If 
  21561.       turned on, value (It's "PHP!") will automagically become (It\'s \"PHP!\").
  21562.       Escaping is needed for DB insertion.  Also see
  21563.       <A
  21564. HREF="#function.addslashes"
  21565. ><B
  21566. CLASS="function"
  21567. >addslashes()</B
  21568. ></A
  21569. >, <A
  21570. HREF="#function.stripslashes"
  21571. ><B
  21572. CLASS="function"
  21573. >stripslashes()</B
  21574. ></A
  21575. > and 
  21576.       <A
  21577. HREF="#ini.magic-quotes-sybase"
  21578. >magic_quotes_sybase</A
  21579. >.
  21580.      </P
  21581. ></BLOCKQUOTE
  21582. ></DIV
  21583. ><P
  21584. >      PHP also understands arrays in the context of form variables 
  21585.      (see the <A
  21586. HREF="#faq.html"
  21587. >related faq</A
  21588. >).  You may, 
  21589.      for example, group related variables together, or use this 
  21590.      feature to retrieve values from a multiple select input:
  21591.     </P
  21592. ><P
  21593. >      <TABLE
  21594. WIDTH="100%"
  21595. BORDER="0"
  21596. CELLPADDING="0"
  21597. CELLSPACING="0"
  21598. CLASS="EXAMPLE"
  21599. ><TR
  21600. ><TD
  21601. ><DIV
  21602. CLASS="example"
  21603. ><A
  21604. NAME="AEN4239"
  21605. ></A
  21606. ><P
  21607. ><B
  21608. >P°φklad 7-2. More complex form variables</B
  21609. ></P
  21610. ><TABLE
  21611. BORDER="0"
  21612. BGCOLOR="#E0E0E0"
  21613. CELLPADDING="5"
  21614. ><TR
  21615. ><TD
  21616. ><PRE
  21617. CLASS="php"
  21618. ><form action="array.php" method="post">
  21619.     Name: <input type="text" name="personal[name]"><br>
  21620.     Email: <input type="text" name="personal[email]"><br>
  21621.     Beer: <br>
  21622.     <select multiple name="beer[]">
  21623.         <option value="warthog">Warthog
  21624.         <option value="guinness">Guinness
  21625.         <option value="stuttgarter">Stuttgarter SchwabenbrΣu
  21626.         </select>
  21627.     <input type="submit">
  21628. </form></PRE
  21629. ></TD
  21630. ></TR
  21631. ></TABLE
  21632. ></DIV
  21633. ></TD
  21634. ></TR
  21635. ></TABLE
  21636. >
  21637.     </P
  21638. ><P
  21639. >      In PHP 3, the array form variable usage is limited to
  21640.      single-dimensional arrays. In PHP 4, no such restriction applies.
  21641.     </P
  21642. ><DIV
  21643. CLASS="sect3"
  21644. ><HR><H4
  21645. CLASS="sect3"
  21646. ><A
  21647. NAME="language.variables.external.form.submit"
  21648. ></A
  21649. >IMAGE SUBMIT variable names</H4
  21650. ><P
  21651. >       When submitting a form, it is possible to use an image instead
  21652.       of the standard submit button with a tag like:</P
  21653. ><DIV
  21654. CLASS="informalexample"
  21655. ><A
  21656. NAME="AEN4246"
  21657. ></A
  21658. ><P
  21659. ></P
  21660. ><TABLE
  21661. BORDER="0"
  21662. BGCOLOR="#E0E0E0"
  21663. CELLPADDING="5"
  21664. ><TR
  21665. ><TD
  21666. ><PRE
  21667. CLASS="php"
  21668. ><input type="image" src="image.gif" name="sub"></PRE
  21669. ></TD
  21670. ></TR
  21671. ></TABLE
  21672. ><P
  21673. ></P
  21674. ></DIV
  21675. ><P
  21676. >       When the user clicks somewhere on the image, the accompanying
  21677.       form will be transmitted to the server with two additional
  21678.       variables, sub_x and sub_y. These contain the coordinates of the
  21679.       user click within the image.  The experienced may note that the
  21680.       actual variable names sent by the browser contains a period
  21681.       rather than an underscore, but PHP converts the period to an
  21682.       underscore automatically.
  21683.      </P
  21684. ></DIV
  21685. ></DIV
  21686. ><DIV
  21687. CLASS="sect2"
  21688. ><HR><H3
  21689. CLASS="sect2"
  21690. ><A
  21691. NAME="language.variables.external.cookies"
  21692. ></A
  21693. >HTTP Cookies</H3
  21694. ><P
  21695. >      PHP transparently supports HTTP cookies as defined by <A
  21696. HREF="http://www.netscape.com/newsref/std/cookie_spec.html"
  21697. TARGET="_top"
  21698. >Netscape's Spec</A
  21699. >.  Cookies are a
  21700.      mechanism for storing data in the remote browser and thus
  21701.      tracking or identifying return users.  You can set cookies using
  21702.      the <A
  21703. HREF="#function.setcookie"
  21704. ><B
  21705. CLASS="function"
  21706. >setcookie()</B
  21707. ></A
  21708. > function.  Cookies are part of
  21709.      the HTTP header, so the SetCookie function must be called before
  21710.      any output is sent to the browser.  This is the same restriction
  21711.      as for the <A
  21712. HREF="#function.header"
  21713. ><B
  21714. CLASS="function"
  21715. >header()</B
  21716. ></A
  21717. > function.  Any cookies
  21718.      sent to you from the client will automatically be turned into a
  21719.      PHP variable just like GET and POST method data.</P
  21720. ><P
  21721. >      If you wish to assign multiple values to a single cookie, just
  21722.      add <SPAN
  21723. CLASS="emphasis"
  21724. ><I
  21725. CLASS="emphasis"
  21726. >[]</I
  21727. ></SPAN
  21728. > to the cookie name.  For
  21729.      example:
  21730.     </P
  21731. ><DIV
  21732. CLASS="informalexample"
  21733. ><A
  21734. NAME="AEN4257"
  21735. ></A
  21736. ><P
  21737. ></P
  21738. ><TABLE
  21739. BORDER="0"
  21740. BGCOLOR="#E0E0E0"
  21741. CELLPADDING="5"
  21742. ><TR
  21743. ><TD
  21744. ><PRE
  21745. CLASS="php"
  21746. >setcookie("MyCookie[]", "Testing", time()+3600);</PRE
  21747. ></TD
  21748. ></TR
  21749. ></TABLE
  21750. ><P
  21751. ></P
  21752. ></DIV
  21753. ><P
  21754. >      Note that a cookie will replace a previous cookie by the same
  21755.      name in your browser unless the path or domain is different.  So,
  21756.      for a shopping cart application you may want to keep a counter
  21757.      and pass this along.  i.e.
  21758.     </P
  21759. ><TABLE
  21760. WIDTH="100%"
  21761. BORDER="0"
  21762. CELLPADDING="0"
  21763. CELLSPACING="0"
  21764. CLASS="EXAMPLE"
  21765. ><TR
  21766. ><TD
  21767. ><DIV
  21768. CLASS="example"
  21769. ><A
  21770. NAME="AEN4260"
  21771. ></A
  21772. ><P
  21773. ><B
  21774. >P°φklad 7-3. SetCookie Example</B
  21775. ></P
  21776. ><TABLE
  21777. BORDER="0"
  21778. BGCOLOR="#E0E0E0"
  21779. CELLPADDING="5"
  21780. ><TR
  21781. ><TD
  21782. ><PRE
  21783. CLASS="php"
  21784. >$Count++;
  21785. setcookie("Count", $Count, time()+3600);
  21786. setcookie("Cart[$Count]", $item, time()+3600);</PRE
  21787. ></TD
  21788. ></TR
  21789. ></TABLE
  21790. ></DIV
  21791. ></TD
  21792. ></TR
  21793. ></TABLE
  21794. ></DIV
  21795. ><DIV
  21796. CLASS="sect2"
  21797. ><HR><H3
  21798. CLASS="sect2"
  21799. ><A
  21800. NAME="language.variables.external.environment"
  21801. ></A
  21802. >Environment variables</H3
  21803. ><P
  21804. >      PHP automatically makes environment variables available as normal
  21805.      PHP variables.
  21806.      
  21807.      <DIV
  21808. CLASS="informalexample"
  21809. ><A
  21810. NAME="AEN4266"
  21811. ></A
  21812. ><P
  21813. ></P
  21814. ><TABLE
  21815. BORDER="0"
  21816. BGCOLOR="#E0E0E0"
  21817. CELLPADDING="5"
  21818. ><TR
  21819. ><TD
  21820. ><PRE
  21821. CLASS="php"
  21822. >echo $HOME;  /* Shows the HOME environment variable, if set. */</PRE
  21823. ></TD
  21824. ></TR
  21825. ></TABLE
  21826. ><P
  21827. ></P
  21828. ></DIV
  21829. >
  21830.     </P
  21831. ><P
  21832. >      Since information coming in via GET, POST and Cookie mechanisms
  21833.      also automatically create PHP variables, it is sometimes best to
  21834.      explicitly read a variable from the environment in order to make
  21835.      sure that you are getting the right version.  The
  21836.      <A
  21837. HREF="#function.getenv"
  21838. ><B
  21839. CLASS="function"
  21840. >getenv()</B
  21841. ></A
  21842. > function can be used for this.  You
  21843.      can also set an environment variable with the
  21844.      <A
  21845. HREF="#function.putenv"
  21846. ><B
  21847. CLASS="function"
  21848. >putenv()</B
  21849. ></A
  21850. > function.
  21851.     </P
  21852. ></DIV
  21853. ><DIV
  21854. CLASS="sect2"
  21855. ><HR><H3
  21856. CLASS="sect2"
  21857. ><A
  21858. NAME="language.variables.external.dot-in-names"
  21859. ></A
  21860. >Dots in incoming variable names</H3
  21861. ><P
  21862. >      Typically, PHP does not alter the names of variables when they
  21863.      are passed into a script. However, it should be noted that the
  21864.      dot (period, full stop) is not a valid character in a PHP
  21865.      variable name. For the reason, look at it:
  21866.      <TABLE
  21867. BORDER="0"
  21868. BGCOLOR="#E0E0E0"
  21869. CELLPADDING="5"
  21870. ><TR
  21871. ><TD
  21872. ><PRE
  21873. CLASS="php"
  21874. >$varname.ext;  /* invalid variable name */</PRE
  21875. ></TD
  21876. ></TR
  21877. ></TABLE
  21878. >
  21879.      Now, what the parser sees is a variable named
  21880.      <TT
  21881. CLASS="varname"
  21882. >$varname</TT
  21883. >, followed by the string concatenation
  21884.      operator, followed by the barestring (i.e. unquoted string which
  21885.      doesn't match any known key or reserved words) 'ext'. Obviously,
  21886.      this doesn't have the intended result.
  21887.     </P
  21888. ><P
  21889. >      For this reason, it is important to note that PHP will
  21890.      automatically replace any dots in incoming variable names with
  21891.      underscores.
  21892.     </P
  21893. ></DIV
  21894. ><DIV
  21895. CLASS="sect2"
  21896. ><HR><H3
  21897. CLASS="sect2"
  21898. ><A
  21899. NAME="language.variables.determining-type-of"
  21900. ></A
  21901. >Determining variable types</H3
  21902. ><P
  21903. >      Because PHP determines the types of variables and converts them
  21904.      (generally) as needed, it is not always obvious what type a given
  21905.      variable is at any one time.  PHP includes several functions
  21906.      which find out what type a variable is. They are
  21907.      <A
  21908. HREF="#function.gettype"
  21909. ><B
  21910. CLASS="function"
  21911. >gettype()</B
  21912. ></A
  21913. >, <A
  21914. HREF="#function.is-array"
  21915. ><B
  21916. CLASS="function"
  21917. >is_array()</B
  21918. ></A
  21919. >,
  21920.      <A
  21921. HREF="#function.is-float"
  21922. ><B
  21923. CLASS="function"
  21924. >is_float()</B
  21925. ></A
  21926. >, <A
  21927. HREF="#function.is-int"
  21928. ><B
  21929. CLASS="function"
  21930. >is_int()</B
  21931. ></A
  21932. >,
  21933.      <A
  21934. HREF="#function.is-object"
  21935. ><B
  21936. CLASS="function"
  21937. >is_object()</B
  21938. ></A
  21939. >, and
  21940.      <A
  21941. HREF="#function.is-string"
  21942. ><B
  21943. CLASS="function"
  21944. >is_string()</B
  21945. ></A
  21946. >.
  21947.     </P
  21948. ></DIV
  21949. ></DIV
  21950. ></DIV
  21951. ><DIV
  21952. CLASS="chapter"
  21953. ><HR><H1
  21954. ><A
  21955. NAME="language.constants"
  21956. >Kapitola 8. Konstanty</A
  21957. ></H1
  21958. ><P
  21959. >   PHP definuje n∞kolik konstant a poskytuje mechanismus pro definici dal╣φch
  21960.   za b∞hu. Konstanty se hodn∞ podobajφ prom∞nn²m s v²jimkou dvou skuteΦnostφ:
  21961.   konstanty se musφ definovat pomocφ funkce <A
  21962. HREF="#function.define"
  21963. ><B
  21964. CLASS="function"
  21965. >define()</B
  21966. ></A
  21967. >, a
  21968.   nemohou pozd∞ji nab²vat jin²ch hodnot.
  21969.   </P
  21970. ><P
  21971. >   P°eddefinovanΘ konstanty (dostupnΘ v╛dy) jsou:
  21972.  
  21973.    <P
  21974. ></P
  21975. ><DIV
  21976. CLASS="variablelist"
  21977. ><DL
  21978. ><DT
  21979. >__FILE__</DT
  21980. ><DD
  21981. ><P
  21982. >       Nßzev souboru skriptu, kter² je prßv∞ Φten. Pokud je pou╛ita v souboru,
  21983.       kter² byl vlo╛en pomocφ "include" nebo "require", obsahuje nßzev vlo╛enΘho
  21984.       souboru, nikoli rodiΦovskΘho.
  21985.       </P
  21986. ></DD
  21987. ><DT
  21988. >__LINE__</DT
  21989. ><DD
  21990. ><P
  21991. >       ╚φslo °ßdku ve skriptu, kter² je prßv∞ Φten. Pokud je pou╛ita v
  21992.       souboru vlo╛enΘho pomocφ "include" nebo "require", obsahuje pozici
  21993.       v rßmci tohoto souboru.
  21994.       </P
  21995. ></DD
  21996. ><DT
  21997. >PHP_VERSION</DT
  21998. ><DD
  21999. ><P
  22000. >       TextovΘ vyjßd°enφ verze b∞╛φcφho PHP parseru, nap°. '3.0.8-dev'.
  22001.       </P
  22002. ></DD
  22003. ><DT
  22004. >PHP_OS</DT
  22005. ><DD
  22006. ><P
  22007. >       Nßzev operaΦnφho systΘmu, na kterΘm PHP parser b∞╛φ, nap°. 'Linux'.
  22008.       </P
  22009. ></DD
  22010. ><DT
  22011. ><TT
  22012. CLASS="constant"
  22013. ><B
  22014. >TRUE</B
  22015. ></TT
  22016. ></DT
  22017. ><DD
  22018. ><P
  22019. >        Pravdivß hodnota (logickß jedniΦka).
  22020.       </P
  22021. ></DD
  22022. ><DT
  22023. ><TT
  22024. CLASS="constant"
  22025. ><B
  22026. >FALSE</B
  22027. ></TT
  22028. ></DT
  22029. ><DD
  22030. ><P
  22031. >        Nepravdivß hodnota (logickß nula).
  22032.       </P
  22033. ></DD
  22034. ><DT
  22035. >E_ERROR</DT
  22036. ><DD
  22037. ><P
  22038. >       OznaΦuje neo╣et°itelnou chybu jinou ne╛ "parse error".
  22039.       </P
  22040. ></DD
  22041. ><DT
  22042. >E_WARNING</DT
  22043. ><DD
  22044. ><P
  22045. >       OznaΦuje stav, kdy PHP vφ, ╛e je n∞co ╣patn∞, ale bude dßl pokraΦovat.
  22046.       Tyto stavy se dajφ o╣et°it v samotnΘm skriptu. P°φkladem by byl neplatn²
  22047.       "regexp" (regulßrnφ v²raz) ve funkci <A
  22048. HREF="#function.ereg"
  22049. ><B
  22050. CLASS="function"
  22051. >ereg()</B
  22052. ></A
  22053. >.
  22054.       </P
  22055. ></DD
  22056. ><DT
  22057. >E_PARSE</DT
  22058. ><DD
  22059. ><P
  22060. >       Chyba p°i syntaktickΘ anal²ze skriptu (chybnß syntaxe). O╣et°enφ nenφ mo╛nΘ.
  22061.       </P
  22062. ></DD
  22063. ><DT
  22064. >E_NOTICE</DT
  22065. ><DD
  22066. ><P
  22067. >       Do╣lo k n∞Φemu, co by mohlo b²t chybou. Provßd∞nφ skriptu pokraΦuje.
  22068.       Mezi p°φklady pat°φ textov² index pole neopat°en² uvozovkami nebo prßce
  22069.       s prom∞nnou, kterß je╣t∞ nebyla definovßna.
  22070.       </P
  22071. ></DD
  22072. ><DT
  22073. >E_ALL</DT
  22074. ><DD
  22075. ><P
  22076. >       V╣echny E_* konstanty shrnutΘ do jednΘ. P°i pou╛itφ s funkcφ
  22077.        <A
  22078. HREF="#function.error-reporting"
  22079. ><B
  22080. CLASS="function"
  22081. >error_reporting()</B
  22082. ></A
  22083. > zp∙sobφ hlß╣enφ ·pln∞ v╣ech
  22084.        problΘmu zaregistrovan²ch PHP.
  22085.       </P
  22086. ></DD
  22087. ></DL
  22088. ></DIV
  22089. >
  22090.   </P
  22091. ><P
  22092. >    E_* konstanty se typicky pou╛φvajφ s funkcφ
  22093.    <A
  22094. HREF="#function.error-reporting"
  22095. ><B
  22096. CLASS="function"
  22097. >error_reporting()</B
  22098. ></A
  22099. > nastavenφ hladiny hlß╣enφ chyb. Viz
  22100.    v╣echny tyto konstanty v
  22101.    <A
  22102. HREF="#features.error-handling"
  22103. >O╣et°enφ chyb</A
  22104. >.
  22105.    </P
  22106. ><P
  22107. >    Dal╣φ konstanty m∙╛ete definovat pomocφ funkce
  22108.    <A
  22109. HREF="#function.define"
  22110. ><B
  22111. CLASS="function"
  22112. >define()</B
  22113. ></A
  22114. >.
  22115.    </P
  22116. ><P
  22117. >    V╣imn∞te si, ╛e toto jsou konstanty, ne cΘΦkovskß makra; konstanty mohou
  22118.    reprezentovat pouze platnß skalßrnφ data.
  22119.  
  22120.     <TABLE
  22121. WIDTH="100%"
  22122. BORDER="0"
  22123. CELLPADDING="0"
  22124. CELLSPACING="0"
  22125. CLASS="EXAMPLE"
  22126. ><TR
  22127. ><TD
  22128. ><DIV
  22129. CLASS="example"
  22130. ><A
  22131. NAME="AEN4346"
  22132. ></A
  22133. ><P
  22134. ><B
  22135. >P°φklad 8-1. Definice konstant</B
  22136. ></P
  22137. ><TABLE
  22138. BORDER="0"
  22139. BGCOLOR="#E0E0E0"
  22140. CELLPADDING="5"
  22141. ><TR
  22142. ><TD
  22143. ><PRE
  22144. CLASS="programlisting"
  22145. ><?php
  22146. define("CONSTANT", "Hello world.");
  22147. echo CONSTANT; // vytiskne "Hello world."
  22148. ?></PRE
  22149. ></TD
  22150. ></TR
  22151. ></TABLE
  22152. ></DIV
  22153. ></TD
  22154. ></TR
  22155. ></TABLE
  22156. >
  22157.  
  22158.     <TABLE
  22159. WIDTH="100%"
  22160. BORDER="0"
  22161. CELLPADDING="0"
  22162. CELLSPACING="0"
  22163. CLASS="EXAMPLE"
  22164. ><TR
  22165. ><TD
  22166. ><DIV
  22167. CLASS="example"
  22168. ><A
  22169. NAME="AEN4349"
  22170. ></A
  22171. ><P
  22172. ><B
  22173. >P°φklad 8-2. Pou╛itφ __FILE__ a __LINE__</B
  22174. ></P
  22175. ><TABLE
  22176. BORDER="0"
  22177. BGCOLOR="#E0E0E0"
  22178. CELLPADDING="5"
  22179. ><TR
  22180. ><TD
  22181. ><PRE
  22182. CLASS="programlisting"
  22183. ><?php
  22184. function report_error($file, $line, $message) {
  22185.     echo "Do╣lo k chyb∞ v souboru $file na °ßdku $line: $message.";
  22186. }
  22187.  
  22188. report_error(__FILE__,__LINE__, "N∞co je ╣patn∞!");
  22189. ?></PRE
  22190. ></TD
  22191. ></TR
  22192. ></TABLE
  22193. ></DIV
  22194. ></TD
  22195. ></TR
  22196. ></TABLE
  22197. ></P
  22198. ></DIV
  22199. ><DIV
  22200. CLASS="chapter"
  22201. ><HR><H1
  22202. ><A
  22203. NAME="language.expressions"
  22204. >Kapitola 9. V²razy</A
  22205. ></H1
  22206. ><P
  22207. >     V²razy jsou nejd∙le╛it∞j╣φmi stavebnφmi kameny PHP. V PHP je tΘm∞° v╣e,
  22208.     co napφ╣ete, v²raz. Nejjednodu╣╣φ, a p°ece nejp°esn∞j╣φ definicφ v²razu je
  22209.     "v╣echno, co mß hodnotu".
  22210.    </P
  22211. ><P
  22212. >     Nejzßkladn∞j╣φmi formami v²raz∙ jsou konstanty a prom∞nnΘ. Kdy╛ napφ╣ete
  22213.     "$a = 5", p°i°azujete '5' do $a.  '5' mß, pochopiteln∞, hodnotu 5, nebo
  22214.     jin²mi slovy, '5' je v²raz s hodnotou 5 (v tomto p°φpad∞ je '5'
  22215.     celoΦφselnou konstantou).
  22216.    </P
  22217. ><P
  22218. >     Po tomto p°i°azenφ budete oΦekßvat, ╛e hodnota $a bude 5, tak╛e kdybyste
  22219.     napsali $b = $a, oΦekßvali byste totΘ╛, jako p°i napsßnφ $b = 5. Jin²mi
  22220.     slovy, $a je tedy v²raz s hodnotou 5.  Pokud v╣e pracuje sprßvn∞,
  22221.     p°esn∞ to se takΘ stane.
  22222.    </P
  22223. ><P
  22224. >     O n∞co slo╛it∞j╣φm p°φkladem v²raz∙ jsou funkce. Uva╛ujme nap°. tuto
  22225.     funkci:
  22226.  
  22227.     <DIV
  22228. CLASS="informalexample"
  22229. ><A
  22230. NAME="AEN4358"
  22231. ></A
  22232. ><P
  22233. ></P
  22234. ><TABLE
  22235. BORDER="0"
  22236. BGCOLOR="#E0E0E0"
  22237. CELLPADDING="5"
  22238. ><TR
  22239. ><TD
  22240. ><PRE
  22241. CLASS="php"
  22242. >function foo ()
  22243. {
  22244.     return 5;
  22245. }</PRE
  22246. ></TD
  22247. ></TR
  22248. ></TABLE
  22249. ><P
  22250. ></P
  22251. ></DIV
  22252. ></P
  22253. ><P
  22254. >     Za p°edpokladu, ╛e jste dob°e seznßmeni s konceptem funkcφ (pokud ne,
  22255.     nahlΘdn∞te do kapitoly o funkcφch), byste p°edpoklßdali, ╛e napsßnφ
  22256.     <TT
  22257. CLASS="literal"
  22258. >$c = foo()</TT
  22259. > je v zßsad∞ totΘ╛ jako
  22260.     <TT
  22261. CLASS="literal"
  22262. >$c = 5</TT
  22263. >, a mßte pravdu. Funkce jsou v²razy s hodnotou
  22264.     jejich nßvratovΘ hodnoty. Funkce foo() vracφ 5, tudφ╛ hodnota v²razu
  22265.     'foo()' je 5. Obvykle funkce nevracejφ konstantnφ hodnotu, n²br╛ n∞co
  22266.     vypoΦφtßvajφ.
  22267.    </P
  22268. ><P
  22269. >     Hodnoty v PHP samoz°ejm∞ nemusejφ b²t pouze celß Φφsla, a velmi Φasto
  22270.     takΘ nejsou. PHP podporuje t°i typy skalßrnφch hodnot: celoΦφselnΘ,
  22271.     reßlnΘ (pohyblivß °ßdovß Φßrka) a °et∞zce (skalßrnφ hodnoty jsou hodnoty,
  22272.     kterΘ nejde "rozbφt" na men╣φ Φßsti, narozdφl nap°. od polφ). PHP
  22273.     podporuje takΘ dva kompozitnφ (neskalßrnφ) typy: pole a objekty. Ka╛d²
  22274.     z t∞chto typ∙ hodnot m∙╛e b²t p°i°azen do prom∞nnΘ nebo vracen z funkce.
  22275.    </P
  22276. ><P
  22277. >     U╛ivatelΘ PHP/FI 2 by nem∞li pocφtit zm∞nu. Ale PHP jde ve v²razech
  22278.     mnohem dßle, stejn∞ jako mnoho jin²ch programovacφch jazyk∙. PHP je
  22279.     v²razov∞ orientovan² jazyk, ve smyslu, ╛e tΘm∞° v╣e je v²raz. Uva╛ujme
  22280.     p°φklad, kter²m jsme se ji╛ zab²vali, '$a = 5'. Ihned vidφme, ╛e jsou
  22281.     zde zahrnuty dv∞ hodnoty, celoΦφselnß konstanta '5' a hodnota $a,
  22282.     kterß je aktualizovßna na 5. Ale je pravda, ╛e je tu je╣t∞ jedna hodnota,
  22283.     je to hodnota samotnΘho p°i°azenφ. P°i°azenφ jako takovΘ ohodnocuje
  22284.     p°i°azovanou hodnotu, v tomto p°φpad∞ 5. V praxi to znamenß, ╛e '$a = 5',
  22285.     bez ohledu na to co d∞lß, je v²raz s hodnotou 5. Proto je '$b = ($a = 5)'
  22286.     totΘ╛ jako '$a = 5; $b = 5;' (st°ednφk oznaΦuje konec v²razu). Proto╛e
  22287.     p°i°ezenφ jsou parsovßna zprava doleva, m∙╛ete takΘ napsat
  22288.     '$b = $a = 5'.
  22289.    </P
  22290. ><P
  22291. >     Jin²m dobr²m p°φkladem orientace na v²razy je pre- a post-inkrementace
  22292.     a dekrementace. U╛ivatelΘ PHP/FI 2 a mnoha jin²ch jazyk∙ znajφ notaci
  22293.     prom∞nnß++ a prom∞nnß--. To jsou inkrementaΦnφ a dekrementaΦnφ operßtory.
  22294.     V PHP/FI 2 nem∞lo '$a++' ╛ßdnou hodnotu (nenφ to v²raz), a proto ne╣lo
  22295.     p°i°adit nebo jinak pou╛φt. PHP roz╣i°uje schopnosti p°em∞nou t∞chto
  22296.     konstrukcφ ve v²razy, jako v C. V PHP, stejn∞ jako v C, existujφ dva typy
  22297.     inkrementace - pre-inkrementace a post-inkrementace. Oba ve svΘ podstat∞
  22298.     inkrementujφ prom∞nnou a efekt na tuto prom∞nnou je toto╛n². Rozdφl je
  22299.     v hodnot∞ inkrementaΦnφho v²razu. Pre-inkrementace, zapsanß jako
  22300.     '++$var', ohodnocuje v²raz inkrementovanou hodnotou (PHP inkrementuje
  22301.     prom∞nnou d°φve, ne╛ p°eΦte jejφ hodnotu, proto "pre-inkrementace").
  22302.     Post-inkrementace, zapsanß jako '$var++', ohodnocuje v²raz p∙vodnφ
  22303.     hodnotou prom∞nnΘ $var, p°ed inkrementacφ (PHP inkrementuje prom∞nnou
  22304.     po p°eΦtenφ jejφ hodnoty, proto "post-inkrement").
  22305.    </P
  22306. ><P
  22307. >     Velmi Φast²m typem v²raz∙ jsou v²razy porovnßvacφ. Tyto v²razy se
  22308.     ohodnocujφ 0 a 1 ve v²znamu <TT
  22309. CLASS="constant"
  22310. ><B
  22311. >FALSE</B
  22312. ></TT
  22313. >, resp. <TT
  22314. CLASS="constant"
  22315. ><B
  22316. >TRUE</B
  22317. ></TT
  22318. >. PHP podporuje
  22319.     > (v∞t╣φ ne╛), >= (v∞t╣φ nebo rovno), == (rovnß se), != (nerovnß se),
  22320.     < (men╣φ ne╛) a <= (men╣φ nebo rovno). Tyto v²razy se nejΦast∞ji
  22321.     pou╛φvajφ v podmφnkßch, jako je konstrukt <TT
  22322. CLASS="literal"
  22323. >if</TT
  22324. >.
  22325.    </P
  22326. ><P
  22327. >     Poslednφm p°φkladem v²raz∙, kter²m se budeme zab²vat, je kombinacφ
  22328.     p°i°azenφ a operßtor∙. Ji╛ vφte, ╛e kdy╛ chcete inkrementovat $a o
  22329.     jedniΦku, jednodu╣e napφ╣ete '$a++' nebo '++$a'. Ale co kdy╛ chcete
  22330.     hodnotu zv²╣it o jinΘ Φφslo, nap°. o 3? Mohli byste napsat '$a++'
  22331.     vφckrßt za sebou, ale to samoz°ejm∞ nenφ efektivnφ ani pohodlnΘ.
  22332.     Mnohem praktiΦt∞j╣φ je napsat '$a = $a + 3'. V²raz '$a + 3' ohodnocuje
  22333.     hodnotu $a plus 3 a je p°i°azen zp∞t do $a, co╛ dßvß $a inkrementovanΘ
  22334.     o 3. V PHP, stejn∞ jako v °ad∞ jin²ch jazyk∙ (jako je C), to m∙╛ete
  22335.     napsat krat╣φm zp∙sobem, kter² se Φasem stane jasn∞j╣φ i rychlej╣φ
  22336.     k pochopenφ. P°iΦtenφ 3 k aktußlnφ hodnot∞ $a lze zapsat jako '$a += 3'.
  22337.     P°esn∞ to znamenß "vezmi hodnotu $a, p°iΦti k nφ 3 a p°i°a∩ zp∞t do $a".
  22338.     Krom∞ krat╣φho a p°ehledn∞j╣φho zßpisu je v²hodou takΘ rychlej╣φ provedenφ.
  22339.     Hodnota '$a += 3', jako hodnota regulΘrnφho p°i°azenφ, je p°i°azovanß
  22340.     hodnota. Uv∞domte si, ╛e to NEN═ 3, n²br╛ $a plus 3 (co╛ je hodnota
  22341.     v²razu p°i°azovanΘho do $a). Takto lze pou╛φt jak²koli binßrnφ operßtor,
  22342.     nap°φklad '$a -= 5' (odeΦti 5 od hodnoty $a), '$b *= 7' (vynßsob hodnotu
  22343.     $b Φφslem 7) apod.
  22344.    </P
  22345. ><P
  22346. >     Je tu je╣t∞ jeden v²raz, kter² se m∙╛e zdßt zvlß╣tnφ, pokud jste ho
  22347.     je╣t∞ nevid∞li v jin²ch jazycφch: ternßrnφ podmφn∞n² operßtor:
  22348.  
  22349.     <DIV
  22350. CLASS="informalexample"
  22351. ><A
  22352. NAME="AEN4372"
  22353. ></A
  22354. ><P
  22355. ></P
  22356. ><TABLE
  22357. BORDER="0"
  22358. BGCOLOR="#E0E0E0"
  22359. CELLPADDING="5"
  22360. ><TR
  22361. ><TD
  22362. ><PRE
  22363. CLASS="programlisting"
  22364. >$prvni ? $druhy : $treti</PRE
  22365. ></TD
  22366. ></TR
  22367. ></TABLE
  22368. ><P
  22369. ></P
  22370. ></DIV
  22371. >
  22372.  
  22373.     Pokud hodnota prvnφho podv²razu je <TT
  22374. CLASS="constant"
  22375. ><B
  22376. >TRUE</B
  22377. ></TT
  22378. > (nenulovß), je ohodnocen druh²
  22379.     podv²raz a je v²sledkem celΘho podmφn∞nΘho v²razu. Jinak je ohodnocen
  22380.     t°etφ podv²raz a je pak hodotou celΘho v²razu.
  22381.    </P
  22382. ><P
  22383. >     Nßsledujφcφ p°φklad by m∞l pomoci lΘpe pochopit pre- a post-inkrementaci
  22384.     i v²razy obecn∞:
  22385.  
  22386.     <DIV
  22387. CLASS="informalexample"
  22388. ><A
  22389. NAME="AEN4376"
  22390. ></A
  22391. ><P
  22392. ></P
  22393. ><TABLE
  22394. BORDER="0"
  22395. BGCOLOR="#E0E0E0"
  22396. CELLPADDING="5"
  22397. ><TR
  22398. ><TD
  22399. ><PRE
  22400. CLASS="php"
  22401. >function double($i)
  22402. {
  22403.     return $i*2;
  22404. }
  22405. $b = $a = 5;        /* p°i°a∩ hodnotu p∞t do prom∞nn²ch $a a $b */
  22406. $c = $a++;          /* prove∩ post-inkrement, p°i°a∩ p∙vodnφ hodnotu $a 
  22407.                        (5) do $c */
  22408. $e = $d = ++$b;     /* prove∩ pre-inkrement, p°i°a∩ inkrementovanou hodnotu 
  22409.                        $b (6) do $d a $e */
  22410.  
  22411. /* nynφ jsou hodnoty prom∞nn²ch $d a $e rovny 6 */
  22412.  
  22413. $f = double($d++);  /* p°i°a∩ dvakrßt hodnotu $d <emphasis>p°ed</emphasis> 
  22414.                        inkrementacφ, 2*6 = 12, do $f */
  22415. $g = double(++$e);  /* p°i°a∩ dvakrßt hodnotu $e <emphasis>po</emphasis>
  22416.                        inkrementaci, 2*7 = 14 do $g */
  22417. $h = $g += 10;      /* nejd°φve je $g inkrementovßno o 10 mß pak hodnotu 24. 
  22418.                        Hodnota p°i°azenφ (24) se p°i°adφ do $h a $h tφm
  22419.                        zφskßvß takΘ hodnotu 24. */</PRE
  22420. ></TD
  22421. ></TR
  22422. ></TABLE
  22423. ><P
  22424. ></P
  22425. ></DIV
  22426. >
  22427.    </P
  22428. ><P
  22429. >     Na zaΦßtku kapitoly bylo °eΦeno, ╛e si popφ╣eme r∙znΘ typy konstrukt∙,
  22430.     a jak bylo slφbeno, v²razy mohou b²t konstrukty. V tomto p°φpad∞ majφ
  22431.     konstrukty formßt 'expr' ';', co╛ znamenß "v²raz nßsledovan² st°ednφkem.
  22432.     V konstruktu '$b=$a=5;', je $a=5 platn² v²raz, ale samo o sob∞ to nenφ
  22433.     konstrukt.'$b=$a=5;' je i platn² konstrukt.
  22434.    </P
  22435. ><P
  22436. >     <SPAN
  22437. CLASS="emphasis"
  22438. ><I
  22439. CLASS="emphasis"
  22440. >     Pozn. p°ekladatele: P°edchozφm odstavci (obΦas i jinde) pou╛φvßm termφn
  22441.     "konstrukt" pro anglickΘ slovo "statement". Tento p°eklad nenφ p°φli╣
  22442.     korektnφ, ale v ΦeskΘ programßtorskΘ mluv∞ neexistuje vhodn² termφn.
  22443.     Kdyby n∞kdo v∞d∞l o lep╣φm, napi╣te mi, prosφm, na luk@php.net.
  22444.     </I
  22445. ></SPAN
  22446. >
  22447.    </P
  22448. ><P
  22449. >     Poslednφ v∞cφ, kterß si zaslou╛φ zmφnku, je pravdivostnφ hodnota v²raz∙.
  22450.     V mnoha p°φpadech, hlavn∞ podmφnkßch a cyklech, vßs nezajφmß konkrΘtnφ
  22451.     hodnota v²razu, n²br╛ pouze to, jestli je <TT
  22452. CLASS="constant"
  22453. ><B
  22454. >TRUE</B
  22455. ></TT
  22456. > nebo <TT
  22457. CLASS="constant"
  22458. ><B
  22459. >FALSE</B
  22460. ></TT
  22461. >.
  22462.     
  22463.     
  22464.     
  22465.     Konstanty <TT
  22466. CLASS="constant"
  22467. ><B
  22468. >TRUE</B
  22469. ></TT
  22470. > a <TT
  22471. CLASS="constant"
  22472. ><B
  22473. >FALSE</B
  22474. ></TT
  22475. > (malß/velkß pφsmena nehrajφ roli) p°edstavujφ
  22476.     dv∞ mo╛nΘ boolovskΘ (pravdivostnφ) hodnoty. V p°φpad∞ pot°eby je v²raz
  22477.     automaticky p°eveden na typ boolean. Detailn∞j╣φ informace o zp∙sobu
  22478.     konverze - viz
  22479.     <A
  22480. HREF="#language.types.typecasting"
  22481. >sekce o typovΘ konverzi</A
  22482. >.
  22483.    </P
  22484. ><P
  22485. >     PHP poskytuje plnou a silnou implementaci v²raz∙ a ·pln∞ je zdokumentovat
  22486.     p°esahuje rozsah tohoto manußlu. V²╣e uvedenΘ p°φklady by vßm m∞li
  22487.     naznaΦit, co jsou v∙bec v²razy a jak konstruovat u╛iteΦnΘ v²razy. Ve
  22488.     zb²vajφcφ Φßsti manußlu budeme psßt <TT
  22489. CLASS="replaceable"
  22490. ><I
  22491. >expr</I
  22492. ></TT
  22493. >
  22494.     jako╛to jak²koli platn² PHP v²raz.
  22495.    </P
  22496. ></DIV
  22497. ><DIV
  22498. CLASS="chapter"
  22499. ><HR><H1
  22500. ><A
  22501. NAME="language.operators"
  22502. >Kapitola 10. Operßtory</A
  22503. ></H1
  22504. ><P
  22505. >   </P
  22506. ><DIV
  22507. CLASS="sect1"
  22508. ><HR><H2
  22509. CLASS="sect1"
  22510. ><A
  22511. NAME="language.operators.arithmetic"
  22512. ></A
  22513. >AritmetickΘ operßtory</H2
  22514. ><P
  22515. >     Vzpomφnßte si na zßkladnφ aritmetiku ze ╣koly? Tohle je ·pln∞ stejnΘ.    
  22516.    </P
  22517. ><DIV
  22518. CLASS="table"
  22519. ><A
  22520. NAME="AEN4395"
  22521. ></A
  22522. ><P
  22523. ><B
  22524. >Tabulka 10-1. AritmetickΘ operßtory</B
  22525. ></P
  22526. ><TABLE
  22527. BORDER="1"
  22528. CLASS="CALSTABLE"
  22529. ><THEAD
  22530. ><TR
  22531. ><TH
  22532. ALIGN="LEFT"
  22533. VALIGN="MIDDLE"
  22534. >P°φklad</TH
  22535. ><TH
  22536. ALIGN="LEFT"
  22537. VALIGN="MIDDLE"
  22538. >Nßzev</TH
  22539. ><TH
  22540. ALIGN="LEFT"
  22541. VALIGN="MIDDLE"
  22542. >V²sledek</TH
  22543. ></TR
  22544. ></THEAD
  22545. ><TBODY
  22546. ><TR
  22547. ><TD
  22548. ALIGN="LEFT"
  22549. VALIGN="MIDDLE"
  22550. >$a + $b</TD
  22551. ><TD
  22552. ALIGN="LEFT"
  22553. VALIGN="MIDDLE"
  22554. >SΦφtßnφ</TD
  22555. ><TD
  22556. ALIGN="LEFT"
  22557. VALIGN="MIDDLE"
  22558. >SouΦet $a a $b.</TD
  22559. ></TR
  22560. ><TR
  22561. ><TD
  22562. ALIGN="LEFT"
  22563. VALIGN="MIDDLE"
  22564. >$a - $b</TD
  22565. ><TD
  22566. ALIGN="LEFT"
  22567. VALIGN="MIDDLE"
  22568. >OdΦφtßnφ</TD
  22569. ><TD
  22570. ALIGN="LEFT"
  22571. VALIGN="MIDDLE"
  22572. >ROzdφl $a a $b.</TD
  22573. ></TR
  22574. ><TR
  22575. ><TD
  22576. ALIGN="LEFT"
  22577. VALIGN="MIDDLE"
  22578. >$a * $b</TD
  22579. ><TD
  22580. ALIGN="LEFT"
  22581. VALIGN="MIDDLE"
  22582. >Nßsobenφ</TD
  22583. ><TD
  22584. ALIGN="LEFT"
  22585. VALIGN="MIDDLE"
  22586. >SouΦin $a a $b.</TD
  22587. ></TR
  22588. ><TR
  22589. ><TD
  22590. ALIGN="LEFT"
  22591. VALIGN="MIDDLE"
  22592. >$a / $b</TD
  22593. ><TD
  22594. ALIGN="LEFT"
  22595. VALIGN="MIDDLE"
  22596. >D∞lenφ</TD
  22597. ><TD
  22598. ALIGN="LEFT"
  22599. VALIGN="MIDDLE"
  22600. >Podφl $a a $b.</TD
  22601. ></TR
  22602. ><TR
  22603. ><TD
  22604. ALIGN="LEFT"
  22605. VALIGN="MIDDLE"
  22606. >$a % $b</TD
  22607. ><TD
  22608. ALIGN="LEFT"
  22609. VALIGN="MIDDLE"
  22610. >Zbytek</TD
  22611. ><TD
  22612. ALIGN="LEFT"
  22613. VALIGN="MIDDLE"
  22614. >Zbytek po d∞lenφ $a a $b.</TD
  22615. ></TR
  22616. ></TBODY
  22617. ></TABLE
  22618. ></DIV
  22619. ><P
  22620. >     Operßtor d∞lenφ ("/") vracφ celoΦφselnou hodnotu (v²sledek celoΦφselnΘho
  22621.     d∞lenφ) prßv∞ tehdy, kdy╛ oba operandy jsou celß Φφsla (nebo °et∞zce,
  22622.     kterΘ se dajφ p°evΘst na celß Φφsla) a podφl je celΘ Φφslo. Pokud
  22623.     n∞kter² z operand∙ celoΦφseln² nenφ nebo v²sledek nenφ celΘ Φφslo, vrßtφ
  22624.     se hodnota v plovoucφ °ßdovΘ Φßrce (float).
  22625.    </P
  22626. ></DIV
  22627. ><DIV
  22628. CLASS="sect1"
  22629. ><HR><H2
  22630. CLASS="sect1"
  22631. ><A
  22632. NAME="language.operators.assignment"
  22633. ></A
  22634. >Operßtory p°i°azenφ</H2
  22635. ><P
  22636. >     Zßkladnφm p°i°azovacφm operßtorem je "=". Mohli byste si zprvu myslet, ╛e
  22637.     se jednß o "rovnß se". Nikoliv. SkuteΦn∞ to znamenß, ╛e se levΘmu operandu
  22638.     p°i°adφ hodnota v²razu vpravo (tj. "nastav na", "p°i°a∩ do" atd.).
  22639.    </P
  22640. ><P
  22641. >     Hodnotou v²razu p°i°azenφ je hodnota, kterß se p°i°azuje. Tj. hodnotou
  22642.     "$a = 3" je Φφslo 3. To vßm umo╛≥uje provßd∞t r∙znΘ triky:
  22643.     <DIV
  22644. CLASS="informalexample"
  22645. ><A
  22646. NAME="AEN4429"
  22647. ></A
  22648. ><P
  22649. ></P
  22650. ><TABLE
  22651. BORDER="0"
  22652. BGCOLOR="#E0E0E0"
  22653. CELLPADDING="5"
  22654. ><TR
  22655. ><TD
  22656. ><PRE
  22657. CLASS="php"
  22658. >$a = ($b = 4) + 5; // $a se ted rovnß 9, a $b bylo nastaveno na 4.</PRE
  22659. ></TD
  22660. ></TR
  22661. ></TABLE
  22662. ><P
  22663. ></P
  22664. ></DIV
  22665. >
  22666.    </P
  22667. ><P
  22668. >     Krom∞ zßkladnφho operßtoru p°i°azenφ existujφ je╣t∞ "kombinovanΘ
  22669.     operßtory" pro v╣echny binßrnφ aritmetickΘ a °et∞zovΘ operßtory, kterΘ
  22670.     umo╛≥ujφ pou╛φt hodnotu ve v²razu a pak hodnotu tohoto v²razu p°i°adit
  22671.     zp∞t. Nap°φklad:
  22672.     <DIV
  22673. CLASS="informalexample"
  22674. ><A
  22675. NAME="AEN4432"
  22676. ></A
  22677. ><P
  22678. ></P
  22679. ><TABLE
  22680. BORDER="0"
  22681. BGCOLOR="#E0E0E0"
  22682. CELLPADDING="5"
  22683. ><TR
  22684. ><TD
  22685. ><PRE
  22686. CLASS="php"
  22687. >$a = 3;
  22688. $a += 5; // nastavφ $a na hodnotu 8, jako kdybychom °ekli: $a = $a + 5;
  22689. $b = "Ahoj ";
  22690. $b .= "tam!"; // nastavφ $b na "Ahoj tam!", p°esn∞ tak, jako $b = $b . "tam!";</PRE
  22691. ></TD
  22692. ></TR
  22693. ></TABLE
  22694. ><P
  22695. ></P
  22696. ></DIV
  22697. >
  22698.    </P
  22699. ><P
  22700. >     Uv∞domte si, ╛e p°i°azenφ zkopφruje hodnotu p∙vodnφ prom∞nnΘ do novΘ
  22701.     prom∞nnΘ (p°i°azenφ hodnoty), tak╛e zm∞ny jednΘ z nich se na druhΘ
  22702.     prom∞nnΘ neprojevφ. To m∙╛e mφt v²znam takΘ tehdy, kdy╛ pot°ebujete
  22703.     zkopφrovat n∞co jako obrovskΘ pole uvnit° krßtkΘho cyklu. PHP 4 podporuje
  22704.     p°i°azenφ odkazem pou╛itφm syntaxe
  22705.     <TT
  22706. CLASS="computeroutput"
  22707. >$var = &$othervar;</TT
  22708. >, ale v PHP 3 to
  22709.     provΘst nelze. "P°i°azenφ odkazem" znamenß, ╛e  ob∞ prom∞nnΘ ukazujφ na
  22710.     tatß╛ data a nic se nikam nekopφruje. Chcete-li se o odkazech dozv∞d∞t
  22711.     vφce, Φt∞te prosφm
  22712.     <A
  22713. HREF="#language.references"
  22714. >Vysv∞tlenφ referencφ</A
  22715. >.
  22716.    </P
  22717. ></DIV
  22718. ><DIV
  22719. CLASS="sect1"
  22720. ><HR><H2
  22721. CLASS="sect1"
  22722. ><A
  22723. NAME="language.operators.bitwise"
  22724. ></A
  22725. >BitovΘ operßtory</H2
  22726. ><P
  22727. >     BitovΘ operßtory umo╛≥ujφ "p°ehodit" konkrΘtnφ bit v celoΦφselnΘ hodnot∞
  22728.     (integer) na jedniΦku nebo nulu. Pokud jsou jak lev², tak prav² parametr
  22729.     °et∞zce, pracujφ bitovΘ operßtory na znacφch v t∞chto °etezcφch.
  22730.    </P
  22731. ><P
  22732. >     <DIV
  22733. CLASS="informalexample"
  22734. ><A
  22735. NAME="AEN4441"
  22736. ></A
  22737. ><P
  22738. ></P
  22739. ><TABLE
  22740. BORDER="0"
  22741. BGCOLOR="#E0E0E0"
  22742. CELLPADDING="5"
  22743. ><TR
  22744. ><TD
  22745. ><PRE
  22746. CLASS="programlisting"
  22747. ><?php
  22748.     echo 12 ^ 9; // Vypφ╣e '5'
  22749.  
  22750.     echo "12" ^ "9"; // Vypφ╣e znak Backspace (ascii 8)
  22751.                      // ('1' (ascii 49)) ^ ('9' (ascii 57)) = #8
  22752.  
  22753.     echo "hallo" ^ "hello"; // Vypφ╣e ascii hodnoty #0 #4 #0 #0 #0
  22754.                             // 'a' ^ 'e' = #4
  22755. ?></PRE
  22756. ></TD
  22757. ></TR
  22758. ></TABLE
  22759. ><P
  22760. ></P
  22761. ></DIV
  22762.    </P
  22763. ><DIV
  22764. CLASS="table"
  22765. ><A
  22766. NAME="AEN4443"
  22767. ></A
  22768. ><P
  22769. ><B
  22770. >Tabulka 10-2. BitovΘ operßtory</B
  22771. ></P
  22772. ><TABLE
  22773. BORDER="1"
  22774. CLASS="CALSTABLE"
  22775. ><THEAD
  22776. ><TR
  22777. ><TH
  22778. ALIGN="LEFT"
  22779. VALIGN="MIDDLE"
  22780. >P°φklad</TH
  22781. ><TH
  22782. ALIGN="LEFT"
  22783. VALIGN="MIDDLE"
  22784. >Nßzev</TH
  22785. ><TH
  22786. ALIGN="LEFT"
  22787. VALIGN="MIDDLE"
  22788. >V²sledek</TH
  22789. ></TR
  22790. ></THEAD
  22791. ><TBODY
  22792. ><TR
  22793. ><TD
  22794. ALIGN="LEFT"
  22795. VALIGN="MIDDLE"
  22796. >$a & $b</TD
  22797. ><TD
  22798. ALIGN="LEFT"
  22799. VALIGN="MIDDLE"
  22800. >And (log. souΦin)</TD
  22801. ><TD
  22802. ALIGN="LEFT"
  22803. VALIGN="MIDDLE"
  22804. >Nastavujφ se bity, kde je jedniΦka v $a i v $b.</TD
  22805. ></TR
  22806. ><TR
  22807. ><TD
  22808. ALIGN="LEFT"
  22809. VALIGN="MIDDLE"
  22810. >$a | $b</TD
  22811. ><TD
  22812. ALIGN="LEFT"
  22813. VALIGN="MIDDLE"
  22814. >Or(log. souΦet)</TD
  22815. ><TD
  22816. ALIGN="LEFT"
  22817. VALIGN="MIDDLE"
  22818. >Nastavujφ se bity, kde je jedniΦka v $a nebo v $b (i v
  22819.        obou souΦasn∞).</TD
  22820. ></TR
  22821. ><TR
  22822. ><TD
  22823. ALIGN="LEFT"
  22824. VALIGN="MIDDLE"
  22825. >$a ^ $b</TD
  22826. ><TD
  22827. ALIGN="LEFT"
  22828. VALIGN="MIDDLE"
  22829. >Xor (exkluzφvnφ log. souΦet)</TD
  22830. ><TD
  22831. ALIGN="LEFT"
  22832. VALIGN="MIDDLE"
  22833. >     Nastavujφ se bity, kde je jedniΦka v $a nebo v $b, ale ne v obou
  22834.         souΦasn∞.
  22835.        </TD
  22836. ></TR
  22837. ><TR
  22838. ><TD
  22839. ALIGN="LEFT"
  22840. VALIGN="MIDDLE"
  22841. >~ $a</TD
  22842. ><TD
  22843. ALIGN="LEFT"
  22844. VALIGN="MIDDLE"
  22845. >Not (negace)</TD
  22846. ><TD
  22847. ALIGN="LEFT"
  22848. VALIGN="MIDDLE"
  22849. >     Tam, kde je nula, bude jedniΦka, a naopak.
  22850.        </TD
  22851. ></TR
  22852. ><TR
  22853. ><TD
  22854. ALIGN="LEFT"
  22855. VALIGN="MIDDLE"
  22856. >$a << $b</TD
  22857. ><TD
  22858. ALIGN="LEFT"
  22859. VALIGN="MIDDLE"
  22860. >Posun vlevo</TD
  22861. ><TD
  22862. ALIGN="LEFT"
  22863. VALIGN="MIDDLE"
  22864. >         Posune bity v $a o $b krok∙ (mφst) vlevo (ka╛d² krok znamenß
  22865.         "nßsobenφ dv∞ma").
  22866.        </TD
  22867. ></TR
  22868. ><TR
  22869. ><TD
  22870. ALIGN="LEFT"
  22871. VALIGN="MIDDLE"
  22872. >$a >> $b</TD
  22873. ><TD
  22874. ALIGN="LEFT"
  22875. VALIGN="MIDDLE"
  22876. >Posun vpravo</TD
  22877. ><TD
  22878. ALIGN="LEFT"
  22879. VALIGN="MIDDLE"
  22880. >     Posune bity v $a o $b krok∙ (mφst) vpravo (ka╛d² krok znamenß
  22881.         "d∞lenφ dv∞ma").
  22882.        </TD
  22883. ></TR
  22884. ></TBODY
  22885. ></TABLE
  22886. ></DIV
  22887. ></DIV
  22888. ><DIV
  22889. CLASS="sect1"
  22890. ><HR><H2
  22891. CLASS="sect1"
  22892. ><A
  22893. NAME="language.operators.comparison"
  22894. ></A
  22895. >Operßtory porovnßnφ</H2
  22896. ><P
  22897. >     Operßtory porovnßnφ, jak nßzev napovφdß, slou╛φ k porovnßnφ dvou hodnot.
  22898.    </P
  22899. ><DIV
  22900. CLASS="table"
  22901. ><A
  22902. NAME="AEN4479"
  22903. ></A
  22904. ><P
  22905. ><B
  22906. >Tabulka 10-3. Operßtory porovnßnφ</B
  22907. ></P
  22908. ><TABLE
  22909. BORDER="1"
  22910. CLASS="CALSTABLE"
  22911. ><THEAD
  22912. ><TR
  22913. ><TH
  22914. ALIGN="LEFT"
  22915. VALIGN="MIDDLE"
  22916. >P°φklad</TH
  22917. ><TH
  22918. ALIGN="LEFT"
  22919. VALIGN="MIDDLE"
  22920. >Nßzev</TH
  22921. ><TH
  22922. ALIGN="LEFT"
  22923. VALIGN="MIDDLE"
  22924. >V²sledek</TH
  22925. ></TR
  22926. ></THEAD
  22927. ><TBODY
  22928. ><TR
  22929. ><TD
  22930. ALIGN="LEFT"
  22931. VALIGN="MIDDLE"
  22932. >$a == $b</TD
  22933. ><TD
  22934. ALIGN="LEFT"
  22935. VALIGN="MIDDLE"
  22936. >Rovnost</TD
  22937. ><TD
  22938. ALIGN="LEFT"
  22939. VALIGN="MIDDLE"
  22940. ><TT
  22941. CLASS="constant"
  22942. ><B
  22943. >TRUE</B
  22944. ></TT
  22945. >, prßv∞ kdy╛ je $a rovno $b.</TD
  22946. ></TR
  22947. ><TR
  22948. ><TD
  22949. ALIGN="LEFT"
  22950. VALIGN="MIDDLE"
  22951. >$a === $b</TD
  22952. ><TD
  22953. ALIGN="LEFT"
  22954. VALIGN="MIDDLE"
  22955. >Identita</TD
  22956. ><TD
  22957. ALIGN="LEFT"
  22958. VALIGN="MIDDLE"
  22959. >     <TT
  22960. CLASS="constant"
  22961. ><B
  22962. >TRUE</B
  22963. ></TT
  22964. > kdy╛ je $a rovno $b a navφc tΘto╛ typu (pouze PHP 4).
  22965.        </TD
  22966. ></TR
  22967. ><TR
  22968. ><TD
  22969. ALIGN="LEFT"
  22970. VALIGN="MIDDLE"
  22971. >$a != $b</TD
  22972. ><TD
  22973. ALIGN="LEFT"
  22974. VALIGN="MIDDLE"
  22975. >Nerovnost</TD
  22976. ><TD
  22977. ALIGN="LEFT"
  22978. VALIGN="MIDDLE"
  22979. ><TT
  22980. CLASS="constant"
  22981. ><B
  22982. >TRUE</B
  22983. ></TT
  22984. > prßv∞ kdy╛ $a nenφ rovno $b.</TD
  22985. ></TR
  22986. ><TR
  22987. ><TD
  22988. ALIGN="LEFT"
  22989. VALIGN="MIDDLE"
  22990. >$a <> $b</TD
  22991. ><TD
  22992. ALIGN="LEFT"
  22993. VALIGN="MIDDLE"
  22994. >Nerovnost</TD
  22995. ><TD
  22996. ALIGN="LEFT"
  22997. VALIGN="MIDDLE"
  22998. ><TT
  22999. CLASS="constant"
  23000. ><B
  23001. >TRUE</B
  23002. ></TT
  23003. > prßv∞ kdy╛ $a nenφ rovno $b.</TD
  23004. ></TR
  23005. ><TR
  23006. ><TD
  23007. ALIGN="LEFT"
  23008. VALIGN="MIDDLE"
  23009. >$a !== $b</TD
  23010. ><TD
  23011. ALIGN="LEFT"
  23012. VALIGN="MIDDLE"
  23013. >Neidentita</TD
  23014. ><TD
  23015. ALIGN="LEFT"
  23016. VALIGN="MIDDLE"
  23017. >     <TT
  23018. CLASS="constant"
  23019. ><B
  23020. >TRUE</B
  23021. ></TT
  23022. > kdy╛ $a nenφ rovno $b nebo nejsou tΘho╛ typu (pouze PHP 4).
  23023.        </TD
  23024. ></TR
  23025. ><TR
  23026. ><TD
  23027. ALIGN="LEFT"
  23028. VALIGN="MIDDLE"
  23029. >$a < $b</TD
  23030. ><TD
  23031. ALIGN="LEFT"
  23032. VALIGN="MIDDLE"
  23033. >Men╣φ ne╛</TD
  23034. ><TD
  23035. ALIGN="LEFT"
  23036. VALIGN="MIDDLE"
  23037. ><TT
  23038. CLASS="constant"
  23039. ><B
  23040. >TRUE</B
  23041. ></TT
  23042. > kdy╛ je $a ost°e men╣φ ne╛ $b.</TD
  23043. ></TR
  23044. ><TR
  23045. ><TD
  23046. ALIGN="LEFT"
  23047. VALIGN="MIDDLE"
  23048. >$a > $b</TD
  23049. ><TD
  23050. ALIGN="LEFT"
  23051. VALIGN="MIDDLE"
  23052. >V∞t╣φ ne╛</TD
  23053. ><TD
  23054. ALIGN="LEFT"
  23055. VALIGN="MIDDLE"
  23056. ><TT
  23057. CLASS="constant"
  23058. ><B
  23059. >TRUE</B
  23060. ></TT
  23061. > kdy╛ je $a ost°e v∞t╣φ ne╛ $b.</TD
  23062. ></TR
  23063. ><TR
  23064. ><TD
  23065. ALIGN="LEFT"
  23066. VALIGN="MIDDLE"
  23067. >$a <= $b</TD
  23068. ><TD
  23069. ALIGN="LEFT"
  23070. VALIGN="MIDDLE"
  23071. >Men╣φ nebo rovno</TD
  23072. ><TD
  23073. ALIGN="LEFT"
  23074. VALIGN="MIDDLE"
  23075. ><TT
  23076. CLASS="constant"
  23077. ><B
  23078. >TRUE</B
  23079. ></TT
  23080. > kdy╛ je $a men╣φ nebo rovno $b.</TD
  23081. ></TR
  23082. ><TR
  23083. ><TD
  23084. ALIGN="LEFT"
  23085. VALIGN="MIDDLE"
  23086. >$a >= $b</TD
  23087. ><TD
  23088. ALIGN="LEFT"
  23089. VALIGN="MIDDLE"
  23090. >V∞t╣φ nebo rovno</TD
  23091. ><TD
  23092. ALIGN="LEFT"
  23093. VALIGN="MIDDLE"
  23094. ><TT
  23095. CLASS="constant"
  23096. ><B
  23097. >TRUE</B
  23098. ></TT
  23099. > kdy╛ je $a v∞t╣φ nebo rovno $b.</TD
  23100. ></TR
  23101. ></TBODY
  23102. ></TABLE
  23103. ></DIV
  23104. ><P
  23105. >     Jin²m podmφnkov²m operßtorem je "?:" (ternßrnφ) operßtor, kter² funguje
  23106.     stejn∞ jako v C a mnoh²ch jin²ch jazycφch.
  23107.     <DIV
  23108. CLASS="informalexample"
  23109. ><A
  23110. NAME="AEN4534"
  23111. ></A
  23112. ><P
  23113. ></P
  23114. ><TABLE
  23115. BORDER="0"
  23116. BGCOLOR="#E0E0E0"
  23117. CELLPADDING="5"
  23118. ><TR
  23119. ><TD
  23120. ><PRE
  23121. CLASS="programlisting"
  23122. >(expr1) ? (expr2) : (expr3);</PRE
  23123. ></TD
  23124. ></TR
  23125. ></TABLE
  23126. ><P
  23127. ></P
  23128. ></DIV
  23129.     V²raz je ohodnocen jako hodnota <TT
  23130. CLASS="replaceable"
  23131. ><I
  23132. >expr2</I
  23133. ></TT
  23134. > kdy╛
  23135.     mß <TT
  23136. CLASS="replaceable"
  23137. ><I
  23138. >expr1</I
  23139. ></TT
  23140. > hodnotu <TT
  23141. CLASS="constant"
  23142. ><B
  23143. >TRUE</B
  23144. ></TT
  23145. >, a
  23146.     <TT
  23147. CLASS="replaceable"
  23148. ><I
  23149. >expr3</I
  23150. ></TT
  23151. > kdy╛
  23152.     mß <TT
  23153. CLASS="replaceable"
  23154. ><I
  23155. >expr1</I
  23156. ></TT
  23157. > hodnotu <TT
  23158. CLASS="constant"
  23159. ><B
  23160. >FALSE</B
  23161. ></TT
  23162. >.
  23163.    </P
  23164. ></DIV
  23165. ><DIV
  23166. CLASS="sect1"
  23167. ><HR><H2
  23168. CLASS="sect1"
  23169. ><A
  23170. NAME="language.operators.errorcontrol"
  23171. ></A
  23172. >Operßtory °φzenφ chyb</H2
  23173. ><P
  23174. >     PHP podporuje jeden operßtor °φzenφ chyb: znak at (@). Kdy╛ ho p°ed°adφte
  23175.     v²razu v PHP, jakΘkoli chybovΘ zprßvy, kterΘ se mohou generovat ve
  23176.     v²razu, budou ignorovßny. 
  23177.    </P
  23178. ><P
  23179. >     Pokud je zapnuto<A
  23180. HREF="#ini.track-errors"
  23181. >track_errors</A
  23182. >,
  23183.     budou se v╣echny chybovΘ zprßvy generovanΘ v²razem uklßdat do globßlnφ
  23184.     prom∞nnΘ $php_errormsg. Tato prom∞nnß bude p°epsßna p°i ka╛dΘ chyb∞,
  23185.     tak╛e ji testujte v╛dy co nejd°φve, pokud ji chcete pou╛φvat.
  23186.    </P
  23187. ><P
  23188. >     <DIV
  23189. CLASS="informalexample"
  23190. ><A
  23191. NAME="AEN4548"
  23192. ></A
  23193. ><P
  23194. ></P
  23195. ><TABLE
  23196. BORDER="0"
  23197. BGCOLOR="#E0E0E0"
  23198. CELLPADDING="5"
  23199. ><TR
  23200. ><TD
  23201. ><PRE
  23202. CLASS="php"
  23203. ><?php
  23204. /* Intentional file error */
  23205. $my_file = @file ('non_existent_file') or
  23206.     die ("Failed opening file: error was '$php_errormsg'");
  23207.  
  23208. // this works for any expression, not just functions:
  23209. $value = @$cache[$key]; 
  23210. // will not issue a notice if the index $key doesn't exist.
  23211.  
  23212. ?></PRE
  23213. ></TD
  23214. ></TR
  23215. ></TABLE
  23216. ><P
  23217. ></P
  23218. ></DIV
  23219. >
  23220.    </P
  23221. ><DIV
  23222. CLASS="note"
  23223. ><BLOCKQUOTE
  23224. CLASS="note"
  23225. ><P
  23226. ><B
  23227. >Poznßmka: </B
  23228. >
  23229.      Operßtor @ pracuje pouze na v²razech. Platφ jednoduchΘ pravidlo:
  23230.      m∙╛ete-li zφskat hodnotu n∞Φeho, m∙╛ete p°ed to dßt operßtor @.
  23231.      To se t²kß nap°φklad prom∞nn²ch, funkcφ, volßnφ
  23232.      <A
  23233. HREF="#function.include"
  23234. ><B
  23235. CLASS="function"
  23236. >include()</B
  23237. ></A
  23238. > konstant a podobn∞. Nem∙╛ete ho p°ed°adit
  23239.      definicφm funkcφ nebo t°φd a podmφnkov²m strukturßm typu
  23240.      <TT
  23241. CLASS="literal"
  23242. >if</TT
  23243. > nebo <TT
  23244. CLASS="literal"
  23245. >foreach</TT
  23246. >.
  23247.     </P
  23248. ></BLOCKQUOTE
  23249. ></DIV
  23250. ><P
  23251. >     Viz takΘ <A
  23252. HREF="#function.error-reporting"
  23253. ><B
  23254. CLASS="function"
  23255. >error_reporting()</B
  23256. ></A
  23257. >.
  23258.    </P
  23259. ><DIV
  23260. CLASS="warning"
  23261. ><P
  23262. ></P
  23263. ><TABLE
  23264. CLASS="warning"
  23265. BORDER="1"
  23266. WIDTH="100%"
  23267. ><TR
  23268. ><TD
  23269. ALIGN="CENTER"
  23270. ><B
  23271. >Varovßnφ</B
  23272. ></TD
  23273. ></TR
  23274. ><TR
  23275. ><TD
  23276. ALIGN="LEFT"
  23277. ><P
  23278. >      V souΦasnosti p°ed°azenφ operßtoru °φzenφ chyb "@" vy°adφ i hlß╣enφ
  23279.      kritick²ch chyb, kterΘ zp∙sobφ ukonΦenφ provßd∞nφ skriptu. To mj.
  23280.      znamenß, ╛e pokud pou╛ijete "@" k potlaΦenφ chyb z n∞jakΘ funkce,
  23281.      a tato funkce nenφ k dispozici nebo obsahuje chyby, skript zde skonΦφ
  23282.      bez jakΘkoli indikace, co se stalo.
  23283.     </P
  23284. ></TD
  23285. ></TR
  23286. ></TABLE
  23287. ></DIV
  23288. ></DIV
  23289. ><DIV
  23290. CLASS="sect1"
  23291. ><HR><H2
  23292. CLASS="sect1"
  23293. ><A
  23294. NAME="language.operators.execution"
  23295. ></A
  23296. >Provßd∞cφ operßtory</H2
  23297. ><P
  23298. >     PHP podporuje jeden provßd∞cφ operßtor: obrßcenΘ apostrofy (``).
  23299.     Uv∞domte si, ╛e to nejsou obyΦejnΘ apostrofy! PHP se pokusφ provΘst
  23300.     obsah uzav°en² mezi t∞mito znaky jako p°φkaz shellu; v²stup je vrßcen
  23301.     (tzn. nebude pouze vypsßn na v²stup∙ m∙╛e b²t p°i°azen prom∞nnΘ).
  23302.     <DIV
  23303. CLASS="informalexample"
  23304. ><A
  23305. NAME="AEN4562"
  23306. ></A
  23307. ><P
  23308. ></P
  23309. ><TABLE
  23310. BORDER="0"
  23311. BGCOLOR="#E0E0E0"
  23312. CELLPADDING="5"
  23313. ><TR
  23314. ><TD
  23315. ><PRE
  23316. CLASS="php"
  23317. >$output = `ls -al`;
  23318. echo "<pre>$output</pre>";</PRE
  23319. ></TD
  23320. ></TR
  23321. ></TABLE
  23322. ><P
  23323. ></P
  23324. ></DIV
  23325. >
  23326.    </P
  23327. ><DIV
  23328. CLASS="note"
  23329. ><BLOCKQUOTE
  23330. CLASS="note"
  23331. ><P
  23332. ><B
  23333. >Poznßmka: </B
  23334. >
  23335.      Operßtor m∙╛e b²t vy°azen, pokud je aktivnφ
  23336.      <A
  23337. HREF="#ini.safe-mode"
  23338. >bezpeΦn² re╛im</A
  23339. > nebo je vypnuto
  23340.      <A
  23341. HREF="#function.shell-exec"
  23342. ><B
  23343. CLASS="function"
  23344. >shell_exec()</B
  23345. ></A
  23346. >.
  23347.     </P
  23348. ></BLOCKQUOTE
  23349. ></DIV
  23350. ><P
  23351. >     Viz takΘ <A
  23352. HREF="#function.escapeshellcmd"
  23353. ><B
  23354. CLASS="function"
  23355. >escapeshellcmd()</B
  23356. ></A
  23357. >, <A
  23358. HREF="#function.exec"
  23359. ><B
  23360. CLASS="function"
  23361. >exec()</B
  23362. ></A
  23363. >,
  23364.     <A
  23365. HREF="#function.passthru"
  23366. ><B
  23367. CLASS="function"
  23368. >passthru()</B
  23369. ></A
  23370. >, <A
  23371. HREF="#function.popen"
  23372. ><B
  23373. CLASS="function"
  23374. >popen()</B
  23375. ></A
  23376. >,
  23377.     <A
  23378. HREF="#function.shell-exec"
  23379. ><B
  23380. CLASS="function"
  23381. >shell_exec()</B
  23382. ></A
  23383. >, a <A
  23384. HREF="#function.system"
  23385. ><B
  23386. CLASS="function"
  23387. >system()</B
  23388. ></A
  23389. >.
  23390.    </P
  23391. ></DIV
  23392. ><DIV
  23393. CLASS="sect1"
  23394. ><HR><H2
  23395. CLASS="sect1"
  23396. ><A
  23397. NAME="language.operators.increment"
  23398. ></A
  23399. >InkrementaΦnφ/DekrementaΦnφ operßtory</H2
  23400. ><P
  23401. >     PHP podporuje pre- a post inkrementaΦnφ a dekrementaΦnφ operßtory ve
  23402.     stylu C.
  23403.    </P
  23404. ><DIV
  23405. CLASS="table"
  23406. ><A
  23407. NAME="AEN4578"
  23408. ></A
  23409. ><P
  23410. ><B
  23411. >Tabulka 10-4. InkrementaΦnφ/dekrementaΦnφ operßtory</B
  23412. ></P
  23413. ><TABLE
  23414. BORDER="1"
  23415. CLASS="CALSTABLE"
  23416. ><THEAD
  23417. ><TR
  23418. ><TH
  23419. ALIGN="LEFT"
  23420. VALIGN="MIDDLE"
  23421. >P°φklad</TH
  23422. ><TH
  23423. ALIGN="LEFT"
  23424. VALIGN="MIDDLE"
  23425. >Nßzev</TH
  23426. ><TH
  23427. ALIGN="LEFT"
  23428. VALIGN="MIDDLE"
  23429. >┌Φinek</TH
  23430. ></TR
  23431. ></THEAD
  23432. ><TBODY
  23433. ><TR
  23434. ><TD
  23435. ALIGN="LEFT"
  23436. VALIGN="MIDDLE"
  23437. >++$a</TD
  23438. ><TD
  23439. ALIGN="LEFT"
  23440. VALIGN="MIDDLE"
  23441. >Pre-inkrementace</TD
  23442. ><TD
  23443. ALIGN="LEFT"
  23444. VALIGN="MIDDLE"
  23445. >Inkrementuje $a o jedniΦku, potom vrßtφ $a.</TD
  23446. ></TR
  23447. ><TR
  23448. ><TD
  23449. ALIGN="LEFT"
  23450. VALIGN="MIDDLE"
  23451. >$a++</TD
  23452. ><TD
  23453. ALIGN="LEFT"
  23454. VALIGN="MIDDLE"
  23455. >Post-inkrementace</TD
  23456. ><TD
  23457. ALIGN="LEFT"
  23458. VALIGN="MIDDLE"
  23459. >Vrßtφ $a, potom inkrementuje $a o jedniΦku.</TD
  23460. ></TR
  23461. ><TR
  23462. ><TD
  23463. ALIGN="LEFT"
  23464. VALIGN="MIDDLE"
  23465. >--$a</TD
  23466. ><TD
  23467. ALIGN="LEFT"
  23468. VALIGN="MIDDLE"
  23469. >Pre-dekrementace</TD
  23470. ><TD
  23471. ALIGN="LEFT"
  23472. VALIGN="MIDDLE"
  23473. >Dekrementuje $a o jedniΦku, potom vrßtφ $a.</TD
  23474. ></TR
  23475. ><TR
  23476. ><TD
  23477. ALIGN="LEFT"
  23478. VALIGN="MIDDLE"
  23479. >$a--</TD
  23480. ><TD
  23481. ALIGN="LEFT"
  23482. VALIGN="MIDDLE"
  23483. >Post-dekrementace</TD
  23484. ><TD
  23485. ALIGN="LEFT"
  23486. VALIGN="MIDDLE"
  23487. >Vrßtφ $a, potom dkrementuje $a o jedniΦku.</TD
  23488. ></TR
  23489. ></TBODY
  23490. ></TABLE
  23491. ></DIV
  23492. ><P
  23493. >     Zde je p°φklad jednoduchΘho skriptu:
  23494.     <DIV
  23495. CLASS="informalexample"
  23496. ><A
  23497. NAME="AEN4604"
  23498. ></A
  23499. ><P
  23500. ></P
  23501. ><TABLE
  23502. BORDER="0"
  23503. BGCOLOR="#E0E0E0"
  23504. CELLPADDING="5"
  23505. ><TR
  23506. ><TD
  23507. ><PRE
  23508. CLASS="php"
  23509. ><?php
  23510. echo "<h3&gt;Postinkrementace</h3&gt;";
  23511. $a = 5;
  23512. echo "M∞lo by b²t 5: " . $a++ . "<br>\n";
  23513. echo "M∞lo by b²t 6: " . $a . "<br>\n";
  23514.  
  23515. echo "<h3>Preinkrementace</h3>";
  23516. $a = 5;
  23517. echo "M∞lo by b²t 6: " . ++$a . "<br>\n";
  23518. echo "M∞lo by b²t 6: " . $a . "<br>\n";
  23519.  
  23520. echo "<h3>Postdekrementace</h3>";
  23521. $a = 5;
  23522. echo "M∞lo by b²t 5: " . $a-- . "<br>\n";
  23523. echo "M∞lo by b²t: " . $a . "<br>\n";
  23524.  
  23525. echo "<h3>Predekrementace</h3>";
  23526. $a = 5;
  23527. echo "M∞lo by b²t 4: " . --$a . "<br>\n";
  23528. echo "M∞lo by b²t 4: " . $a . "<br>\n";
  23529. ?></PRE
  23530. ></TD
  23531. ></TR
  23532. ></TABLE
  23533. ><P
  23534. ></P
  23535. ></DIV
  23536. >
  23537.    </P
  23538. ></DIV
  23539. ><DIV
  23540. CLASS="sect1"
  23541. ><HR><H2
  23542. CLASS="sect1"
  23543. ><A
  23544. NAME="language.operators.logical"
  23545. ></A
  23546. >LogickΘ operßtory</H2
  23547. ><DIV
  23548. CLASS="table"
  23549. ><A
  23550. NAME="AEN4608"
  23551. ></A
  23552. ><P
  23553. ><B
  23554. >Tabulka 10-5. LogickΘ operßtory</B
  23555. ></P
  23556. ><TABLE
  23557. BORDER="1"
  23558. CLASS="CALSTABLE"
  23559. ><THEAD
  23560. ><TR
  23561. ><TH
  23562. ALIGN="LEFT"
  23563. VALIGN="MIDDLE"
  23564. >P°φklad</TH
  23565. ><TH
  23566. ALIGN="LEFT"
  23567. VALIGN="MIDDLE"
  23568. >Nßzev</TH
  23569. ><TH
  23570. ALIGN="LEFT"
  23571. VALIGN="MIDDLE"
  23572. >V²sledek</TH
  23573. ></TR
  23574. ></THEAD
  23575. ><TBODY
  23576. ><TR
  23577. ><TD
  23578. ALIGN="LEFT"
  23579. VALIGN="MIDDLE"
  23580. >$a and $b</TD
  23581. ><TD
  23582. ALIGN="LEFT"
  23583. VALIGN="MIDDLE"
  23584. >And</TD
  23585. ><TD
  23586. ALIGN="LEFT"
  23587. VALIGN="MIDDLE"
  23588. ><TT
  23589. CLASS="constant"
  23590. ><B
  23591. >TRUE</B
  23592. ></TT
  23593. > kdy╛ $a i $b jsou <TT
  23594. CLASS="constant"
  23595. ><B
  23596. >TRUE</B
  23597. ></TT
  23598. >.</TD
  23599. ></TR
  23600. ><TR
  23601. ><TD
  23602. ALIGN="LEFT"
  23603. VALIGN="MIDDLE"
  23604. >$a or $b</TD
  23605. ><TD
  23606. ALIGN="LEFT"
  23607. VALIGN="MIDDLE"
  23608. >Or</TD
  23609. ><TD
  23610. ALIGN="LEFT"
  23611. VALIGN="MIDDLE"
  23612. ><TT
  23613. CLASS="constant"
  23614. ><B
  23615. >TRUE</B
  23616. ></TT
  23617. > kdy╛ $a nebo $b je <TT
  23618. CLASS="constant"
  23619. ><B
  23620. >TRUE</B
  23621. ></TT
  23622. >.</TD
  23623. ></TR
  23624. ><TR
  23625. ><TD
  23626. ALIGN="LEFT"
  23627. VALIGN="MIDDLE"
  23628. >$a xor $b</TD
  23629. ><TD
  23630. ALIGN="LEFT"
  23631. VALIGN="MIDDLE"
  23632. >Xor</TD
  23633. ><TD
  23634. ALIGN="LEFT"
  23635. VALIGN="MIDDLE"
  23636. ><TT
  23637. CLASS="constant"
  23638. ><B
  23639. >TRUE</B
  23640. ></TT
  23641. > kdy╛ $a nebo $b je <TT
  23642. CLASS="constant"
  23643. ><B
  23644. >TRUE</B
  23645. ></TT
  23646. >, ale ne oba souΦasn∞.</TD
  23647. ></TR
  23648. ><TR
  23649. ><TD
  23650. ALIGN="LEFT"
  23651. VALIGN="MIDDLE"
  23652. >! $a</TD
  23653. ><TD
  23654. ALIGN="LEFT"
  23655. VALIGN="MIDDLE"
  23656. >Not</TD
  23657. ><TD
  23658. ALIGN="LEFT"
  23659. VALIGN="MIDDLE"
  23660. ><TT
  23661. CLASS="constant"
  23662. ><B
  23663. >TRUE</B
  23664. ></TT
  23665. > kdy╛ $a nenφ <TT
  23666. CLASS="constant"
  23667. ><B
  23668. >TRUE</B
  23669. ></TT
  23670. >.</TD
  23671. ></TR
  23672. ><TR
  23673. ><TD
  23674. ALIGN="LEFT"
  23675. VALIGN="MIDDLE"
  23676. >$a && $b</TD
  23677. ><TD
  23678. ALIGN="LEFT"
  23679. VALIGN="MIDDLE"
  23680. >And</TD
  23681. ><TD
  23682. ALIGN="LEFT"
  23683. VALIGN="MIDDLE"
  23684. ><TT
  23685. CLASS="constant"
  23686. ><B
  23687. >TRUE</B
  23688. ></TT
  23689. > kdy╛ $a i $b jsou <TT
  23690. CLASS="constant"
  23691. ><B
  23692. >TRUE</B
  23693. ></TT
  23694. >.</TD
  23695. ></TR
  23696. ><TR
  23697. ><TD
  23698. ALIGN="LEFT"
  23699. VALIGN="MIDDLE"
  23700. >$a || $b</TD
  23701. ><TD
  23702. ALIGN="LEFT"
  23703. VALIGN="MIDDLE"
  23704. >Or</TD
  23705. ><TD
  23706. ALIGN="LEFT"
  23707. VALIGN="MIDDLE"
  23708. ><TT
  23709. CLASS="constant"
  23710. ><B
  23711. >TRUE</B
  23712. ></TT
  23713. > kdy╛ $a nebo $b je <TT
  23714. CLASS="constant"
  23715. ><B
  23716. >TRUE</B
  23717. ></TT
  23718. >.</TD
  23719. ></TR
  23720. ></TBODY
  23721. ></TABLE
  23722. ></DIV
  23723. ><P
  23724. >     D∙vodem pro dv∞ r∙znΘ varianty operßtor∙  "and" a "or" je to, ╛e majφ
  23725.     jinou prioritu. (Viz <A
  23726. HREF="#language.operators.precedence"
  23727. >Priorita
  23728.     operßtor∙</A
  23729. >.)
  23730.    </P
  23731. ></DIV
  23732. ><DIV
  23733. CLASS="sect1"
  23734. ><HR><H2
  23735. CLASS="sect1"
  23736. ><A
  23737. NAME="language.operators.precedence"
  23738. ></A
  23739. >Priorita operßtor∙</H2
  23740. ><P
  23741. >     Priorita operßtoru specifikuje, jak "t∞sn∞" vß╛e dva v²razy mezi sebou.
  23742.     Nap°φklad v²raz <TT
  23743. CLASS="literal"
  23744. >1 + 5 * 3</TT
  23745. >,
  23746.     v²sledkem je <TT
  23747. CLASS="literal"
  23748. >16</TT
  23749. > a nikoli <TT
  23750. CLASS="literal"
  23751. >18</TT
  23752. >,
  23753.     proto╛e operßtor nßsobenφ ("*") mß vy╣╣φ prioritu ne╛ operßtor sΦφtßnφ
  23754.     ("+"). K vynucenφ priority m∙╛eme v p°φpad∞ pot°eby pou╛φt zßvorky.
  23755.     Kup°. <TT
  23756. CLASS="literal"
  23757. >(1 + 5) * 3</TT
  23758. > mß hodnotu <TT
  23759. CLASS="literal"
  23760. >18</TT
  23761. >.
  23762.    </P
  23763. ><P
  23764. >     Nßsledujφcφ tabulka ukazuje p°ehled operßtor∙ vzestupn∞ se°azen²ch podle
  23765.     priority.
  23766.     <DIV
  23767. CLASS="table"
  23768. ><A
  23769. NAME="AEN4664"
  23770. ></A
  23771. ><P
  23772. ><B
  23773. >Tabulka 10-6. Priorita operßtor∙</B
  23774. ></P
  23775. ><TABLE
  23776. BORDER="1"
  23777. CLASS="CALSTABLE"
  23778. ><THEAD
  23779. ><TR
  23780. ><TH
  23781. ALIGN="LEFT"
  23782. VALIGN="MIDDLE"
  23783. >Asociativita</TH
  23784. ><TH
  23785. ALIGN="LEFT"
  23786. VALIGN="MIDDLE"
  23787. >Operßtory</TH
  23788. ></TR
  23789. ></THEAD
  23790. ><TBODY
  23791. ><TR
  23792. ><TD
  23793. ALIGN="LEFT"
  23794. VALIGN="MIDDLE"
  23795. >levß</TD
  23796. ><TD
  23797. ALIGN="LEFT"
  23798. VALIGN="MIDDLE"
  23799. >,</TD
  23800. ></TR
  23801. ><TR
  23802. ><TD
  23803. ALIGN="LEFT"
  23804. VALIGN="MIDDLE"
  23805. >levß</TD
  23806. ><TD
  23807. ALIGN="LEFT"
  23808. VALIGN="MIDDLE"
  23809. >or</TD
  23810. ></TR
  23811. ><TR
  23812. ><TD
  23813. ALIGN="LEFT"
  23814. VALIGN="MIDDLE"
  23815. >levß</TD
  23816. ><TD
  23817. ALIGN="LEFT"
  23818. VALIGN="MIDDLE"
  23819. >xor</TD
  23820. ></TR
  23821. ><TR
  23822. ><TD
  23823. ALIGN="LEFT"
  23824. VALIGN="MIDDLE"
  23825. >levß</TD
  23826. ><TD
  23827. ALIGN="LEFT"
  23828. VALIGN="MIDDLE"
  23829. >and</TD
  23830. ></TR
  23831. ><TR
  23832. ><TD
  23833. ALIGN="LEFT"
  23834. VALIGN="MIDDLE"
  23835. >pravß</TD
  23836. ><TD
  23837. ALIGN="LEFT"
  23838. VALIGN="MIDDLE"
  23839. >print</TD
  23840. ></TR
  23841. ><TR
  23842. ><TD
  23843. ALIGN="LEFT"
  23844. VALIGN="MIDDLE"
  23845. >levß</TD
  23846. ><TD
  23847. ALIGN="LEFT"
  23848. VALIGN="MIDDLE"
  23849. >          = += -= *= /= .= %= &= |= ^= ~= <<= >>=
  23850.         </TD
  23851. ></TR
  23852. ><TR
  23853. ><TD
  23854. ALIGN="LEFT"
  23855. VALIGN="MIDDLE"
  23856. >levß</TD
  23857. ><TD
  23858. ALIGN="LEFT"
  23859. VALIGN="MIDDLE"
  23860. >? :</TD
  23861. ></TR
  23862. ><TR
  23863. ><TD
  23864. ALIGN="LEFT"
  23865. VALIGN="MIDDLE"
  23866. >levß</TD
  23867. ><TD
  23868. ALIGN="LEFT"
  23869. VALIGN="MIDDLE"
  23870. >||</TD
  23871. ></TR
  23872. ><TR
  23873. ><TD
  23874. ALIGN="LEFT"
  23875. VALIGN="MIDDLE"
  23876. >levß</TD
  23877. ><TD
  23878. ALIGN="LEFT"
  23879. VALIGN="MIDDLE"
  23880. >&&</TD
  23881. ></TR
  23882. ><TR
  23883. ><TD
  23884. ALIGN="LEFT"
  23885. VALIGN="MIDDLE"
  23886. >levß</TD
  23887. ><TD
  23888. ALIGN="LEFT"
  23889. VALIGN="MIDDLE"
  23890. >|</TD
  23891. ></TR
  23892. ><TR
  23893. ><TD
  23894. ALIGN="LEFT"
  23895. VALIGN="MIDDLE"
  23896. >levß</TD
  23897. ><TD
  23898. ALIGN="LEFT"
  23899. VALIGN="MIDDLE"
  23900. >^</TD
  23901. ></TR
  23902. ><TR
  23903. ><TD
  23904. ALIGN="LEFT"
  23905. VALIGN="MIDDLE"
  23906. >levß</TD
  23907. ><TD
  23908. ALIGN="LEFT"
  23909. VALIGN="MIDDLE"
  23910. >&</TD
  23911. ></TR
  23912. ><TR
  23913. ><TD
  23914. ALIGN="LEFT"
  23915. VALIGN="MIDDLE"
  23916. >bez asociativity</TD
  23917. ><TD
  23918. ALIGN="LEFT"
  23919. VALIGN="MIDDLE"
  23920. >== != === !==</TD
  23921. ></TR
  23922. ><TR
  23923. ><TD
  23924. ALIGN="LEFT"
  23925. VALIGN="MIDDLE"
  23926. >bez asociativity</TD
  23927. ><TD
  23928. ALIGN="LEFT"
  23929. VALIGN="MIDDLE"
  23930. >< <= > >=</TD
  23931. ></TR
  23932. ><TR
  23933. ><TD
  23934. ALIGN="LEFT"
  23935. VALIGN="MIDDLE"
  23936. >levß</TD
  23937. ><TD
  23938. ALIGN="LEFT"
  23939. VALIGN="MIDDLE"
  23940. ><< >></TD
  23941. ></TR
  23942. ><TR
  23943. ><TD
  23944. ALIGN="LEFT"
  23945. VALIGN="MIDDLE"
  23946. >levß</TD
  23947. ><TD
  23948. ALIGN="LEFT"
  23949. VALIGN="MIDDLE"
  23950. >+ - .</TD
  23951. ></TR
  23952. ><TR
  23953. ><TD
  23954. ALIGN="LEFT"
  23955. VALIGN="MIDDLE"
  23956. >levß</TD
  23957. ><TD
  23958. ALIGN="LEFT"
  23959. VALIGN="MIDDLE"
  23960. >* / %</TD
  23961. ></TR
  23962. ><TR
  23963. ><TD
  23964. ALIGN="LEFT"
  23965. VALIGN="MIDDLE"
  23966. >pravß</TD
  23967. ><TD
  23968. ALIGN="LEFT"
  23969. VALIGN="MIDDLE"
  23970. >! ~ ++ -- (int) (double) (string) (array) (object) @</TD
  23971. ></TR
  23972. ><TR
  23973. ><TD
  23974. ALIGN="LEFT"
  23975. VALIGN="MIDDLE"
  23976. >pravß</TD
  23977. ><TD
  23978. ALIGN="LEFT"
  23979. VALIGN="MIDDLE"
  23980. >[</TD
  23981. ></TR
  23982. ><TR
  23983. ><TD
  23984. ALIGN="LEFT"
  23985. VALIGN="MIDDLE"
  23986. >bez asociativity</TD
  23987. ><TD
  23988. ALIGN="LEFT"
  23989. VALIGN="MIDDLE"
  23990. >new</TD
  23991. ></TR
  23992. ></TBODY
  23993. ></TABLE
  23994. ></DIV
  23995. >
  23996.    </P
  23997. ></DIV
  23998. ><DIV
  23999. CLASS="sect1"
  24000. ><HR><H2
  24001. CLASS="sect1"
  24002. ><A
  24003. NAME="language.operators.string"
  24004. ></A
  24005. >╪et∞zcovΘ operßtory</H2
  24006. ><P
  24007. >     Existujφ dva °etezcovΘ operßtory. Jednφm je operßtor spojenφ ('.'),
  24008.     kter² vracφ spojenφ pravΘho a levΘho argumentu. Druh²m je operßtor
  24009.     spojujφcφho p°i°azenφ ('.='), jen╛ p°ipojφ argument na pravΘ stran∞
  24010.     k argumentu na stran∞ levΘ. Pro vφce informacφ si laskav∞ p°eΦt∞te 
  24011.     <A
  24012. HREF="#language.operators.assignment"
  24013. >Operßtory p°i°azenφ</A
  24014. >.
  24015.    </P
  24016. ><P
  24017. >     <DIV
  24018. CLASS="informalexample"
  24019. ><A
  24020. NAME="AEN4737"
  24021. ></A
  24022. ><P
  24023. ></P
  24024. ><TABLE
  24025. BORDER="0"
  24026. BGCOLOR="#E0E0E0"
  24027. CELLPADDING="5"
  24028. ><TR
  24029. ><TD
  24030. ><PRE
  24031. CLASS="php"
  24032. >$a = "Ahoj ";
  24033. $b = $a . "sv∞te!"; // nynφ $b obsahuje "Ahoj sv∞te!"
  24034.  
  24035. $a = "Ahoj ";
  24036. $a .= "sv∞te!";     // nynφ $a obsahuje "Ahoj sv∞te!"</PRE
  24037. ></TD
  24038. ></TR
  24039. ></TABLE
  24040. ><P
  24041. ></P
  24042. ></DIV
  24043. >
  24044.    </P
  24045. ></DIV
  24046. ></DIV
  24047. ><DIV
  24048. CLASS="chapter"
  24049. ><HR><H1
  24050. ><A
  24051. NAME="control-structures"
  24052. >Kapitola 11. ╪φdicφ struktury</A
  24053. ></H1
  24054. ><P
  24055. >    Jak²koli PHP skript je slo╛en ze sΘrie konstrukt∙. Konstrukt m∙╛e b²t
  24056.    p°i°azenφ, volßnφ funkce, cyklus, podmφnka, stejn∞ jako konstrukt, kter²
  24057.    nic ned∞lß (prßzdn² konstrukt). Konstrukt obvykle konΦφ st°ednφkem.
  24058.    Navφc lze konstrukty seskupit do skupiny (bloku) uzav°enΘ slo╛en²mi
  24059.    zßvorkami. Tento blok je sßm o sob∞ konstruktem. V tΘto kapitole jsou
  24060.    popsßny r∙znΘ typy konstrukt∙.
  24061.   </P
  24062. ><DIV
  24063. CLASS="sect1"
  24064. ><HR><H2
  24065. CLASS="sect1"
  24066. ><A
  24067. NAME="control-structures.if"
  24068. ></A
  24069. ><TT
  24070. CLASS="literal"
  24071. >if</TT
  24072. ></H2
  24073. ><P
  24074. >     Konstrukt <TT
  24075. CLASS="literal"
  24076. >if</TT
  24077. > je jednφm z nejd∙le╛it∞j╣φch prvk∙ v
  24078.     mnoha jazycφch, vΦetn∞ PHP. Umo╛≥uje podmφn∞nΘ provßd∞nφ kusu k≤du.
  24079.     Struktura <TT
  24080. CLASS="literal"
  24081. >if</TT
  24082. > v PHP je podobnß struktu°e v C:
  24083.     <DIV
  24084. CLASS="informalexample"
  24085. ><A
  24086. NAME="AEN4748"
  24087. ></A
  24088. ><P
  24089. ></P
  24090. ><TABLE
  24091. BORDER="0"
  24092. BGCOLOR="#E0E0E0"
  24093. CELLPADDING="5"
  24094. ><TR
  24095. ><TD
  24096. ><PRE
  24097. CLASS="programlisting"
  24098. >if (expr)
  24099.     statement</PRE
  24100. ></TD
  24101. ></TR
  24102. ></TABLE
  24103. ><P
  24104. ></P
  24105. ></DIV
  24106. >
  24107.    </P
  24108. ><P
  24109. >     Jak je popsßno v
  24110.     <A
  24111. HREF="#language.expressions"
  24112. >sekci o v²razech</A
  24113. >,
  24114.     v²raz <TT
  24115. CLASS="replaceable"
  24116. ><I
  24117. >expr</I
  24118. ></TT
  24119. > je ohodnoce svou boolovskou hodnotou.
  24120.     Poku je <TT
  24121. CLASS="replaceable"
  24122. ><I
  24123. >expr</I
  24124. ></TT
  24125. > ohodnocen jako <TT
  24126. CLASS="constant"
  24127. ><B
  24128. >TRUE</B
  24129. ></TT
  24130. >, PHP
  24131.     provede <TT
  24132. CLASS="replaceable"
  24133. ><I
  24134. >statement</I
  24135. ></TT
  24136. >; je-li ohodnocen jako
  24137.     <TT
  24138. CLASS="constant"
  24139. ><B
  24140. >FALSE</B
  24141. ></TT
  24142. >, neprovede se nic. Vφce informacφ o to, jak se v²razy ohodnocujφ
  24143.     jako <TT
  24144. CLASS="constant"
  24145. ><B
  24146. >FALSE</B
  24147. ></TT
  24148. > najdete v Φßsti
  24149.     <A
  24150. HREF="#language.types.boolean.casting"
  24151. >'Konverze na typ boolean'</A
  24152. >.
  24153.    </P
  24154. ><P
  24155. >     Nßsledujφcφ p°φklad by vypsal
  24156.     <TT
  24157. CLASS="computeroutput"
  24158. >a je v∞t╣φ ne╛ b</TT
  24159. >,
  24160.     pokud <TT
  24161. CLASS="replaceable"
  24162. ><I
  24163. >$a</I
  24164. ></TT
  24165. > je v∞t╣φ ne╛ <TT
  24166. CLASS="replaceable"
  24167. ><I
  24168. >$b</I
  24169. ></TT
  24170. >:
  24171.     <DIV
  24172. CLASS="informalexample"
  24173. ><A
  24174. NAME="AEN4763"
  24175. ></A
  24176. ><P
  24177. ></P
  24178. ><TABLE
  24179. BORDER="0"
  24180. BGCOLOR="#E0E0E0"
  24181. CELLPADDING="5"
  24182. ><TR
  24183. ><TD
  24184. ><PRE
  24185. CLASS="php"
  24186. >if ($a > $b)
  24187.     print "a je v∞t╣φ ne╛ b";</PRE
  24188. ></TD
  24189. ></TR
  24190. ></TABLE
  24191. ><P
  24192. ></P
  24193. ></DIV
  24194. >
  24195.    </P
  24196. ><P
  24197. >     ╚asto byste cht∞li, aby se podmφn∞n∞ provßd∞l vφce ne╛ jeden konstrukt.
  24198.     Nenφ samoz°ejm∞ nutnΘ ka╛d² konstrukt zabalit do struktury
  24199.     <TT
  24200. CLASS="literal"
  24201. >if</TT
  24202. >. Mφsto toho m∙╛ete seskupit vφce konstrukt∙ do
  24203.     bloku. Nap°φklad tento k≤d by zobrazil
  24204.     <TT
  24205. CLASS="computeroutput"
  24206. >a je v∞t╣φ ne╛ b</TT
  24207. >, pokud
  24208.     <TT
  24209. CLASS="replaceable"
  24210. ><I
  24211. >$a</I
  24212. ></TT
  24213. > je v∞t╣φ ne╛ <TT
  24214. CLASS="replaceable"
  24215. ><I
  24216. >$b</I
  24217. ></TT
  24218. >
  24219.     a p°i°adil by hodnotu <TT
  24220. CLASS="replaceable"
  24221. ><I
  24222. >$a</I
  24223. ></TT
  24224. >
  24225.     do <TT
  24226. CLASS="replaceable"
  24227. ><I
  24228. >$b</I
  24229. ></TT
  24230. >:
  24231.     <DIV
  24232. CLASS="informalexample"
  24233. ><A
  24234. NAME="AEN4772"
  24235. ></A
  24236. ><P
  24237. ></P
  24238. ><TABLE
  24239. BORDER="0"
  24240. BGCOLOR="#E0E0E0"
  24241. CELLPADDING="5"
  24242. ><TR
  24243. ><TD
  24244. ><PRE
  24245. CLASS="php"
  24246. >if ($a > $b) {
  24247.     print "a je v∞t╣φ ne╛ b";
  24248.     $b = $a;
  24249. }</PRE
  24250. ></TD
  24251. ></TR
  24252. ></TABLE
  24253. ><P
  24254. ></P
  24255. ></DIV
  24256. >
  24257.    </P
  24258. ><P
  24259. >     Konstrukty <TT
  24260. CLASS="literal"
  24261. >if</TT
  24262. > mohou b²t libovoln∞ vno°ovßny do jin²ch    
  24263.     konstrukt∙ <TT
  24264. CLASS="literal"
  24265. >if</TT
  24266. >, co╛ poskytuje plnou flexibilitu
  24267.     podmφn∞nΘho provßd∞nφ r∙zn²ch Φßstφ programu.
  24268.    </P
  24269. ></DIV
  24270. ><DIV
  24271. CLASS="sect1"
  24272. ><HR><H2
  24273. CLASS="sect1"
  24274. ><A
  24275. NAME="control-structures.else"
  24276. ></A
  24277. ><TT
  24278. CLASS="literal"
  24279. >else</TT
  24280. ></H2
  24281. ><P
  24282. >     ╚asto takΘ m∙╛ete chtφt n∞co provßd∞t, pokud je jistß podmφnka spln∞na,
  24283.     a n∞co jinΘho, kdy╛ spln∞na nenφ. To umo╛≥uje konstrukt
  24284.     <TT
  24285. CLASS="literal"
  24286. >else</TT
  24287. >.  <TT
  24288. CLASS="literal"
  24289. >else</TT
  24290. > roz╣i°uje
  24291.     konstrukt <TT
  24292. CLASS="literal"
  24293. >if</TT
  24294. > o provßd∞nφ k≤du v p°φpad∞, ╛e v²raz
  24295.     v konstruktu <TT
  24296. CLASS="literal"
  24297. >if</TT
  24298. > je ohodnocen jako <TT
  24299. CLASS="constant"
  24300. ><B
  24301. >FALSE</B
  24302. ></TT
  24303. >.  Nap°φklad
  24304.     nßsledujφcφ k≤d vypφ╣e <TT
  24305. CLASS="computeroutput"
  24306. >a je v∞t╣φ ne╛ b</TT
  24307. >,
  24308.     pokud <TT
  24309. CLASS="replaceable"
  24310. ><I
  24311. >$a</I
  24312. ></TT
  24313. > je v∞t╣φ ne╛
  24314.     <TT
  24315. CLASS="replaceable"
  24316. ><I
  24317. >$b</I
  24318. ></TT
  24319. >, a
  24320.     <TT
  24321. CLASS="computeroutput"
  24322. >a NEN═ v∞t╣φ ne╛ b</TT
  24323. > v ostatnφch p°φpadech:
  24324.     <DIV
  24325. CLASS="informalexample"
  24326. ><A
  24327. NAME="AEN4790"
  24328. ></A
  24329. ><P
  24330. ></P
  24331. ><TABLE
  24332. BORDER="0"
  24333. BGCOLOR="#E0E0E0"
  24334. CELLPADDING="5"
  24335. ><TR
  24336. ><TD
  24337. ><PRE
  24338. CLASS="php"
  24339. >if ($a > $b) {
  24340.     print "a je v∞t╣φ ne╛ b";
  24341. } else {
  24342.     print "a NEN═ v∞t╣φ ne╛ b";
  24343. }</PRE
  24344. ></TD
  24345. ></TR
  24346. ></TABLE
  24347. ><P
  24348. ></P
  24349. ></DIV
  24350. >
  24351.  
  24352.     Konstrukt v <TT
  24353. CLASS="literal"
  24354. >else</TT
  24355. > se provßdφ, pouze pokud je v²raz v
  24356.     <TT
  24357. CLASS="literal"
  24358. >if</TT
  24359. > ohodnocen jako <TT
  24360. CLASS="constant"
  24361. ><B
  24362. >FALSE</B
  24363. ></TT
  24364. >, a pokud by zde byly n∞jakΘ
  24365.     v²razy <TT
  24366. CLASS="literal"
  24367. >elseif</TT
  24368. > - pouze pokud by byly takΘ ohodnoceny
  24369.     jako <TT
  24370. CLASS="constant"
  24371. ><B
  24372. >FALSE</B
  24373. ></TT
  24374. > (viz <A
  24375. HREF="#control-structures.elseif"
  24376. >elseif</A
  24377. >).
  24378.  
  24379.    </P
  24380. ></DIV
  24381. ><DIV
  24382. CLASS="sect1"
  24383. ><HR><H2
  24384. CLASS="sect1"
  24385. ><A
  24386. NAME="control-structures.elseif"
  24387. ></A
  24388. ><TT
  24389. CLASS="literal"
  24390. >elseif</TT
  24391. ></H2
  24392. ><P
  24393. >     Jak nßzev napovφdß, <TT
  24394. CLASS="literal"
  24395. >elseif</TT
  24396. >, je kombinacφ
  24397.     <TT
  24398. CLASS="literal"
  24399. >if</TT
  24400. > a <TT
  24401. CLASS="literal"
  24402. >else</TT
  24403. >.  Stejn∞ jako
  24404.     <TT
  24405. CLASS="literal"
  24406. >else</TT
  24407. >, roz╣i°uje konstrukt <TT
  24408. CLASS="literal"
  24409. >if</TT
  24410. >
  24411.     k provßd∞nφ odli╣n²ch konstrukt∙ v p°φpad∞, ╛e jev²raz p∙vodnφho konstruktu
  24412.     <TT
  24413. CLASS="literal"
  24414. >if</TT
  24415. > ohodnocen jako <TT
  24416. CLASS="constant"
  24417. ><B
  24418. >FALSE</B
  24419. ></TT
  24420. >.  Tedy, narozdφl od
  24421.     <TT
  24422. CLASS="literal"
  24423. >else</TT
  24424. >, se provßdφ pouze tehdy, je-li v²raz v podmφnce
  24425.     <TT
  24426. CLASS="literal"
  24427. >elseif</TT
  24428. > ohodnocen jako <TT
  24429. CLASS="constant"
  24430. ><B
  24431. >TRUE</B
  24432. ></TT
  24433. >.  Nap°φklad nßsledujφcφ
  24434.     k≤d vypφ╣e <TT
  24435. CLASS="computeroutput"
  24436. >a je v∞t╣φ ne╛ b</TT
  24437. >,
  24438.     <TT
  24439. CLASS="computeroutput"
  24440. >a se rovnß b</TT
  24441. >
  24442.     nebo <TT
  24443. CLASS="computeroutput"
  24444. >a je men╣φ ne╛ b</TT
  24445. >:
  24446.     <DIV
  24447. CLASS="informalexample"
  24448. ><A
  24449. NAME="AEN4815"
  24450. ></A
  24451. ><P
  24452. ></P
  24453. ><TABLE
  24454. BORDER="0"
  24455. BGCOLOR="#E0E0E0"
  24456. CELLPADDING="5"
  24457. ><TR
  24458. ><TD
  24459. ><PRE
  24460. CLASS="php"
  24461. >if ($a > $b) {
  24462.     print "a je v∞t╣φ ne╛ b";
  24463. } elseif ($a == $b) {
  24464.     print "a se rovnß b";
  24465. } else {
  24466.     print "a je men╣φ ne╛ b";
  24467. }</PRE
  24468. ></TD
  24469. ></TR
  24470. ></TABLE
  24471. ><P
  24472. ></P
  24473. ></DIV
  24474. >
  24475.    </P
  24476. ><P
  24477. >     V rßmci jednoho konstruktu <TT
  24478. CLASS="literal"
  24479. >if</TT
  24480. > m∙╛e b²t vφce
  24481.     konstrukt∙ <TT
  24482. CLASS="literal"
  24483. >elseif</TT
  24484. >. Provßdφ se prvnφ konstrukt
  24485.     <TT
  24486. CLASS="literal"
  24487. >elseif</TT
  24488. > (pokud v∙bec n∞jak²), jeho╛ v²raz je ohodnocen
  24489.     <TT
  24490. CLASS="constant"
  24491. ><B
  24492. >TRUE</B
  24493. ></TT
  24494. >. V PHP m∙╛ete napsat i 'else if' (dv∞ma slovy), chovßnφ bude
  24495.     naprosto toto╛nΘ jako u 'elseif' (jednφm slovem).  Syntaktick² v²znam
  24496.     je mφrn∞ odli╣n² (znßte-li C, je to stejnΘ), av╣ak ve v²sledku dostaneme
  24497.     p°esn∞ toto╛nΘ chovßnφ.
  24498.    </P
  24499. ><P
  24500. >     Konstrukt <TT
  24501. CLASS="literal"
  24502. >elseif</TT
  24503. > se provßdφ, pouze jsou-li p°φslu╣n²
  24504.     (bezprost°edn∞ p°edchßzejφcφ) v²raz konstruktu <TT
  24505. CLASS="literal"
  24506. >if</TT
  24507. >
  24508.     a v²razy v╣ech p°φslu╣n²ch p°edchßzejφcφch konstrukt∙ 
  24509.     <TT
  24510. CLASS="literal"
  24511. >elseif</TT
  24512. > ohodnoceny jako <TT
  24513. CLASS="constant"
  24514. ><B
  24515. >FALSE</B
  24516. ></TT
  24517. >, a konkrΘtnφ v²raz
  24518.     v <TT
  24519. CLASS="literal"
  24520. >elseif</TT
  24521. > ohodnocen jako <TT
  24522. CLASS="constant"
  24523. ><B
  24524. >TRUE</B
  24525. ></TT
  24526. >.
  24527.    </P
  24528. ></DIV
  24529. ><DIV
  24530. CLASS="sect1"
  24531. ><HR><H2
  24532. CLASS="sect1"
  24533. ><A
  24534. NAME="control-structures.alternative-syntax"
  24535. ></A
  24536. >Alternativnφ syntaxe °φdicφch struktur</H2
  24537. ><P
  24538. >     PHP nabφzφ alternativnφ syntaxi pro n∞kterΘ z °φdicφch struktur,
  24539.     jmenovit∞ <TT
  24540. CLASS="literal"
  24541. >if</TT
  24542. >,
  24543.     <TT
  24544. CLASS="literal"
  24545. >while</TT
  24546. >, <TT
  24547. CLASS="literal"
  24548. >for</TT
  24549. >,
  24550.     <TT
  24551. CLASS="literal"
  24552. >foreach</TT
  24553. >, a <TT
  24554. CLASS="literal"
  24555. >switch</TT
  24556. >.
  24557.     V ka╛dΘm z t∞chto p°φpad∙ je zßkladnφm formßtem alternativnφ syntaxe
  24558.     zßm∞na otvφracφ zßvorky za dvojteΦku (:) a uzavφracφ zßvorky za
  24559.     <TT
  24560. CLASS="literal"
  24561. >endif;</TT
  24562. >, <TT
  24563. CLASS="literal"
  24564. >endwhile;</TT
  24565. >,
  24566.     <TT
  24567. CLASS="literal"
  24568. >endfor;</TT
  24569. >, <TT
  24570. CLASS="literal"
  24571. >endforeach;</TT
  24572. >, resp.
  24573.     <TT
  24574. CLASS="literal"
  24575. >endswitch;</TT
  24576. >.
  24577.     <DIV
  24578. CLASS="informalexample"
  24579. ><A
  24580. NAME="AEN4842"
  24581. ></A
  24582. ><P
  24583. ></P
  24584. ><TABLE
  24585. BORDER="0"
  24586. BGCOLOR="#E0E0E0"
  24587. CELLPADDING="5"
  24588. ><TR
  24589. ><TD
  24590. ><PRE
  24591. CLASS="php"
  24592. ><?php if ($a == 5): ?>
  24593. A se rovnß 5
  24594. <?php endif; ?></PRE
  24595. ></TD
  24596. ></TR
  24597. ></TABLE
  24598. ><P
  24599. ></P
  24600. ></DIV
  24601. >
  24602.    </P
  24603. ><P
  24604. >     Ve v²╣e uvedenΘm p°φkladu je HTML blok vno°en do konstruktu
  24605.     <TT
  24606. CLASS="literal"
  24607. >if</TT
  24608. > napsanΘm alternativnφ syntaxφ.
  24609.     Tento HTML blok by se zobrazil pouze v p°φpad∞, ╛e je $a rovno 5.
  24610.    </P
  24611. ><P
  24612. >     Alternativnφ syntaxi lze pou╛φt i pro <TT
  24613. CLASS="literal"
  24614. >else</TT
  24615. > a
  24616.     <TT
  24617. CLASS="literal"
  24618. >elseif</TT
  24619. >. Nßsledujφcφ p°φklad ukazuje strukturu
  24620.     <TT
  24621. CLASS="literal"
  24622. >if</TT
  24623. >, <TT
  24624. CLASS="literal"
  24625. >elseif</TT
  24626. > a
  24627.     <TT
  24628. CLASS="literal"
  24629. >else</TT
  24630. > v alternativnφm formßtu:
  24631.     <DIV
  24632. CLASS="informalexample"
  24633. ><A
  24634. NAME="AEN4852"
  24635. ></A
  24636. ><P
  24637. ></P
  24638. ><TABLE
  24639. BORDER="0"
  24640. BGCOLOR="#E0E0E0"
  24641. CELLPADDING="5"
  24642. ><TR
  24643. ><TD
  24644. ><PRE
  24645. CLASS="php"
  24646. >if ($a == 5):
  24647.     print "a se rovnß 5";
  24648.     print "...";
  24649. elseif ($a == 6):
  24650.     print "a se rovnß 6";
  24651.     print "!!!";
  24652. else:
  24653.     print "a nenφ ani 5, ani 6";
  24654. endif;</PRE
  24655. ></TD
  24656. ></TR
  24657. ></TABLE
  24658. ><P
  24659. ></P
  24660. ></DIV
  24661. >
  24662.    </P
  24663. ><P
  24664. >     Dal╣φ p°φklady - viz takΘ
  24665.     <A
  24666. HREF="#control-structures.while"
  24667. >while</A
  24668. >,
  24669.     <A
  24670. HREF="#control-structures.for"
  24671. >for</A
  24672. >, a <A
  24673. HREF="#control-structures.if"
  24674. >if</A
  24675. >.
  24676.    </P
  24677. ></DIV
  24678. ><DIV
  24679. CLASS="sect1"
  24680. ><HR><H2
  24681. CLASS="sect1"
  24682. ><A
  24683. NAME="control-structures.while"
  24684. ></A
  24685. ><TT
  24686. CLASS="literal"
  24687. >while</TT
  24688. ></H2
  24689. ><P
  24690. >     Cykly <TT
  24691. CLASS="literal"
  24692. >while</TT
  24693. > jsou nejjednodu╣╣φm typem cykl∙ v PHP.
  24694.     Chovajφ se jako jejich prot∞j╣ci v C. Zßkladφ formßt konstruktu
  24695.     <TT
  24696. CLASS="literal"
  24697. >while</TT
  24698. > je tento:
  24699.     <DIV
  24700. CLASS="informalexample"
  24701. ><A
  24702. NAME="AEN4864"
  24703. ></A
  24704. ><P
  24705. ></P
  24706. ><TABLE
  24707. BORDER="0"
  24708. BGCOLOR="#E0E0E0"
  24709. CELLPADDING="5"
  24710. ><TR
  24711. ><TD
  24712. ><PRE
  24713. CLASS="programlisting"
  24714. >while (expr) statement</PRE
  24715. ></TD
  24716. ></TR
  24717. ></TABLE
  24718. ><P
  24719. ></P
  24720. ></DIV
  24721. >
  24722.    </P
  24723. ><P
  24724. >     V²znam konstruktu <TT
  24725. CLASS="literal"
  24726. >while</TT
  24727. > je snadno pochopiteln².
  24728.     ╪φkß PHP, ╛e mß provßd∞t vno°en²(Θ) konstrukt(y) tak dlouho, dokud je
  24729.     v²raz ve <TT
  24730. CLASS="literal"
  24731. >while</TT
  24732. > roven <TT
  24733. CLASS="constant"
  24734. ><B
  24735. >TRUE</B
  24736. ></TT
  24737. >. Hodnota v²razu je testovßna
  24738.     poka╛dΘ na zaΦßtku cyklu (v ka╛dΘ iteraci), tak╛e i kdy╛ se tato hodnota
  24739.     b∞hem provßd∞nφ vno°en²ch konstrukt∙ zm∞nφ, provede se zbytek k≤du uvnit°
  24740.     cyklu - v konkrΘtnφ iteraci - a╛ do konce (ka╛dΘ provedenφ k≤du uvnit°
  24741.     cyklu je jedna iterace). N∞kdy, kdy╛ je v²raz ve 
  24742.     <TT
  24743. CLASS="literal"
  24744. >while</TT
  24745. > ohodnocen jako <TT
  24746. CLASS="constant"
  24747. ><B
  24748. >FALSE</B
  24749. ></TT
  24750. > ji╛ p°i vstupu do cyklu,
  24751.     vno°en² k≤d se neprovede v∙bec.
  24752.    </P
  24753. ><P
  24754. >     Podobn∞, jako v p°φpad∞ <TT
  24755. CLASS="literal"
  24756. >if</TT
  24757. >, m∙╛ete i zde seskupovat
  24758.     konstrukty uvnit° cyklu <TT
  24759. CLASS="literal"
  24760. >while</TT
  24761. > ohraniΦenφm tohoto
  24762.     k≤du slo╛en²mi zßvorkami nebo za pou╛itφ alternativnφ syntaxe:
  24763.     <DIV
  24764. CLASS="informalexample"
  24765. ><A
  24766. NAME="AEN4875"
  24767. ></A
  24768. ><P
  24769. ></P
  24770. ><TABLE
  24771. BORDER="0"
  24772. BGCOLOR="#E0E0E0"
  24773. CELLPADDING="5"
  24774. ><TR
  24775. ><TD
  24776. ><PRE
  24777. CLASS="programlisting"
  24778. >while (expr): statement ... endwhile;</PRE
  24779. ></TD
  24780. ></TR
  24781. ></TABLE
  24782. ><P
  24783. ></P
  24784. ></DIV
  24785. >
  24786.    </P
  24787. ><P
  24788. >     Nßsledujφcφ p°φklady jsou identickΘ, oba vypφ╣φ Φφsla od 1 do 10:
  24789.     <DIV
  24790. CLASS="informalexample"
  24791. ><A
  24792. NAME="AEN4878"
  24793. ></A
  24794. ><P
  24795. ></P
  24796. ><TABLE
  24797. BORDER="0"
  24798. BGCOLOR="#E0E0E0"
  24799. CELLPADDING="5"
  24800. ><TR
  24801. ><TD
  24802. ><PRE
  24803. CLASS="php"
  24804. >/* p°φklad 1 */
  24805.  
  24806. $i = 1;
  24807. while ($i <= 10) {
  24808.     print $i++;  /* vyti╣t∞nß hodnota by byla rovna
  24809.                     $i p°ed inkrementacφ
  24810.                     (post-inkrementace) */
  24811. }
  24812.  
  24813. /* p°φklad 2 */
  24814.  
  24815. $i = 1;
  24816. while ($i <= 10):
  24817.     print $i;
  24818.     $i++;
  24819. endwhile;</PRE
  24820. ></TD
  24821. ></TR
  24822. ></TABLE
  24823. ><P
  24824. ></P
  24825. ></DIV
  24826. >
  24827.    </P
  24828. ></DIV
  24829. ><DIV
  24830. CLASS="sect1"
  24831. ><HR><H2
  24832. CLASS="sect1"
  24833. ><A
  24834. NAME="control-structures.do.while"
  24835. ></A
  24836. ><TT
  24837. CLASS="literal"
  24838. >do..while</TT
  24839. ></H2
  24840. ><P
  24841. >     Cykly <TT
  24842. CLASS="literal"
  24843. >do..while</TT
  24844. > jsou velmi podobnΘ cykl∙m
  24845.     <TT
  24846. CLASS="literal"
  24847. >while</TT
  24848. > krom∞ toho, ╛e pravdivost v²razu se testuje
  24849.     na konci ka╛dΘ iterace namφsto jejφho zaΦßtku. Hlavnφ rozdφl oproti
  24850.     b∞╛n²m cykl∙m <TT
  24851. CLASS="literal"
  24852. >while</TT
  24853. > je ten, ╛e prvnφ iterace cyklu
  24854.     <TT
  24855. CLASS="literal"
  24856. >do..while</TT
  24857. > se provede v╛dy (pravdivostnφ v²raz je
  24858.     testovßn a╛ na konci iterace), co╛ u cyklu <TT
  24859. CLASS="literal"
  24860. >while</TT
  24861. >
  24862.     nenφ zaruΦeno (pravdivostnφ v²raz je testovßn na zaΦßtku iterace; pokud
  24863.     je ohodnocen jako <TT
  24864. CLASS="constant"
  24865. ><B
  24866. >FALSE</B
  24867. ></TT
  24868. >, provßd∞nφ cyklu hned skonΦφ).
  24869.    </P
  24870. ><P
  24871. >     Toto je jedinß syntaxe pro cykly <TT
  24872. CLASS="literal"
  24873. >do..while</TT
  24874. >:
  24875.  
  24876.     <DIV
  24877. CLASS="informalexample"
  24878. ><A
  24879. NAME="AEN4892"
  24880. ></A
  24881. ><P
  24882. ></P
  24883. ><TABLE
  24884. BORDER="0"
  24885. BGCOLOR="#E0E0E0"
  24886. CELLPADDING="5"
  24887. ><TR
  24888. ><TD
  24889. ><PRE
  24890. CLASS="php"
  24891. >$i = 0;
  24892. do {
  24893.    print $i;
  24894. } while ($i>0);</PRE
  24895. ></TD
  24896. ></TR
  24897. ></TABLE
  24898. ><P
  24899. ></P
  24900. ></DIV
  24901. >
  24902.    </P
  24903. ><P
  24904. >      V²╣e uveden² cyklus by se provedl prßv∞ jednou, proto╛e po prvnφ iteraci,
  24905.      kdy╛ se testuje pravdivostnφ v²raz, je tento ohodnocen jako <TT
  24906. CLASS="constant"
  24907. ><B
  24908. >FALSE</B
  24909. ></TT
  24910. >
  24911.      ($i nenφ v∞t╣φ ne╛ 0) a provßd∞nφ cyklu konΦφ.
  24912.    </P
  24913. ><P
  24914. >     PokroΦilφ programßto°i v C mohou znßt i odli╣nΘ pou╛itφ cyklu
  24915.     <TT
  24916. CLASS="literal"
  24917. >do..while</TT
  24918. >. K≤d se uzav°e do
  24919.     <TT
  24920. CLASS="literal"
  24921. >do..while</TT
  24922. >(0) a pou╛ije se p°φkaz
  24923.     <A
  24924. HREF="#control-structures.break"
  24925. ><TT
  24926. CLASS="literal"
  24927. >break</TT
  24928. ></A
  24929. >.
  24930.     To umo╛≥uje p°eru╣it provßd∞nφ cyklu uprost°ed k≤du, jak je znßzorn∞no
  24931.     v tomto p°φkladu:
  24932.     <DIV
  24933. CLASS="informalexample"
  24934. ><A
  24935. NAME="AEN4901"
  24936. ></A
  24937. ><P
  24938. ></P
  24939. ><TABLE
  24940. BORDER="0"
  24941. BGCOLOR="#E0E0E0"
  24942. CELLPADDING="5"
  24943. ><TR
  24944. ><TD
  24945. ><PRE
  24946. CLASS="php"
  24947. >do {
  24948.     if ($i < 5) {
  24949.         print "i nenφ dost velkΘ";
  24950.         break;
  24951.     }
  24952.     $i *= $factor;
  24953.     if ($i < $minimum_limit) {
  24954.         break;
  24955.     }
  24956.     print "i je ok";
  24957.  
  24958.      ...zpracuj i...
  24959.  
  24960. } while(0);</PRE
  24961. ></TD
  24962. ></TR
  24963. ></TABLE
  24964. ><P
  24965. ></P
  24966. ></DIV
  24967. >
  24968.    </P
  24969. ><P
  24970. >     Ned∞lejte si nic z toho, ╛e tomu hned a beze zbytku nerozumφte. M∙╛ete
  24971.     psßt skripty, a to i velmi ·ΦinnΘ skripty, i bez pou╛itφ tΘto 'finty'.
  24972.    </P
  24973. ></DIV
  24974. ><DIV
  24975. CLASS="sect1"
  24976. ><HR><H2
  24977. CLASS="sect1"
  24978. ><A
  24979. NAME="control-structures.for"
  24980. ></A
  24981. ><TT
  24982. CLASS="literal"
  24983. >for</TT
  24984. ></H2
  24985. ><P
  24986. >     Cykly <TT
  24987. CLASS="literal"
  24988. >for</TT
  24989. > jsou nejslo╛it∞j╣φmi cykly v PHP. Chovajφ se
  24990.     stejn∞, jako jejich soukmenovci v C. Syntaxe cyklu <TT
  24991. CLASS="literal"
  24992. >for</TT
  24993. >
  24994.     je nßsledujφcφ:
  24995.     <DIV
  24996. CLASS="informalexample"
  24997. ><A
  24998. NAME="AEN4910"
  24999. ></A
  25000. ><P
  25001. ></P
  25002. ><TABLE
  25003. BORDER="0"
  25004. BGCOLOR="#E0E0E0"
  25005. CELLPADDING="5"
  25006. ><TR
  25007. ><TD
  25008. ><PRE
  25009. CLASS="programlisting"
  25010. >for (expr1; expr2; expr3) statement</PRE
  25011. ></TD
  25012. ></TR
  25013. ></TABLE
  25014. ><P
  25015. ></P
  25016. ></DIV
  25017. >
  25018.    </P
  25019. ><P
  25020. >     Prvnφ v²raz (<TT
  25021. CLASS="replaceable"
  25022. ><I
  25023. >expr1</I
  25024. ></TT
  25025. >) je ohodnocen (proveden)
  25026.     jednou, bezpodmφneΦn∞, na zaΦßtku cyklu.
  25027.    </P
  25028. ><P
  25029. >     Na zaΦßtku ka╛dΘ iterace je ohodnocen v²raz
  25030.     <TT
  25031. CLASS="replaceable"
  25032. ><I
  25033. >expr2</I
  25034. ></TT
  25035. >. Pokud mß hodnotu <TT
  25036. CLASS="constant"
  25037. ><B
  25038. >TRUE</B
  25039. ></TT
  25040. >, cyklus pokraΦuje
  25041.     a zpracovßvß se k≤d uvnit° cyklu. Je-li naopak jeho hodnota <TT
  25042. CLASS="constant"
  25043. ><B
  25044. >FALSE</B
  25045. ></TT
  25046. >,
  25047.     provßd∞nφ cyklu konΦφ.
  25048.    </P
  25049. ><P
  25050. >     Na konci ka╛dΘ iterace se ohodnotφ (provede) v²raz 
  25051.     <TT
  25052. CLASS="replaceable"
  25053. ><I
  25054. >expr3</I
  25055. ></TT
  25056. >.
  25057.    </P
  25058. ><P
  25059. >     Ka╛d² z v²raz∙ m∙╛e b²t prßzdn². Prßzdn² v²raz
  25060.     <TT
  25061. CLASS="replaceable"
  25062. ><I
  25063. >expr2</I
  25064. ></TT
  25065. > znamenß, ╛e cyklus bude probφhat
  25066.     nekoneΦn∞ dlouho (PHP, stejn∞ jako C, implicitn∞ p°edpoklßdß hodnotu
  25067.     <TT
  25068. CLASS="constant"
  25069. ><B
  25070. >TRUE</B
  25071. ></TT
  25072. >). To nemusφ b²t tak bez u╛itku, jak si m∙╛ete myslet. ╚asto m∙╛ete
  25073.     toti╛ chtφt ukonΦit cyklus pomocφ podmφn∞nΘho p°φkazu
  25074.     <A
  25075. HREF="#control-structures.break"
  25076. ><TT
  25077. CLASS="literal"
  25078. >break</TT
  25079. ></A
  25080. >,
  25081.     namφsto pou╛itφ pravdivostnφho v²razu v konstruktu cyklu
  25082.     <TT
  25083. CLASS="literal"
  25084. >for</TT
  25085. >.
  25086.    </P
  25087. ><P
  25088. >     P°edpoklßdejme nßsledujφcφ p°φklady. V╣echny zobrazφ Φφsla od 1 do 10:
  25089.     <DIV
  25090. CLASS="informalexample"
  25091. ><A
  25092. NAME="AEN4927"
  25093. ></A
  25094. ><P
  25095. ></P
  25096. ><TABLE
  25097. BORDER="0"
  25098. BGCOLOR="#E0E0E0"
  25099. CELLPADDING="5"
  25100. ><TR
  25101. ><TD
  25102. ><PRE
  25103. CLASS="php"
  25104. >/* p°φklad 1 */
  25105.  
  25106. for ($i = 1; $i <= 10; $i++) {
  25107.     print $i;
  25108. }
  25109.  
  25110. /* p°φklad 2 */
  25111.  
  25112. for ($i = 1;;$i++) {
  25113.     if ($i > 10) {
  25114.         break;
  25115.     }
  25116.     print $i;
  25117. }
  25118.  
  25119. /* p°φklad 3 */
  25120.  
  25121. $i = 1;
  25122. for (;;) {
  25123.     if ($i > 10) {
  25124.         break;
  25125.     }
  25126.     print $i;
  25127.     $i++;
  25128. }
  25129.  
  25130. /* p°φklad 4 */
  25131.  
  25132. for ($i = 1; $i <= 10; print $i, $i++);</PRE
  25133. ></TD
  25134. ></TR
  25135. ></TABLE
  25136. ><P
  25137. ></P
  25138. ></DIV
  25139. >
  25140.    </P
  25141. ><P
  25142. >     Prvnφ p°φklad samoz°ejm∞ vypadß nejlΘpe (nebo mo╛nß i ten Φtvrt²), ale
  25143.     m∙╛ete p°ijφt na to, ╛e schopnost pou╛φvat prßzdnΘ v²razy v cyklech
  25144.     <TT
  25145. CLASS="literal"
  25146. >for</TT
  25147. > nemusφ b²t n∞kdy ·pln∞ k zahozenφ.
  25148.    </P
  25149. ><P
  25150. >     PHP podporuje pro cykly <TT
  25151. CLASS="literal"
  25152. >for</TT
  25153. > takΘ alternativnφ
  25154.     "dvojteΦkovou syntaxi".
  25155.     <DIV
  25156. CLASS="informalexample"
  25157. ><A
  25158. NAME="AEN4933"
  25159. ></A
  25160. ><P
  25161. ></P
  25162. ><TABLE
  25163. BORDER="0"
  25164. BGCOLOR="#E0E0E0"
  25165. CELLPADDING="5"
  25166. ><TR
  25167. ><TD
  25168. ><PRE
  25169. CLASS="programlisting"
  25170. >for (expr1; expr2; expr3): statement; ...; endfor;</PRE
  25171. ></TD
  25172. ></TR
  25173. ></TABLE
  25174. ><P
  25175. ></P
  25176. ></DIV
  25177. >
  25178.    </P
  25179. ><P
  25180. >     JinΘ jazyky majφ konstrukt <TT
  25181. CLASS="literal"
  25182. >foreach</TT
  25183. > k traverzovßnφ
  25184.     polφ nebo hash∙. V PHP 3 nic takovΘho nenφ, PHP 4 ano (viz <A
  25185. HREF="#control-structures.foreach"
  25186. >foreach</A
  25187. >). V PHP 3 m∙╛ete
  25188.     k dosa╛enφ stejnΘho efektu kombinovat
  25189.     <A
  25190. HREF="#control-structures.while"
  25191. >while</A
  25192. > s funkcemi
  25193.     <A
  25194. HREF="#function.list"
  25195. ><B
  25196. CLASS="function"
  25197. >list()</B
  25198. ></A
  25199. > a <A
  25200. HREF="#function.each"
  25201. ><B
  25202. CLASS="function"
  25203. >each()</B
  25204. ></A
  25205. >. P°φklady najdete
  25206.     v dokumentaci.
  25207.    </P
  25208. ></DIV
  25209. ><DIV
  25210. CLASS="sect1"
  25211. ><HR><H2
  25212. CLASS="sect1"
  25213. ><A
  25214. NAME="control-structures.foreach"
  25215. ></A
  25216. ><TT
  25217. CLASS="literal"
  25218. >foreach</TT
  25219. ></H2
  25220. ><P
  25221. >     PHP 4 (ne PHP 3) zahrnuje konstrukt <TT
  25222. CLASS="literal"
  25223. >foreach</TT
  25224. >, podobn∞
  25225.     jako Perl a r∙znΘ dal╣φ jazyky. To poskytuje snadn² zp∙sob k iteraci
  25226.     p°es pole. Existujφ dv∞ syntaxe; ta druhß je men╣φm, av╣ak u╛iteΦn²m
  25227.     roz╣φ°enφm tΘ prvnφ:
  25228.     <DIV
  25229. CLASS="informalexample"
  25230. ><A
  25231. NAME="AEN4946"
  25232. ></A
  25233. ><P
  25234. ></P
  25235. ><TABLE
  25236. BORDER="0"
  25237. BGCOLOR="#E0E0E0"
  25238. CELLPADDING="5"
  25239. ><TR
  25240. ><TD
  25241. ><PRE
  25242. CLASS="programlisting"
  25243. >foreach(array_expression as $value) statement
  25244. foreach(array_expression as $key => $value) statement</PRE
  25245. ></TD
  25246. ></TR
  25247. ></TABLE
  25248. ><P
  25249. ></P
  25250. ></DIV
  25251. >
  25252.    </P
  25253. ><P
  25254. >     Prvnφ forma traverzuje pole danΘ v²razem
  25255.     <TT
  25256. CLASS="literal"
  25257. >array_expression</TT
  25258. >. V ka╛dΘ iteraci je hodnota aktußlnφho
  25259.     elementu p°i°azena do <TT
  25260. CLASS="literal"
  25261. >$value</TT
  25262. > a vnit°nφ ukazatel na pole
  25263.     je zv²╣en o jednotku (tzn. v p°φ╣tφ iteraci budete hled∞t na nßsledujφcφ
  25264.     element).
  25265.    </P
  25266. ><P
  25267. >     Druhß forma d∞lß totΘ╛, krom∞ toho, ╛e aktußlnφ klφΦ elementu bude
  25268.     v ka╛dΘ iteraci p°i°azen do prom∞nnΘ <TT
  25269. CLASS="literal"
  25270. >$key</TT
  25271. >.
  25272.    </P
  25273. ><P
  25274. >     <DIV
  25275. CLASS="note"
  25276. ><BLOCKQUOTE
  25277. CLASS="note"
  25278. ><P
  25279. ><B
  25280. >Poznßmka: </B
  25281. >
  25282.       Kdy╛ <TT
  25283. CLASS="literal"
  25284. >foreach</TT
  25285. > zaΦne provßd∞nφ prvnφ iterace,
  25286.       je vnit°nφ ukazatel automaticky nastaven na prvnφ element pole. To
  25287.       znamenß, ╛e p°ed <TT
  25288. CLASS="literal"
  25289. >foreach</TT
  25290. > nemusφte volat
  25291.       <A
  25292. HREF="#function.reset"
  25293. ><B
  25294. CLASS="function"
  25295. >reset()</B
  25296. ></A
  25297. >.
  25298.      </P
  25299. ></BLOCKQUOTE
  25300. ></DIV
  25301. >
  25302.    </P
  25303. ><P
  25304. >     <DIV
  25305. CLASS="note"
  25306. ><BLOCKQUOTE
  25307. CLASS="note"
  25308. ><P
  25309. ><B
  25310. >Poznßmka: </B
  25311. >
  25312.       Uv∞domte si takΘ, ╛e <TT
  25313. CLASS="literal"
  25314. >foreach</TT
  25315. > pracuje na kopii
  25316.       specifikovanΘho pole, nikoli na poli samotnΘm, proto ukazatel na pole
  25317.       nenφ modifikovßn tak, jako konstruktem <A
  25318. HREF="#function.each"
  25319. ><B
  25320. CLASS="function"
  25321. >each()</B
  25322. ></A
  25323. > a
  25324.       zm∞ny na vrßcenΘm elementu se na p∙vodnφm poli neprojevφ.
  25325.      </P
  25326. ></BLOCKQUOTE
  25327. ></DIV
  25328. >
  25329.    </P
  25330. ><DIV
  25331. CLASS="note"
  25332. ><BLOCKQUOTE
  25333. CLASS="note"
  25334. ><P
  25335. ><B
  25336. >Poznßmka: </B
  25337. >
  25338.      <TT
  25339. CLASS="literal"
  25340. >foreach</TT
  25341. > nepodporuje mo╛nost potlaΦit chybovß hlß╣enφ
  25342.      pou╛itφm '@'.
  25343.     </P
  25344. ></BLOCKQUOTE
  25345. ></DIV
  25346. ><P
  25347. >     M∙╛ete si v╣imnout, ╛e nßsledujφcφ p°φklady jsou funkΦn∞ toto╛nΘ:
  25348.     <DIV
  25349. CLASS="informalexample"
  25350. ><A
  25351. NAME="AEN4968"
  25352. ></A
  25353. ><P
  25354. ></P
  25355. ><TABLE
  25356. BORDER="0"
  25357. BGCOLOR="#E0E0E0"
  25358. CELLPADDING="5"
  25359. ><TR
  25360. ><TD
  25361. ><PRE
  25362. CLASS="php"
  25363. >reset ($arr);
  25364. while (list(, $value) = each ($arr)) {
  25365.     echo "Hodnota: $value<br>\n";
  25366. }
  25367.  
  25368. foreach ($arr as $value) {
  25369.     echo "Hodnota: $value<br>\n";
  25370. }</PRE
  25371. ></TD
  25372. ></TR
  25373. ></TABLE
  25374. ><P
  25375. ></P
  25376. ></DIV
  25377. >
  25378.     Nßsledujφcφ p°φklady jsou rovn∞╛ funkΦn∞ toto╛nΘ:
  25379.     <DIV
  25380. CLASS="informalexample"
  25381. ><A
  25382. NAME="AEN4970"
  25383. ></A
  25384. ><P
  25385. ></P
  25386. ><TABLE
  25387. BORDER="0"
  25388. BGCOLOR="#E0E0E0"
  25389. CELLPADDING="5"
  25390. ><TR
  25391. ><TD
  25392. ><PRE
  25393. CLASS="php"
  25394. >reset ($arr);
  25395. while (list($key, $value) = each ($arr)) {
  25396.     echo "KlφΦ: $key; Hodnota: $value<br>\n";
  25397. }
  25398.  
  25399. foreach ($arr as $key => $value) {
  25400.     echo "KlφΦ: $key; Hodnota: $value<br>\n";
  25401. }</PRE
  25402. ></TD
  25403. ></TR
  25404. ></TABLE
  25405. ><P
  25406. ></P
  25407. ></DIV
  25408. >
  25409.    </P
  25410. ><P
  25411. >     Dal╣φ p°φklady demonstrujφcφ pou╛φtφ:
  25412.     <DIV
  25413. CLASS="informalexample"
  25414. ><A
  25415. NAME="AEN4973"
  25416. ></A
  25417. ><P
  25418. ></P
  25419. ><TABLE
  25420. BORDER="0"
  25421. BGCOLOR="#E0E0E0"
  25422. CELLPADDING="5"
  25423. ><TR
  25424. ><TD
  25425. ><PRE
  25426. CLASS="php"
  25427. >/* foreach p°φklad 1: pouze hodnota */
  25428.  
  25429. $a = array (1, 2, 3, 17);
  25430.  
  25431. foreach ($a as $v) {
  25432.    print "SouΦasnß hodnota \$a: $v.\n";
  25433. }
  25434.  
  25435. /* foreach p°φklad 2: hodnota (pro ilustraci je vypsßn i klφΦ) */
  25436.  
  25437. $a = array (1, 2, 3, 17);
  25438.  
  25439. $i = 0; /* pouze pro ilustrativnφ ·Φely */
  25440.  
  25441. foreach($a as $v) {
  25442.     print "\$a[$i] => $v.\n";
  25443.     $i++;
  25444. }
  25445.  
  25446. /* foreach p°φklad 3: klφΦ a hodnota */
  25447.  
  25448. $a = array (
  25449.     "jedna" => 1,
  25450.     "dv∞" => 2,
  25451.     "t°i" => 3,
  25452.     "sedmnßct" => 17
  25453. );
  25454.  
  25455. foreach($a as $k => $v) {
  25456.     print "\$a[$k] => $v.\n";
  25457. }
  25458.  
  25459. /* foreach p°φklad 4: vφcerozm∞rnß pole */
  25460.  
  25461. $a[0][0] = "a";
  25462. $a[0][1] = "b";
  25463. $a[1][0] = "y";
  25464. $a[1][1] = "z";
  25465.  
  25466. foreach($a as $v1) {
  25467.     foreach ($v1 as $v2) {
  25468.         print "$v2\n";
  25469.     }
  25470. }
  25471.  
  25472. /* foreach p°φklad 5: dynamickß pole */
  25473.  
  25474. foreach(array(1, 2, 3, 4, 5) as $v) {
  25475.     print "$v\n";
  25476. }</PRE
  25477. ></TD
  25478. ></TR
  25479. ></TABLE
  25480. ><P
  25481. ></P
  25482. ></DIV
  25483. >
  25484.    </P
  25485. ></DIV
  25486. ><DIV
  25487. CLASS="sect1"
  25488. ><HR><H2
  25489. CLASS="sect1"
  25490. ><A
  25491. NAME="control-structures.break"
  25492. ></A
  25493. ><TT
  25494. CLASS="literal"
  25495. >break</TT
  25496. ></H2
  25497. ><P
  25498. >     <TT
  25499. CLASS="literal"
  25500. >break</TT
  25501. > ukonΦuje provßd∞nφ aktußlnφho konstruktu
  25502.     <TT
  25503. CLASS="literal"
  25504. >for</TT
  25505. >, <TT
  25506. CLASS="literal"
  25507. >foreach</TT
  25508. >
  25509.     <TT
  25510. CLASS="literal"
  25511. >while</TT
  25512. >, <TT
  25513. CLASS="literal"
  25514. >do..while</TT
  25515. > nebo
  25516.     <TT
  25517. CLASS="literal"
  25518. >switch</TT
  25519. >.
  25520.    </P
  25521. ><P
  25522. >     <TT
  25523. CLASS="literal"
  25524. >break</TT
  25525. > akceptuje nepovinn² Φφseln² argument, kter² °φkß,
  25526.     z kolika vno°en²ch struktur se mß vyskoΦit.
  25527.    </P
  25528. ><P
  25529. >     <DIV
  25530. CLASS="informalexample"
  25531. ><A
  25532. NAME="AEN4988"
  25533. ></A
  25534. ><P
  25535. ></P
  25536. ><TABLE
  25537. BORDER="0"
  25538. BGCOLOR="#E0E0E0"
  25539. CELLPADDING="5"
  25540. ><TR
  25541. ><TD
  25542. ><PRE
  25543. CLASS="php"
  25544. >$arr = array ('jedna', 'dv∞', 't°i', 'Φty°i', 'stop', 'p∞t');
  25545. while (list (, $val) = each ($arr)) {
  25546.     if ($val == 'stop') {
  25547.         break;    /* Tady byste mohli napsat takΘ 'break 1;'. */
  25548.     }
  25549.     echo "$val<br>\n";
  25550. }
  25551.  
  25552. /* Pou╛itφ nepovinnΘho argumentu. */
  25553.  
  25554. $i = 0;
  25555. while (++$i) {
  25556.     switch ($i) {
  25557.     case 5:
  25558.         echo "P°i 5<br>\n";
  25559.         break 1;  /* UkonΦuje pouze switch. */
  25560.     case 10:
  25561.         echo "P°i 10; konec<br>\n";
  25562.         break 2;  /* UkonΦuje switch a while. */
  25563.     default:
  25564.         break;
  25565.     }
  25566. }</PRE
  25567. ></TD
  25568. ></TR
  25569. ></TABLE
  25570. ><P
  25571. ></P
  25572. ></DIV
  25573. >
  25574.    </P
  25575. ></DIV
  25576. ><DIV
  25577. CLASS="sect1"
  25578. ><HR><H2
  25579. CLASS="sect1"
  25580. ><A
  25581. NAME="control-structures.continue"
  25582. ></A
  25583. ><TT
  25584. CLASS="literal"
  25585. >continue</TT
  25586. ></H2
  25587. ><P
  25588. >     <TT
  25589. CLASS="literal"
  25590. >continue</TT
  25591. > se pou╛φvß uvnit° cykl∙ k p°eskoΦenφ zbytku
  25592.     aktußlnφ iterace a bezprost°ednφmu p°echodu na nßsledujφcφ iteraci.
  25593.    </P
  25594. ><P
  25595. >     <TT
  25596. CLASS="literal"
  25597. >continue</TT
  25598. > akceptuje nepovinn² Φφseln² argument, kter²
  25599.     °φkß, kolik ·rovnφ cykl∙ se mß narßz dokonΦit.
  25600.    </P
  25601. ><P
  25602. >     <DIV
  25603. CLASS="informalexample"
  25604. ><A
  25605. NAME="AEN4998"
  25606. ></A
  25607. ><P
  25608. ></P
  25609. ><TABLE
  25610. BORDER="0"
  25611. BGCOLOR="#E0E0E0"
  25612. CELLPADDING="5"
  25613. ><TR
  25614. ><TD
  25615. ><PRE
  25616. CLASS="php"
  25617. >while (list ($key, $value) = each ($arr)) {
  25618.     if (!($key % 2)) { // p°eskoΦ sudΘ Φleny
  25619.         continue;
  25620.     }
  25621.     do_something_odd ($value);
  25622. }
  25623.  
  25624. $i = 0;
  25625. while ($i++ &lt; 5) {
  25626.     echo "Vn∞j╣φ<br>\n";
  25627.     while (1) {
  25628.         echo "&nbsp;&nbsp;St°ednφ<br>\n";
  25629.         while (1) {
  25630.             echo "&nbsp;&nbsp;Vnit°nφ<br>\n";
  25631.             continue 3;
  25632.         }
  25633.         echo "Toto se nikdy nevytiskne.<br>\n";
  25634.     }
  25635.     echo "Ani tohle se neprovßdφ.<br>\n";
  25636. }</PRE
  25637. ></TD
  25638. ></TR
  25639. ></TABLE
  25640. ><P
  25641. ></P
  25642. ></DIV
  25643. >
  25644.     </P
  25645. ></DIV
  25646. ><DIV
  25647. CLASS="sect1"
  25648. ><HR><H2
  25649. CLASS="sect1"
  25650. ><A
  25651. NAME="control-structures.switch"
  25652. ></A
  25653. ><TT
  25654. CLASS="literal"
  25655. >switch</TT
  25656. ></H2
  25657. ><P
  25658. >     Konstrukt <TT
  25659. CLASS="literal"
  25660. >switch</TT
  25661. > je podobnß sΘrii konstrukt∙ IF,
  25662.     testujφcφch tent²╛ v²raz. V mnoha p°φpadech m∙╛ete chtφt porovnßvat
  25663.     stejnou prom∞nnou (nebo v²raz) s mnoha r∙zn²mi hodnotami a provßd∞t
  25664.     r∙znΘ kusy k≤du v zßvislosti na tom, kterΘ hodnot∞ se rovnß.
  25665.     To je p°esn∞ to, k Φemu je <TT
  25666. CLASS="literal"
  25667. >switch</TT
  25668. >.
  25669.    </P
  25670. ><P
  25671. >     Nßsledujφcφ dva p°φklady p°edstavujφ dva odli╣nΘ zp∙soby, jak napsat
  25672.     totΘ╛; jeden pou╛φvß sΘrii podmφnek <TT
  25673. CLASS="literal"
  25674. >if</TT
  25675. >, zatφmco
  25676.     druh² je zalo╛en na konstruktu <TT
  25677. CLASS="literal"
  25678. >switch</TT
  25679. >:
  25680.     <DIV
  25681. CLASS="informalexample"
  25682. ><A
  25683. NAME="AEN5009"
  25684. ></A
  25685. ><P
  25686. ></P
  25687. ><TABLE
  25688. BORDER="0"
  25689. BGCOLOR="#E0E0E0"
  25690. CELLPADDING="5"
  25691. ><TR
  25692. ><TD
  25693. ><PRE
  25694. CLASS="php"
  25695. >if ($i == 0) {
  25696.     print "i se rovnß 0";
  25697. }
  25698. if ($i == 1) {
  25699.     print "i se rovnß 1";
  25700. }
  25701. if ($i == 2) {
  25702.     print "i se rovnß 2";
  25703. }
  25704.  
  25705. switch ($i) {
  25706.     case 0:
  25707.         print "i se rovnß 0";
  25708.         break;
  25709.     case 1:
  25710.         print "i se rovnß 1";
  25711.         break;
  25712.     case 2:
  25713.         print "i se rovnß 2";
  25714.         break;
  25715. }</PRE
  25716. ></TD
  25717. ></TR
  25718. ></TABLE
  25719. ><P
  25720. ></P
  25721. ></DIV
  25722. >
  25723.    </P
  25724. ><P
  25725. >     Je d∙le╛itΘ pochopit, jak se konstrukt <TT
  25726. CLASS="literal"
  25727. >switch</TT
  25728. >
  25729.     provßdφ, aby se zabrßnilo chybßm. Konstrukt <TT
  25730. CLASS="literal"
  25731. >switch</TT
  25732. >
  25733.     provßdφ °ßdek po °ßdku (resp. konstrukt po konstruktu). Na zaΦßtku
  25734.     nenφ proveden ╛ßdn² k≤d. Pouze tehdy, kdy╛ se najde <TT
  25735. CLASS="literal"
  25736. >case</TT
  25737. >
  25738.     s hodnotou odpovφdajφcφ hodnot∞ v²razu u <TT
  25739. CLASS="literal"
  25740. >switch</TT
  25741. >,
  25742.     zaΦne PHP provßd∞t nßsledujφcφ konstrukty. Vykonßvßnφ k≤du pokraΦuje,
  25743.     dokud se nedosßhne konce bloku <TT
  25744. CLASS="literal"
  25745. >switch</TT
  25746. > nebo prvnφho
  25747.     p°φkazu <TT
  25748. CLASS="literal"
  25749. >break</TT
  25750. >. Pokud nenapφ╣ete na konec bloku po
  25751.     <TT
  25752. CLASS="literal"
  25753. >case</TT
  25754. > p°φkaz <TT
  25755. CLASS="literal"
  25756. >break</TT
  25757. >, bude PHP
  25758.     pokraΦovat v provßd∞nφ dal╣φch konstrukt∙ (po dal╣φm
  25759.     <TT
  25760. CLASS="literal"
  25761. >case</TT
  25762. >). Nap°φklad:
  25763.     <DIV
  25764. CLASS="informalexample"
  25765. ><A
  25766. NAME="AEN5021"
  25767. ></A
  25768. ><P
  25769. ></P
  25770. ><TABLE
  25771. BORDER="0"
  25772. BGCOLOR="#E0E0E0"
  25773. CELLPADDING="5"
  25774. ><TR
  25775. ><TD
  25776. ><PRE
  25777. CLASS="php"
  25778. >switch ($i) {
  25779.     case 0:
  25780.         print "i se rovnß 0";
  25781.     case 1:
  25782.         print "i se rovnß 1";
  25783.     case 2:
  25784.         print "i se rovnß 2";
  25785. }</PRE
  25786. ></TD
  25787. ></TR
  25788. ></TABLE
  25789. ><P
  25790. ></P
  25791. ></DIV
  25792. >
  25793.    </P
  25794. ><P
  25795. >     Zde, pokud se $i rovnß 0, se budou provßd∞t v╣echny p°φkazy "print"!
  25796.     Pokud se $i rovnß 1, PHP provede poslednφ dva p°φkazy, a pouze rovnß-li se
  25797.     $i Φφslu 2, obdr╛φte "oΦekßvanΘ" chovßnφ a zobrazφ se pouze "i se rovnß 2".
  25798.     Tak╛e je d∙le╛itΘ nezapomenout na p°φkaz <TT
  25799. CLASS="literal"
  25800. >break</TT
  25801. > (krom∞
  25802.     p°φpadu, kdy ho chcete vynechat zßm∞rn∞ k dosa╛enφ urΦitΘho cφle).
  25803.    </P
  25804. ><P
  25805. >     V konstruktu <TT
  25806. CLASS="literal"
  25807. >switch</TT
  25808. > se podmφnka testuje pouze jednou
  25809.     a v²sledek se porovnßvß s ka╛dou hodnotou v <TT
  25810. CLASS="literal"
  25811. >case</TT
  25812. >.
  25813.     V p°φpad∞ <TT
  25814. CLASS="literal"
  25815. >elseif</TT
  25816. > se podmφnka poka╛dΘ testuje znovu.
  25817.     Pokud je va╣e podmφnka komplikovan∞j╣φ ne╛ jednoduchΘ porovnßnφ a/nebo
  25818.     je uvnit° cyklu, <TT
  25819. CLASS="literal"
  25820. >switch</TT
  25821. > m∙╛e b²t rychlej╣φ.
  25822.    </P
  25823. ><P
  25824. >     Seznam konstrukt∙ za <TT
  25825. CLASS="literal"
  25826. >case</TT
  25827. > m∙╛e b²t takΘ prßzdn², co╛
  25828.     jednodu╣e p°edß °φzenφ nßsledujφcφmu <TT
  25829. CLASS="literal"
  25830. >case</TT
  25831. >.
  25832.     <DIV
  25833. CLASS="informalexample"
  25834. ><A
  25835. NAME="AEN5033"
  25836. ></A
  25837. ><P
  25838. ></P
  25839. ><TABLE
  25840. BORDER="0"
  25841. BGCOLOR="#E0E0E0"
  25842. CELLPADDING="5"
  25843. ><TR
  25844. ><TD
  25845. ><PRE
  25846. CLASS="php"
  25847. >switch ($i) {
  25848.     case 0:
  25849.     case 1:
  25850.     case 2:
  25851.         print "i je men╣φ ne╛ 3, ale nezßpornΘ";
  25852.         break;
  25853.     case 3:
  25854.         print "i je 3";
  25855. }</PRE
  25856. ></TD
  25857. ></TR
  25858. ></TABLE
  25859. ><P
  25860. ></P
  25861. ></DIV
  25862. >
  25863.    </P
  25864. ><P
  25865. >     Specißlnφ <TT
  25866. CLASS="literal"
  25867. >case</TT
  25868. > je "default". Vyhovuje v╣em ostatnφm
  25869.     hodnotßm, kterΘ nejsou pokryty n∞kter²m z ostatnφch
  25870.     <TT
  25871. CLASS="literal"
  25872. >case</TT
  25873. > a mß b²t v╛dy jako poslednφ. Nap°φklad:
  25874.     <DIV
  25875. CLASS="informalexample"
  25876. ><A
  25877. NAME="AEN5038"
  25878. ></A
  25879. ><P
  25880. ></P
  25881. ><TABLE
  25882. BORDER="0"
  25883. BGCOLOR="#E0E0E0"
  25884. CELLPADDING="5"
  25885. ><TR
  25886. ><TD
  25887. ><PRE
  25888. CLASS="php"
  25889. >switch ($i) {
  25890.     case 0:
  25891.         print "i se rovnß 0";
  25892.         break;
  25893.     case 1:
  25894.         print "i se rovnß 1";
  25895.         break;
  25896.     case 2:
  25897.         print "i se rovnß 2";
  25898.         break;
  25899.     default:
  25900.         print "i se nerovnß 0, 1 ani 2";
  25901. }</PRE
  25902. ></TD
  25903. ></TR
  25904. ></TABLE
  25905. ><P
  25906. ></P
  25907. ></DIV
  25908. >
  25909.    </P
  25910. ><P
  25911. >     V²raz v <TT
  25912. CLASS="literal"
  25913. >case</TT
  25914. > m∙╛e b²t libovoln² v²raz, jeho╛ hodnota
  25915.     je jednoduchΘho typu, tj. celΘ nebo reßlnΘ Φφslo nebo °et∞zec. Pole ani
  25916.     objekty nelze pou╛φt, leda╛e by odkazovaly na jednoduch² typ.
  25917.    </P
  25918. ><P
  25919. >     Alternativnφ syntaxe pro konstrukty <TT
  25920. CLASS="literal"
  25921. >switch</TT
  25922. > je
  25923.     podporovßna. Pro vφc informacφ viz
  25924.     <A
  25925. HREF="#control-structures.alternative-syntax"
  25926. >Alternativnφ syntaxe
  25927.     °φdicφch struktur</A
  25928. > .
  25929.     <DIV
  25930. CLASS="informalexample"
  25931. ><A
  25932. NAME="AEN5045"
  25933. ></A
  25934. ><P
  25935. ></P
  25936. ><TABLE
  25937. BORDER="0"
  25938. BGCOLOR="#E0E0E0"
  25939. CELLPADDING="5"
  25940. ><TR
  25941. ><TD
  25942. ><PRE
  25943. CLASS="php"
  25944. >switch ($i):
  25945.     case 0:
  25946.         print "i se rovnß 0";
  25947.         break;
  25948.     case 1:
  25949.         print "i se rovnß 1";
  25950.         break;
  25951.     case 2:
  25952.         print "i se rovnß 2";
  25953.         break;
  25954.     default:
  25955.         print "i se nerovnß 0, 1 ani 2";
  25956. endswitch;</PRE
  25957. ></TD
  25958. ></TR
  25959. ></TABLE
  25960. ><P
  25961. ></P
  25962. ></DIV
  25963. >
  25964.    </P
  25965. ></DIV
  25966. ><DIV
  25967. CLASS="sect1"
  25968. ><HR><H2
  25969. CLASS="sect1"
  25970. ><A
  25971. NAME="control-structures.declare"
  25972. ></A
  25973. ><TT
  25974. CLASS="literal"
  25975. >declare</TT
  25976. ></H2
  25977. ><P
  25978. >     Konstrukt <TT
  25979. CLASS="literal"
  25980. >declare</TT
  25981. > se pou╛φvß k nastavenφ provßd∞cφch
  25982.     direktiv pro blok k≤du. Syntaxe <TT
  25983. CLASS="literal"
  25984. >declare</TT
  25985. > je podobnß
  25986.     syntaxi ostatnφcj konstrukt∙ pro °φzenφ toku:
  25987.     <DIV
  25988. CLASS="informalexample"
  25989. ><A
  25990. NAME="AEN5053"
  25991. ></A
  25992. ><P
  25993. ></P
  25994. ><TABLE
  25995. BORDER="0"
  25996. BGCOLOR="#E0E0E0"
  25997. CELLPADDING="5"
  25998. ><TR
  25999. ><TD
  26000. ><PRE
  26001. CLASS="programlisting"
  26002. >declare (directive) statement</PRE
  26003. ></TD
  26004. ></TR
  26005. ></TABLE
  26006. ><P
  26007. ></P
  26008. ></DIV
  26009. >
  26010.    </P
  26011. ><P
  26012. >     ╚ßst <TT
  26013. CLASS="literal"
  26014. >directive</TT
  26015. > umo╛≥uje nastavit chovßnφ bloku, kter²
  26016.     mß b²t ovlivn∞n pomocφ <TT
  26017. CLASS="literal"
  26018. >declare</TT
  26019. >. V souΦasnosti je
  26020.     rozpoznßvßna pouze jedinß direktiva: <TT
  26021. CLASS="literal"
  26022. >ticks</TT
  26023. >.
  26024.     (Pro vφce informacφ viz nφ╛e - direktiva
  26025.     <A
  26026. HREF="#control-structures.declare.ticks"
  26027. >ticks</A
  26028. >)
  26029.    </P
  26030. ><P
  26031. >     ╚ßst <TT
  26032. CLASS="literal"
  26033. >statement</TT
  26034. > bloku <TT
  26035. CLASS="literal"
  26036. >declare</TT
  26037. >
  26038.     bude provedena - jak bude provedena a jakΘ vedlej╣φ efekty nastanou
  26039.     b∞hem provßd∞nφ m∙╛e zßle╛et na direktiv∞ nastavenΘ v bloku
  26040.     <TT
  26041. CLASS="literal"
  26042. >directive</TT
  26043. >.
  26044.    </P
  26045. ><DIV
  26046. CLASS="sect2"
  26047. ><HR><H3
  26048. CLASS="sect2"
  26049. ><A
  26050. NAME="control-structures.declare.ticks"
  26051. ></A
  26052. >Ticks</H3
  26053. ><P
  26054. >Tick je udßlost, kterß nastane pro ka╛d²ch
  26055.     <TT
  26056. CLASS="replaceable"
  26057. ><I
  26058. >N</I
  26059. ></TT
  26060. > nφzko·rov≥ov²ch konstrukt∙ proveden²ch
  26061.     parserem uvnit° bloku <TT
  26062. CLASS="literal"
  26063. >declare</TT
  26064. >. Hodnota
  26065.     <TT
  26066. CLASS="replaceable"
  26067. ><I
  26068. >N</I
  26069. ></TT
  26070. > je specifikovßna pomocφ
  26071.     <TT
  26072. CLASS="literal"
  26073. >ticks=<TT
  26074. CLASS="replaceable"
  26075. ><I
  26076. >N</I
  26077. ></TT
  26078. ></TT
  26079. > uvnit° sekce
  26080.     <TT
  26081. CLASS="literal"
  26082. >directive</TT
  26083. > bloku <TT
  26084. CLASS="literal"
  26085. >declare</TT
  26086. >.
  26087.    </P
  26088. ><P
  26089. >     Udßlost(i), kterß nastane p°i ka╛dΘm ticku, se specifikuje pomocφ
  26090.     <A
  26091. HREF="#function.register-tick-function"
  26092. ><B
  26093. CLASS="function"
  26094. >register_tick_function()</B
  26095. ></A
  26096. >. Vφce podrobnostφ - viz
  26097.     p°φklad nφ╛e. Uv∞domte si, ╛e na ka╛d² tick m∙╛e nastat vφce ne╛ jedna
  26098.     udßlost.
  26099.    </P
  26100. ><P
  26101. >     <TABLE
  26102. WIDTH="100%"
  26103. BORDER="0"
  26104. CELLPADDING="0"
  26105. CELLSPACING="0"
  26106. CLASS="EXAMPLE"
  26107. ><TR
  26108. ><TD
  26109. ><DIV
  26110. CLASS="example"
  26111. ><A
  26112. NAME="AEN5077"
  26113. ></A
  26114. ><P
  26115. ><B
  26116. >P°φklad 11-1. Profile a section of PHP code</B
  26117. ></P
  26118. ><TABLE
  26119. BORDER="0"
  26120. BGCOLOR="#E0E0E0"
  26121. CELLPADDING="5"
  26122. ><TR
  26123. ><TD
  26124. ><PRE
  26125. CLASS="php"
  26126. ><pre>
  26127. <?php
  26128. // A function that records the time when it is called
  26129. function profile ($dump = FALSE)
  26130. {
  26131.     static $profile;
  26132.  
  26133.     // Return the times stored in profile, then erase it
  26134.     if ($dump) {
  26135.         $temp = $profile;
  26136.         unset ($profile);
  26137.         return ($temp);
  26138.     }
  26139.  
  26140.     $profile[] = microtime ();
  26141. }
  26142.  
  26143. // Set up a tick handler
  26144. register_tick_function("profile");
  26145.  
  26146. // Initialize the function before the declare block
  26147. profile ();
  26148.  
  26149. // Run a block of code, throw a tick every 2nd statement
  26150. declare (ticks=2) {
  26151.     for ($x = 1; $x < 50; ++$x) {
  26152.         echo similar_text (md5($x), md5($x*$x)), "&lt;br&gt;";
  26153.     }
  26154. }
  26155.  
  26156. // Display the data stored in the profiler
  26157. print_r (profile (TRUE));
  26158. ?>
  26159. </pre></PRE
  26160. ></TD
  26161. ></TR
  26162. ></TABLE
  26163. ></DIV
  26164. ></TD
  26165. ></TR
  26166. ></TABLE
  26167. >
  26168.     The example profiles the PHP code within the 'declare'
  26169.     block, recording the time at which every second low-level
  26170.     statement in the block was executed. This information can
  26171.     then be used to find the slow areas within particular
  26172.     segments of code. This process can be performed using other
  26173.     methods: using ticks is more convenient and easier to
  26174.     implement.
  26175.    </P
  26176. ><P
  26177. >     Ticks are well suited for debugging, implementing simple
  26178.     multitasking, backgrounded I/O and many other tasks.
  26179.    </P
  26180. ><P
  26181. >     See also <A
  26182. HREF="#function.register-tick-function"
  26183. ><B
  26184. CLASS="function"
  26185. >register_tick_function()</B
  26186. ></A
  26187. > and
  26188.     <A
  26189. HREF="#function.unregister-tick-function"
  26190. ><B
  26191. CLASS="function"
  26192. >unregister_tick_function()</B
  26193. ></A
  26194. >.
  26195.    </P
  26196. ></DIV
  26197. ></DIV
  26198. ><DIV
  26199. CLASS="sect1"
  26200. ><HR><H2
  26201. CLASS="sect1"
  26202. ><A
  26203. NAME="function.return"
  26204. ></A
  26205. >return</H2
  26206. ><P
  26207. >     Zavolßn uvnit° funkce, konstrukt <A
  26208. HREF="#function.return"
  26209. ><B
  26210. CLASS="function"
  26211. >return()</B
  26212. ></A
  26213. > okam╛it∞
  26214.     ukonΦφ provßd∞nφ tΘto funkce a vracφ sv∙j argument jako hodnotu volßnφ
  26215.     funkce. <A
  26216. HREF="#function.return"
  26217. ><B
  26218. CLASS="function"
  26219. >return()</B
  26220. ></A
  26221. > takΘ obdobn∞ ukonΦφ provßd∞nφ
  26222.     konstruktu <A
  26223. HREF="#function.eval"
  26224. ><B
  26225. CLASS="function"
  26226. >eval()</B
  26227. ></A
  26228. > nebo celΘho skriptu.
  26229.    </P
  26230. ><P
  26231. >     Pokud se volß z globßlnφho kontextu, provßd∞nφ skriptu se ukonΦφ. Byl-li
  26232.     aktußlnφ skript vlo╛en pomocφ <A
  26233. HREF="#function.include"
  26234. ><B
  26235. CLASS="function"
  26236. >include()</B
  26237. ></A
  26238. > nebo
  26239.     <A
  26240. HREF="#function.require"
  26241. ><B
  26242. CLASS="function"
  26243. >require()</B
  26244. ></A
  26245. >, p°edß se °φzenφ volajφcφmu souboru. Navφc,
  26246.     bylo-li pou╛ito <A
  26247. HREF="#function.include"
  26248. ><B
  26249. CLASS="function"
  26250. >include()</B
  26251. ></A
  26252. >, bude hodnota specifikovanß
  26253.     v <A
  26254. HREF="#function.return"
  26255. ><B
  26256. CLASS="function"
  26257. >return()</B
  26258. ></A
  26259. > vrßcena jako hodnota volßnφ
  26260.     <A
  26261. HREF="#function.include"
  26262. ><B
  26263. CLASS="function"
  26264. >include()</B
  26265. ></A
  26266. >. Pokud se <A
  26267. HREF="#function.return"
  26268. ><B
  26269. CLASS="function"
  26270. >return()</B
  26271. ></A
  26272. >
  26273.     zavolß z hlavnφho souboru skriptu, provßd∞nφ skonΦφ. Kdy╛ se jednß o
  26274.     soubor specifikovan² pomocφ konfiguraΦnφch voleb
  26275.     <A
  26276. HREF="#ini.auto-prepend-file"
  26277. >auto_prepend_file</A
  26278. > nebo
  26279.     <A
  26280. HREF="#ini.auto-append-file"
  26281. >auto_append_file</A
  26282. >
  26283.     v <A
  26284. HREF="#configuration.file"
  26285. >konfiguraΦnφm souboru</A
  26286. >,
  26287.     zpracovßnφ souboru konΦφ.
  26288.    </P
  26289. ><P
  26290. >Vφce informacφ - viz
  26291.    <A
  26292. HREF="#functions.returning-values"
  26293. >NßvratovΘ hodnoty</A
  26294. >.
  26295.    </P
  26296. ><DIV
  26297. CLASS="note"
  26298. ><BLOCKQUOTE
  26299. CLASS="note"
  26300. ><P
  26301. ><B
  26302. >Poznßmka: </B
  26303. >
  26304.      Uv∞domte si, ╛e <A
  26305. HREF="#function.return"
  26306. ><B
  26307. CLASS="function"
  26308. >return()</B
  26309. ></A
  26310. > je jazykov² konstrukt, a
  26311.      nikoli funkce -- uzav°enφ argument∙ do zßvorek <SPAN
  26312. CLASS="emphasis"
  26313. ><I
  26314. CLASS="emphasis"
  26315. >nenφ</I
  26316. ></SPAN
  26317. >
  26318.      nutnΘ. Obvykle se vynechßvajφ, ale nezßle╛φ na tom, zda se pou╛ijφ Φi
  26319.      nikoli.
  26320.     </P
  26321. ></BLOCKQUOTE
  26322. ></DIV
  26323. ></DIV
  26324. ><DIV
  26325. CLASS="sect1"
  26326. ><HR><H2
  26327. CLASS="sect1"
  26328. ><A
  26329. NAME="function.require"
  26330. ></A
  26331. ><A
  26332. HREF="#function.require"
  26333. ><B
  26334. CLASS="function"
  26335. >require()</B
  26336. ></A
  26337. ></H2
  26338. ><P
  26339. >     Konstrukt <A
  26340. HREF="#function.require"
  26341. ><B
  26342. CLASS="function"
  26343. >require()</B
  26344. ></A
  26345. > vlo╛φ a ohodnotφ specifikovan²
  26346.     soubor.
  26347.    </P
  26348. ><P
  26349. >      <A
  26350. HREF="#function.require"
  26351. ><B
  26352. CLASS="function"
  26353. >require()</B
  26354. ></A
  26355. > vlo╛φ a ohodnotφ specifikovan² soubor.
  26356.      PodrobnΘ informace o tom, jak vklßdßnφ pracuje, jsou popsßny v
  26357.      dokumentaci o <A
  26358. HREF="#function.include"
  26359. ><B
  26360. CLASS="function"
  26361. >include()</B
  26362. ></A
  26363. >.
  26364.    </P
  26365. ><P
  26366. >      <A
  26367. HREF="#function.require"
  26368. ><B
  26369. CLASS="function"
  26370. >require()</B
  26371. ></A
  26372. > a <A
  26373. HREF="#function.include"
  26374. ><B
  26375. CLASS="function"
  26376. >include()</B
  26377. ></A
  26378. > jsou toto╛nΘ,
  26379.      krom∞ toho, jak zpracovßvajφ chyby. <A
  26380. HREF="#function.include"
  26381. ><B
  26382. CLASS="function"
  26383. >include()</B
  26384. ></A
  26385. >
  26386.      vyprodukuje <A
  26387. HREF="#internal.e-warning"
  26388. >Warning</A
  26389. > (varovßnφ),
  26390.      zatφmco <A
  26391. HREF="#function.require"
  26392. ><B
  26393. CLASS="function"
  26394. >require()</B
  26395. ></A
  26396. > skonΦφ s chybou typu
  26397.      <A
  26398. HREF="#internal.e-error"
  26399. >Fatal Error</A
  26400. > (velmi vß╛nß chyba).
  26401.      Jinak °eΦeno, nerozpakujte se pou╛φt <A
  26402. HREF="#function.require"
  26403. ><B
  26404. CLASS="function"
  26405. >require()</B
  26406. ></A
  26407. >,
  26408.      pokud chcete, aby nep°φtomnost souboru zastavila zpracovßnφ strßnky.
  26409.      <A
  26410. HREF="#function.include"
  26411. ><B
  26412. CLASS="function"
  26413. >include()</B
  26414. ></A
  26415. > se takto nechovß, skript bude neru╣en∞
  26416.      pokraΦovat. Ujist∞te se takΘ, ╛e mßte v po°ßdku nastavenφ
  26417.      <A
  26418. HREF="#ini.include-path"
  26419. >include_path</A
  26420. >.
  26421.    </P
  26422. ><P
  26423. >     <TABLE
  26424. WIDTH="100%"
  26425. BORDER="0"
  26426. CELLPADDING="0"
  26427. CELLSPACING="0"
  26428. CLASS="EXAMPLE"
  26429. ><TR
  26430. ><TD
  26431. ><DIV
  26432. CLASS="example"
  26433. ><A
  26434. NAME="AEN5125"
  26435. ></A
  26436. ><P
  26437. ><B
  26438. >P°φklad 11-2. Zßkladnφ p°φklady pou╛itφ <A
  26439. HREF="#function.require"
  26440. ><B
  26441. CLASS="function"
  26442. >require()</B
  26443. ></A
  26444. ></B
  26445. ></P
  26446. ><TABLE
  26447. BORDER="0"
  26448. BGCOLOR="#E0E0E0"
  26449. CELLPADDING="5"
  26450. ><TR
  26451. ><TD
  26452. ><PRE
  26453. CLASS="php"
  26454. ><?php
  26455.  
  26456. require 'prepend.php';
  26457.  
  26458. require $somefile;
  26459.  
  26460. require ('somefile.txt');
  26461.  
  26462. ?></PRE
  26463. ></TD
  26464. ></TR
  26465. ></TABLE
  26466. ></DIV
  26467. ></TD
  26468. ></TR
  26469. ></TABLE
  26470. >
  26471.    </P
  26472. ><P
  26473. >     Dal╣φ p°φklady -- viz dokumentace <A
  26474. HREF="#function.include"
  26475. ><B
  26476. CLASS="function"
  26477. >include()</B
  26478. ></A
  26479. >.
  26480.    </P
  26481. ><DIV
  26482. CLASS="note"
  26483. ><BLOCKQUOTE
  26484. CLASS="note"
  26485. ><P
  26486. ><B
  26487. >Poznßmka: </B
  26488. >     
  26489.      U verzφ p°ed PHP 4.0.2 platφ toto: <A
  26490. HREF="#function.require"
  26491. ><B
  26492. CLASS="function"
  26493. >require()</B
  26494. ></A
  26495. > se v╛dy
  26496.      pokusφ p°eΦφst p°φslu╣n² soubor, krom∞ p°φpadu, ╛e se °ßdek s tφmto
  26497.      p°φkazem nem∙╛e nikdy provΘst. Podmφn∞n² v²raz
  26498.      <A
  26499. HREF="#function.require"
  26500. ><B
  26501. CLASS="function"
  26502. >require()</B
  26503. ></A
  26504. > neovliv≥uje. Av╣ak pokud se °ßdek, na kterΘm
  26505.      <A
  26506. HREF="#function.require"
  26507. ><B
  26508. CLASS="function"
  26509. >require()</B
  26510. ></A
  26511. > le╛φ, v∙bec neprovßdφ, nebude se provßd∞t
  26512.      ani k≤d v p°φslu╣nΘm souboru. Podobn∞ je tomu i v p°φpad∞ cykl∙ -- ani
  26513.      ty neovliv≥ujφ chovßnφ <A
  26514. HREF="#function.require"
  26515. ><B
  26516. CLASS="function"
  26517. >require()</B
  26518. ></A
  26519. >. P°esto╛e k≤d
  26520.      obsa╛en² ve vklßdanΘm souboru je stßle p°edm∞tem opakovßnφ, samotnΘ 
  26521.      <A
  26522. HREF="#function.require"
  26523. ><B
  26524. CLASS="function"
  26525. >require()</B
  26526. ></A
  26527. > se provede pouze jednou.
  26528.     </P
  26529. ></BLOCKQUOTE
  26530. ></DIV
  26531. ><P
  26532. >     Viz takΘ <A
  26533. HREF="#function.include"
  26534. ><B
  26535. CLASS="function"
  26536. >include()</B
  26537. ></A
  26538. >, <A
  26539. HREF="#function.require-once"
  26540. ><B
  26541. CLASS="function"
  26542. >require_once()</B
  26543. ></A
  26544. >,
  26545.     <A
  26546. HREF="#function.include-once"
  26547. ><B
  26548. CLASS="function"
  26549. >include_once()</B
  26550. ></A
  26551. >, <A
  26552. HREF="#function.eval"
  26553. ><B
  26554. CLASS="function"
  26555. >eval()</B
  26556. ></A
  26557. >, 
  26558.     <A
  26559. HREF="#function.file"
  26560. ><B
  26561. CLASS="function"
  26562. >file()</B
  26563. ></A
  26564. >, <A
  26565. HREF="#function.readfile"
  26566. ><B
  26567. CLASS="function"
  26568. >readfile()</B
  26569. ></A
  26570. >, 
  26571.     <A
  26572. HREF="#function.virtual"
  26573. ><B
  26574. CLASS="function"
  26575. >virtual()</B
  26576. ></A
  26577. > a <A
  26578. HREF="#ini.include-path"
  26579. >include_path</A
  26580. >.
  26581.    </P
  26582. ></DIV
  26583. ><DIV
  26584. CLASS="sect1"
  26585. ><HR><H2
  26586. CLASS="sect1"
  26587. ><A
  26588. NAME="function.include"
  26589. ></A
  26590. ><A
  26591. HREF="#function.include"
  26592. ><B
  26593. CLASS="function"
  26594. >include()</B
  26595. ></A
  26596. ></H2
  26597. ><P
  26598. >     Konstrukt <A
  26599. HREF="#function.include"
  26600. ><B
  26601. CLASS="function"
  26602. >include()</B
  26603. ></A
  26604. > vlo╛φ a ohodnotφ specifikovan²
  26605.     soubor.
  26606.    </P
  26607. ><P
  26608. >      Nφ╛e popsanΘ platφ i pro <A
  26609. HREF="#function.require"
  26610. ><B
  26611. CLASS="function"
  26612. >require()</B
  26613. ></A
  26614. >. Tyto dva konstrukty
  26615.      jsou zcela toto╛nΘ, krom∞ toho, jak zpracovßvajφ chyby.
  26616.      <A
  26617. HREF="#function.include"
  26618. ><B
  26619. CLASS="function"
  26620. >include()</B
  26621. ></A
  26622. > produkuje
  26623.      <A
  26624. HREF="#internal.e-warning"
  26625. >Warning</A
  26626. > (varovßnφ), zatφmco
  26627.      <A
  26628. HREF="#function.require"
  26629. ><B
  26630. CLASS="function"
  26631. >require()</B
  26632. ></A
  26633. > skonΦφ s chybou typu
  26634.      <A
  26635. HREF="#internal.e-error"
  26636. >Fatal Error</A
  26637. >.
  26638.      Jin²mi slovy, <A
  26639. HREF="#function.require"
  26640. ><B
  26641. CLASS="function"
  26642. >require()</B
  26643. ></A
  26644. > pou╛ijte tehdy, chcete-li,
  26645.      aby se p°i chyb∞jφcφm souboru zastavilo zpracovßvßnφ.
  26646.      <A
  26647. HREF="#function.include"
  26648. ><B
  26649. CLASS="function"
  26650. >include()</B
  26651. ></A
  26652. > se tak nechovß, skript bude neru╣en∞
  26653.      pokraΦovat. Ujist∞te se takΘ, ╛e mßte v po°ßdku nastavenφ
  26654.      <A
  26655. HREF="#ini.include-path"
  26656. >include_path</A
  26657. >.
  26658.    </P
  26659. ><P
  26660. >      Pokud se vlo╛φ soubor, potom k≤d v n∞m obsa╛en² d∞dφ
  26661.      <A
  26662. HREF="#language.variables.scope"
  26663. >kontext prom∞nnΘ</A
  26664. >
  26665.      °ßdku, kde byl vlo╛en. V╣echny prom∞nnΘ dostupnΘ na tomto °ßdku
  26666.      volajφcφho souboru budou (od tΘto chvφle) dostupnΘ i ve volanΘm souboru.
  26667.    </P
  26668. ><P
  26669. >      <TABLE
  26670. WIDTH="100%"
  26671. BORDER="0"
  26672. CELLPADDING="0"
  26673. CELLSPACING="0"
  26674. CLASS="EXAMPLE"
  26675. ><TR
  26676. ><TD
  26677. ><DIV
  26678. CLASS="example"
  26679. ><A
  26680. NAME="AEN5164"
  26681. ></A
  26682. ><P
  26683. ><B
  26684. >P°φklad 11-3. Zßkladnφ p°φklad -- <A
  26685. HREF="#function.include"
  26686. ><B
  26687. CLASS="function"
  26688. >include()</B
  26689. ></A
  26690. ></B
  26691. ></P
  26692. ><TABLE
  26693. BORDER="0"
  26694. BGCOLOR="#E0E0E0"
  26695. CELLPADDING="5"
  26696. ><TR
  26697. ><TD
  26698. ><PRE
  26699. CLASS="php"
  26700. >vars.php
  26701. <?php
  26702.  
  26703. $color = 'zelenΘ';
  26704. $fruit = 'jablko';
  26705.  
  26706. ?>
  26707.  
  26708. test.php
  26709. <?php
  26710.  
  26711. echo "Vidφm $color $fruit"; // Vidφm
  26712.  
  26713. include 'vars.php';
  26714.  
  26715. echo "Vidφm $color $fruit"; // Vidφm zelenΘ jablko
  26716.  
  26717. ?></PRE
  26718. ></TD
  26719. ></TR
  26720. ></TABLE
  26721. ></DIV
  26722. ></TD
  26723. ></TR
  26724. ></TABLE
  26725. >
  26726.    </P
  26727. ><P
  26728. >      Pokud ke vlo╛enφ dojde uvnit° funkce ve volajφcφm souboru, potom se v╣echen
  26729.      k≤d obsa╛en² ve volanΘm souboru bude chovat, jako by byl definovßn
  26730.      uvnit° tΘto funkce -- tedy v rßmci kontextu prom∞nn²ch funkce.     
  26731.    </P
  26732. ><P
  26733. >      <TABLE
  26734. WIDTH="100%"
  26735. BORDER="0"
  26736. CELLPADDING="0"
  26737. CELLSPACING="0"
  26738. CLASS="EXAMPLE"
  26739. ><TR
  26740. ><TD
  26741. ><DIV
  26742. CLASS="example"
  26743. ><A
  26744. NAME="AEN5170"
  26745. ></A
  26746. ><P
  26747. ><B
  26748. >P°φklad 11-4. Vklßdßnφ uvnit° funkcφ</B
  26749. ></P
  26750. ><TABLE
  26751. BORDER="0"
  26752. BGCOLOR="#E0E0E0"
  26753. CELLPADDING="5"
  26754. ><TR
  26755. ><TD
  26756. ><PRE
  26757. CLASS="php"
  26758. ><?php
  26759.  
  26760. function foo()
  26761. {
  26762. global $color;
  26763.  
  26764.     include 'vars.php';
  26765.  
  26766.     echo "Vidφm $color $fruit";
  26767. }
  26768.  
  26769. /* vars.php je v kontextu foo(), tak╛e      *
  26770.  * $fruit NEN═ dostupnß mimo tento kontext. *
  26771.  * Naopak $color JE, proto╛e je deklarovßna *
  26772.  * jako globßlnφ.                           */
  26773.  
  26774. foo();                        // Vidφm zelenΘ jablko
  26775. echo "Vidφm $color $fruit";   // Vidφm zelenΘ
  26776.  
  26777. ?></PRE
  26778. ></TD
  26779. ></TR
  26780. ></TABLE
  26781. ></DIV
  26782. ></TD
  26783. ></TR
  26784. ></TABLE
  26785. >
  26786.    </P
  26787. ><P
  26788. >      P°i vklßdßnφ souboru p°ejde parsing na zaΦßtku souboru z PHP re╛imu do
  26789.      m≤du HTML a na jeho konci se vracφ zp∞t do m≤du PHP. Z tohoho d∙vodu
  26790.      musφ b²t provßd∞n² PHP k≤d ve vklßdanΘm souboru uzav°en mezi
  26791.      <A
  26792. HREF="#language.basic-syntax.phpmode"
  26793. >platnou poΦßteΦnφ a
  26794.      koncovou PHP znaΦku</A
  26795. >.
  26796.    </P
  26797. ><P
  26798. >      Pokud jsou v PHP povoleny
  26799.      "<A
  26800. HREF="#ini.allow-url-fopen"
  26801. >URL fopen wrappery</A
  26802. >"
  26803.      (co╛ tak implicitn∞ je), m∙╛ete specifikovat soubor ke vlo╛enφ pomocφ
  26804.      URL (p°es HTTP) namφsto lokßlnφho umφst∞nφ. Pokud p°φsku╣n² server
  26805.      interpretuje po╛adovan² soubor jako PHP k≤d, prom∞nnΘ mohou b²t odkazovßny
  26806.      pomocφ °et∞zce URL po╛adavku jako u HTTP GET. Nenφ to ·pln∞ totΘ╛ jako
  26807.      vlo╛enφ souboru s d∞d∞nφm kontextu prom∞nn²ch od rodiΦovskΘho souboru;
  26808.      skript b∞╛φ na vzdßlenΘm serveru a v²sledek se potom vlo╛φ do lokßlnφho
  26809.      skriptu.
  26810.    </P
  26811. ><P
  26812. >     <TABLE
  26813. WIDTH="100%"
  26814. BORDER="0"
  26815. CELLPADDING="0"
  26816. CELLSPACING="0"
  26817. CLASS="EXAMPLE"
  26818. ><TR
  26819. ><TD
  26820. ><DIV
  26821. CLASS="example"
  26822. ><A
  26823. NAME="AEN5178"
  26824. ></A
  26825. ><P
  26826. ><B
  26827. >P°φklad 11-5. <A
  26828. HREF="#function.include"
  26829. ><B
  26830. CLASS="function"
  26831. >include()</B
  26832. ></A
  26833. > p°es HTTP</B
  26834. ></P
  26835. ><TABLE
  26836. BORDER="0"
  26837. BGCOLOR="#E0E0E0"
  26838. CELLPADDING="5"
  26839. ><TR
  26840. ><TD
  26841. ><PRE
  26842. CLASS="php"
  26843. ><?php
  26844.  
  26845. /* Tento p°φklad p°edpoklßdß, ╛e www.example.com je konfigurovßn k parsovßnφ *
  26846.  * soubor∙ .php a nikoli soubor∙ .txt. Tedy, 'funguje' zde znamenß, ╛e       *
  26847.  * prom∞nnΘ $foo a $bar jsou dostupnΘ uvnit° vklßdanΘho souboru.             */
  26848.  
  26849. // Nefunguje; file.txt nebyl na www.example.com zpracovßn jako PHP
  26850. include 'http://www.example.com/file.txt?foo=1&bar=2';
  26851.  
  26852. // Nefunguje; hledß soubor 'file.php?foo=1&bar=2' v lokßlnφm systΘmu soubor∙.
  26853. include 'file.php?foo=1&bar=2';
  26854.  
  26855. // Funguje.
  26856. include 'http://www.example.com/file.php?foo=1&bar=2';
  26857.  
  26858. $foo = 1;
  26859. $bar = 2;
  26860. include 'file.txt';  // Funguje.
  26861. include 'file.php';  // Funguje.
  26862.  
  26863. ?></PRE
  26864. ></TD
  26865. ></TR
  26866. ></TABLE
  26867. ></DIV
  26868. ></TD
  26869. ></TR
  26870. ></TABLE
  26871. >
  26872.      Souvisejφcφ informace -- viz takΘ
  26873.      <A
  26874. HREF="#features.remote-files"
  26875. >VzdßlenΘ soubory</A
  26876. >,
  26877.      <A
  26878. HREF="#function.fopen"
  26879. ><B
  26880. CLASS="function"
  26881. >fopen()</B
  26882. ></A
  26883. > a <A
  26884. HREF="#function.file"
  26885. ><B
  26886. CLASS="function"
  26887. >file()</B
  26888. ></A
  26889. >.
  26890.    </P
  26891. ><P
  26892. >      Proto╛e <A
  26893. HREF="#function.include"
  26894. ><B
  26895. CLASS="function"
  26896. >include()</B
  26897. ></A
  26898. > a <A
  26899. HREF="#function.require"
  26900. ><B
  26901. CLASS="function"
  26902. >require()</B
  26903. ></A
  26904. >
  26905.      jsou specißlnφ jazykovΘ konstrukty, pokud se provßd∞jφ podmφn∞n∞,
  26906.      musφte je uzav°φt do bloku.
  26907.    </P
  26908. ><P
  26909. >     <TABLE
  26910. WIDTH="100%"
  26911. BORDER="0"
  26912. CELLPADDING="0"
  26913. CELLSPACING="0"
  26914. CLASS="EXAMPLE"
  26915. ><TR
  26916. ><TD
  26917. ><DIV
  26918. CLASS="example"
  26919. ><A
  26920. NAME="AEN5189"
  26921. ></A
  26922. ><P
  26923. ><B
  26924. >P°φklad 11-6. include() a podmφn∞nΘ bloky</B
  26925. ></P
  26926. ><TABLE
  26927. BORDER="0"
  26928. BGCOLOR="#E0E0E0"
  26929. CELLPADDING="5"
  26930. ><TR
  26931. ><TD
  26932. ><PRE
  26933. CLASS="php"
  26934. ><?php
  26935.  
  26936. // Toto je ⌐PATN╠ a (jak bylo °eΦeno) nebude to fungovat.
  26937. if ($condition)
  26938.     include $file;
  26939. else
  26940.     include $other;
  26941.  
  26942.  
  26943. // Tohle je SPR┴VN╠.
  26944. if ($condition) {
  26945.     include $file;
  26946. } else {
  26947.     include $other;
  26948. }
  26949.  
  26950. ?></PRE
  26951. ></TD
  26952. ></TR
  26953. ></TABLE
  26954. ></DIV
  26955. ></TD
  26956. ></TR
  26957. ></TABLE
  26958. >
  26959.    </P
  26960. ><P
  26961. >     Obsluha nßvrat∙: Uvnit° vklßdanΘho souboru lze provΘst konstrukt
  26962.     <A
  26963. HREF="#function.return"
  26964. ><B
  26965. CLASS="function"
  26966. >return()</B
  26967. ></A
  26968. > k ukonΦenφ provßd∞nφ souboru a nßvrat do
  26969.     volajφcφho skriptu. Je tedy mo╛nΘ z vlo╛en²ch soubor∙ vracet hodnoty.
  26970.     M∙╛ete vzφt hodnotu volßnφ include, jako by to byla normßlnφ funkce.
  26971.    </P
  26972. ><DIV
  26973. CLASS="note"
  26974. ><BLOCKQUOTE
  26975. CLASS="note"
  26976. ><P
  26977. ><B
  26978. >Poznßmka: </B
  26979. >
  26980.      V PHP 3 se return nesmφ objevit uvnit° bloku, pokud to nenφ funkΦnφ blok;
  26981.      tehdy v╣ak se v╣ak <A
  26982. HREF="#function.return"
  26983. ><B
  26984. CLASS="function"
  26985. >return()</B
  26986. ></A
  26987. > t²kß tΘto funkce a ne
  26988.      celΘho souboru.
  26989.     </P
  26990. ></BLOCKQUOTE
  26991. ></DIV
  26992. ><P
  26993. >     <TABLE
  26994. WIDTH="100%"
  26995. BORDER="0"
  26996. CELLPADDING="0"
  26997. CELLSPACING="0"
  26998. CLASS="EXAMPLE"
  26999. ><TR
  27000. ><TD
  27001. ><DIV
  27002. CLASS="example"
  27003. ><A
  27004. NAME="AEN5198"
  27005. ></A
  27006. ><P
  27007. ><B
  27008. >P°φklad 11-7. <A
  27009. HREF="#function.include"
  27010. ><B
  27011. CLASS="function"
  27012. >include()</B
  27013. ></A
  27014. > a konstrukt <A
  27015. HREF="#function.return"
  27016. ><B
  27017. CLASS="function"
  27018. >return()</B
  27019. ></A
  27020. ></B
  27021. ></P
  27022. ><TABLE
  27023. BORDER="0"
  27024. BGCOLOR="#E0E0E0"
  27025. CELLPADDING="5"
  27026. ><TR
  27027. ><TD
  27028. ><PRE
  27029. CLASS="php"
  27030. >return.php
  27031. <?php
  27032.  
  27033. $var = 'PHP';
  27034.  
  27035. return $var;
  27036.  
  27037. ?>
  27038.  
  27039. noreturn.php
  27040. <?php
  27041.  
  27042. $var = 'PHP';
  27043.  
  27044. ?>
  27045.  
  27046. testreturns.php
  27047. <?php
  27048.  
  27049. $foo = include 'return.php';
  27050.  
  27051. echo $foo; // vypφ╣e 'PHP'
  27052.  
  27053. $bar = include 'noreturn.php';
  27054.  
  27055. echo $bar; // vypφ╣e 1
  27056.  
  27057. ?></PRE
  27058. ></TD
  27059. ></TR
  27060. ></TABLE
  27061. ></DIV
  27062. ></TD
  27063. ></TR
  27064. ></TABLE
  27065. >
  27066.    </P
  27067. ><P
  27068. >     <TT
  27069. CLASS="literal"
  27070. >$bar</TT
  27071. > mß hodnotu <TT
  27072. CLASS="literal"
  27073. >1</TT
  27074. >, proto╛e p°φkaz
  27075.     include byl ·sp∞╣n². V╣imn∞te si rozdφlu mezi v²╣e uveden²mi p°φklady.
  27076.     Prvnφ pou╛φvß ve vklßdanΘm souboru <A
  27077. HREF="#function.return"
  27078. ><B
  27079. CLASS="function"
  27080. >return()</B
  27081. ></A
  27082. >, druh²
  27083.     nikoli. Dal╣φmi zp∙soby, jak p°i°adit hodnotu souboru do prom∞nnΘ, jsou
  27084.     funkce <A
  27085. HREF="#function.fopen"
  27086. ><B
  27087. CLASS="function"
  27088. >fopen()</B
  27089. ></A
  27090. >, <A
  27091. HREF="#function.file"
  27092. ><B
  27093. CLASS="function"
  27094. >file()</B
  27095. ></A
  27096. > a pou╛itφ
  27097.     <A
  27098. HREF="#function.include"
  27099. ><B
  27100. CLASS="function"
  27101. >include()</B
  27102. ></A
  27103. > spoleΦn∞ s
  27104.     <A
  27105. HREF="#ref.outcontrol"
  27106. >funkcemi °φzenφ v²stupu</A
  27107. >.
  27108.    </P
  27109. ><P
  27110. >     Viz takΘ <A
  27111. HREF="#function.require"
  27112. ><B
  27113. CLASS="function"
  27114. >require()</B
  27115. ></A
  27116. >, <A
  27117. HREF="#function.require-once"
  27118. ><B
  27119. CLASS="function"
  27120. >require_once()</B
  27121. ></A
  27122. >,
  27123.     <A
  27124. HREF="#function.include-once"
  27125. ><B
  27126. CLASS="function"
  27127. >include_once()</B
  27128. ></A
  27129. >, <A
  27130. HREF="#function.readfile"
  27131. ><B
  27132. CLASS="function"
  27133. >readfile()</B
  27134. ></A
  27135. >,
  27136.     <A
  27137. HREF="#function.virtual"
  27138. ><B
  27139. CLASS="function"
  27140. >virtual()</B
  27141. ></A
  27142. >, a
  27143.     <A
  27144. HREF="#ini.include-path"
  27145. >include_path</A
  27146. >.
  27147.    </P
  27148. ></DIV
  27149. ><DIV
  27150. CLASS="sect1"
  27151. ><HR><H2
  27152. CLASS="sect1"
  27153. ><A
  27154. NAME="function.require-once"
  27155. ></A
  27156. ><A
  27157. HREF="#function.require-once"
  27158. ><B
  27159. CLASS="function"
  27160. >require_once()</B
  27161. ></A
  27162. ></H2
  27163. ><P
  27164. >     Konstrukt <A
  27165. HREF="#function.require-once"
  27166. ><B
  27167. CLASS="function"
  27168. >require_once()</B
  27169. ></A
  27170. > vlo╛φ a ohodnotφ specifikovan²
  27171.     soubor b∞hem provßd∞nφ skriptu. Chovß se tedy podobn∞ jako
  27172.     <A
  27173. HREF="#function.require"
  27174. ><B
  27175. CLASS="function"
  27176. >require()</B
  27177. ></A
  27178. >, s tφm rozdφlem, ╛e pokud u╛ byl k≤d ze
  27179.     souboru d°φve vlo╛en do skriptu, nebude znovu vklßdßn. Vφce informacφ o
  27180.     chovßnφ p°φkazu -- viz p°φkaz <A
  27181. HREF="#function.require"
  27182. ><B
  27183. CLASS="function"
  27184. >require()</B
  27185. ></A
  27186. >.
  27187.    </P
  27188. ><P
  27189. >     P°φkaz <A
  27190. HREF="#function.require-once"
  27191. ><B
  27192. CLASS="function"
  27193. >require_once()</B
  27194. ></A
  27195. > by se m∞l pou╛φvat v p°φpadech,
  27196.     kde by mohl b²t b∞hem provßd∞nφ skriptu tent²╛ soubor vlo╛en a ohodnocen
  27197.     vφckrßt, a p°itom chcete zajistit prßv∞ jedno vlo╛enφ (je t°eba se vyhnout
  27198.     redefinicφm funkcφ, novΘmu p°i°azenφ hodnot atd.).
  27199.    </P
  27200. ><P
  27201. >      P°φklady na pou╛itφ <A
  27202. HREF="#function.require-once"
  27203. ><B
  27204. CLASS="function"
  27205. >require_once()</B
  27206. ></A
  27207. > a
  27208.      <A
  27209. HREF="#function.include-once"
  27210. ><B
  27211. CLASS="function"
  27212. >include_once()</B
  27213. ></A
  27214. > najdete v k≤du 
  27215.      <A
  27216. HREF="http://pear.php.net/"
  27217. TARGET="_top"
  27218. >PEAR</A
  27219. > p°ilo╛enΘm v nejnov∞j╣φch
  27220.      distribucφch zdrojov²ch k≤d∙ PHP.
  27221.    </P
  27222. ><DIV
  27223. CLASS="note"
  27224. ><BLOCKQUOTE
  27225. CLASS="note"
  27226. ><P
  27227. ><B
  27228. >Poznßmka: </B
  27229. >
  27230.      P°φkaz <A
  27231. HREF="#function.require-once"
  27232. ><B
  27233. CLASS="function"
  27234. >require_once()</B
  27235. ></A
  27236. > byl p°idßn v PHP 4.0.1pl2.
  27237.     </P
  27238. ></BLOCKQUOTE
  27239. ></DIV
  27240. ><P
  27241. >     Viz takΘ: <A
  27242. HREF="#function.require"
  27243. ><B
  27244. CLASS="function"
  27245. >require()</B
  27246. ></A
  27247. >,
  27248.     <A
  27249. HREF="#function.include"
  27250. ><B
  27251. CLASS="function"
  27252. >include()</B
  27253. ></A
  27254. >, <A
  27255. HREF="#function.include-once"
  27256. ><B
  27257. CLASS="function"
  27258. >include_once()</B
  27259. ></A
  27260. >,
  27261.     <A
  27262. HREF="#function.get-required-files"
  27263. ><B
  27264. CLASS="function"
  27265. >get_required_files()</B
  27266. ></A
  27267. >,
  27268.     <A
  27269. HREF="#function.get-included-files"
  27270. ><B
  27271. CLASS="function"
  27272. >get_included_files()</B
  27273. ></A
  27274. >, <A
  27275. HREF="#function.readfile"
  27276. ><B
  27277. CLASS="function"
  27278. >readfile()</B
  27279. ></A
  27280. >,
  27281.     a <A
  27282. HREF="#function.virtual"
  27283. ><B
  27284. CLASS="function"
  27285. >virtual()</B
  27286. ></A
  27287. >.
  27288.    </P
  27289. ></DIV
  27290. ><DIV
  27291. CLASS="sect1"
  27292. ><HR><H2
  27293. CLASS="sect1"
  27294. ><A
  27295. NAME="function.include-once"
  27296. ></A
  27297. ><A
  27298. HREF="#function.include-once"
  27299. ><B
  27300. CLASS="function"
  27301. >include_once()</B
  27302. ></A
  27303. ></H2
  27304. ><P
  27305. >     Konstrukt <A
  27306. HREF="#function.include-once"
  27307. ><B
  27308. CLASS="function"
  27309. >include_once()</B
  27310. ></A
  27311. > vlo╛φ a ohodnotφ specifikovan²
  27312.     soubor b∞hem provßd∞nφ skriptu. Chovß se tedy podobn∞ jako
  27313.     <A
  27314. HREF="#function.include"
  27315. ><B
  27316. CLASS="function"
  27317. >include()</B
  27318. ></A
  27319. > , s tφm rozdφlem, ╛e pokud u╛ byl k≤d ze
  27320.     souboru d°φve vlo╛en do skriptu, nebude znovu vklßdßn. Jak nßzev napovφdß,
  27321.     bude vlo╛en prßv∞ jednou.
  27322.    </P
  27323. ><P
  27324. >     P°φkaz <A
  27325. HREF="#function.include-once"
  27326. ><B
  27327. CLASS="function"
  27328. >include_once()</B
  27329. ></A
  27330. > by se m∞l pou╛φvat v p°φpadech,
  27331.     kde by mohl b²t b∞hem provßd∞nφ skriptu tent²╛ soubor vlo╛en a ohodnocen
  27332.     vφckrßt, a p°itom chcete zajistit prßv∞ jedno vlo╛enφ (je t°eba se vyhnout
  27333.     redefinicφm funkcφ, novΘmu p°i°azenφ hodnot atd.).
  27334.    </P
  27335. ><P
  27336. >      P°φklady na pou╛itφ <A
  27337. HREF="#function.require-once"
  27338. ><B
  27339. CLASS="function"
  27340. >require_once()</B
  27341. ></A
  27342. > and
  27343.      <A
  27344. HREF="#function.include-once"
  27345. ><B
  27346. CLASS="function"
  27347. >include_once()</B
  27348. ></A
  27349. > najdete v k≤du 
  27350.      <A
  27351. HREF="http://pear.php.net/"
  27352. TARGET="_top"
  27353. >PEAR</A
  27354. > p°ilo╛enΘm v nejnov∞j╣φch
  27355.      distribucφch zdrojov²ch k≤d∙ PHP.
  27356.    </P
  27357. ><DIV
  27358. CLASS="note"
  27359. ><BLOCKQUOTE
  27360. CLASS="note"
  27361. ><P
  27362. ><B
  27363. >Poznßmka: </B
  27364. >
  27365.      P°φkaz <A
  27366. HREF="#function.include-once"
  27367. ><B
  27368. CLASS="function"
  27369. >include_once()</B
  27370. ></A
  27371. > byl p°idßn v PHP 4.0.1pl2.
  27372.     </P
  27373. ></BLOCKQUOTE
  27374. ></DIV
  27375. ><P
  27376. >     Viz takΘ <A
  27377. HREF="#function.include"
  27378. ><B
  27379. CLASS="function"
  27380. >include()</B
  27381. ></A
  27382. >,
  27383.     <A
  27384. HREF="#function.require"
  27385. ><B
  27386. CLASS="function"
  27387. >require()</B
  27388. ></A
  27389. >, <A
  27390. HREF="#function.require-once"
  27391. ><B
  27392. CLASS="function"
  27393. >require_once()</B
  27394. ></A
  27395. >,
  27396.     <A
  27397. HREF="#function.get-required-files"
  27398. ><B
  27399. CLASS="function"
  27400. >get_required_files()</B
  27401. ></A
  27402. >,
  27403.     <A
  27404. HREF="#function.get-included-files"
  27405. ><B
  27406. CLASS="function"
  27407. >get_included_files()</B
  27408. ></A
  27409. >, <A
  27410. HREF="#function.readfile"
  27411. ><B
  27412. CLASS="function"
  27413. >readfile()</B
  27414. ></A
  27415. >,
  27416.     a <A
  27417. HREF="#function.virtual"
  27418. ><B
  27419. CLASS="function"
  27420. >virtual()</B
  27421. ></A
  27422. >.
  27423.    </P
  27424. ></DIV
  27425. ></DIV
  27426. ><DIV
  27427. CLASS="chapter"
  27428. ><HR><H1
  27429. ><A
  27430. NAME="functions"
  27431. >Kapitola 12. Funkce</A
  27432. ></H1
  27433. ><DIV
  27434. CLASS="sect1"
  27435. ><H2
  27436. CLASS="sect1"
  27437. ><A
  27438. NAME="functions.user-defined"
  27439. ></A
  27440. >U╛ivatelsky definovanΘ funkce</H2
  27441. ><P
  27442. >     Funkce m∙╛e b²t definovßna pomocφ syntaxe podobnΘ tΘto:
  27443.  
  27444.     <DIV
  27445. CLASS="informalexample"
  27446. ><A
  27447. NAME="AEN5270"
  27448. ></A
  27449. ><P
  27450. ></P
  27451. ><TABLE
  27452. BORDER="0"
  27453. BGCOLOR="#E0E0E0"
  27454. CELLPADDING="5"
  27455. ><TR
  27456. ><TD
  27457. ><PRE
  27458. CLASS="php"
  27459. >function foo ($arg_1, $arg_2, ..., $arg_n)
  27460. {
  27461.     echo "Ukßzkovß funkce.\n";
  27462.     return $retval;
  27463. }</PRE
  27464. ></TD
  27465. ></TR
  27466. ></TABLE
  27467. ><P
  27468. ></P
  27469. ></DIV
  27470. >
  27471.    </P
  27472. ><P
  27473. >     Do funkce m∙╛e b²t vlo╛en jak²koli platn² PHP k≤d, dokonce i definice
  27474.     jin²ch funkcφ a <A
  27475. HREF="#keyword.class"
  27476. >t°φd</A
  27477. >.
  27478.    </P
  27479. ><P
  27480. >     V PHP 3 musφ b²t funkce definovßny d°φve, ne╛ je na n∞ odkazovßno.
  27481.     V PHP u╛ tento po╛adavek neplatφ.
  27482.    </P
  27483. ><P
  27484. >     PHP nepodporuje p°et∞╛ovßnφ funkcφ, nenφ mo╛nΘ ani oddefinovßnφ nebo
  27485.     p°edefinovanß d°φve deklarovan²ch funkcφ.
  27486.    </P
  27487. ><P
  27488. >     PHP 3 nepodporuje prom∞nn² poΦet argument∙ funkcφ, zatφmco implicitnφ
  27489.     argumenty jsou podporovßny (vφce informacφ - viz
  27490.     <A
  27491. HREF="#functions.arguments.default"
  27492. >Implicitnφ hodnoty argument∙</A
  27493. >).
  27494.     PHP 4 podporuje obojφ: vφce informacφ - viz
  27495.     <A
  27496. HREF="#functions.variable-arg-list"
  27497. >Seznam argument∙ prom∞nnΘ
  27498.     dΘlky</A
  27499. > a reference funkcφ <A
  27500. HREF="#function.func-num-args"
  27501. ><B
  27502. CLASS="function"
  27503. >func_num_args()</B
  27504. ></A
  27505. >,
  27506.     <A
  27507. HREF="#function.func-get-arg"
  27508. ><B
  27509. CLASS="function"
  27510. >func_get_arg()</B
  27511. ></A
  27512. >, a <A
  27513. HREF="#function.func-get-args"
  27514. ><B
  27515. CLASS="function"
  27516. >func_get_args()</B
  27517. ></A
  27518. >.
  27519.    </P
  27520. ></DIV
  27521. ><DIV
  27522. CLASS="sect1"
  27523. ><HR><H2
  27524. CLASS="sect1"
  27525. ><A
  27526. NAME="functions.arguments"
  27527. ></A
  27528. >Argumenty funkcφ</H2
  27529. ><P
  27530. >     Informace mohou b²t do funkcφ p°edßvßny p°es seznam argument∙, co╛ je
  27531.     seznam prom∞nn²ch a/nebo konstant odd∞len²ch Φßrkou.
  27532.    </P
  27533. ><P
  27534. >     PHP podporuje p°edßvßnφ argument∙ hodnotou (implicitnφ),
  27535.     <A
  27536. HREF="#functions.arguments.by-reference"
  27537. >p°edßvßnφ odkazem</A
  27538. >,
  27539.     a <A
  27540. HREF="#functions.arguments.default"
  27541. >implicitnφ hodnoty
  27542.     argument∙</A
  27543. >. Prom∞nnß dΘlka seznamu argument∙ je podporovßna pouze
  27544.     v PHP 4 a pozd∞j╣φch; viz
  27545.     <A
  27546. HREF="#functions.variable-arg-list"
  27547. >Seznam argument∙ prom∞nnΘ
  27548.     dΘlky</A
  27549. > a reference funkcφ <A
  27550. HREF="#function.func-num-args"
  27551. ><B
  27552. CLASS="function"
  27553. >func_num_args()</B
  27554. ></A
  27555. >,
  27556.     <A
  27557. HREF="#function.func-get-arg"
  27558. ><B
  27559. CLASS="function"
  27560. >func_get_arg()</B
  27561. ></A
  27562. >, a <A
  27563. HREF="#function.func-get-args"
  27564. ><B
  27565. CLASS="function"
  27566. >func_get_args()</B
  27567. ></A
  27568. >.
  27569.     Podobn² efekt m∙╛e b²t v PHP 3 dosa╛en p°edßnφm pole argument∙ do
  27570.     funkce:
  27571.  
  27572.     <DIV
  27573. CLASS="informalexample"
  27574. ><A
  27575. NAME="AEN5292"
  27576. ></A
  27577. ><P
  27578. ></P
  27579. ><TABLE
  27580. BORDER="0"
  27581. BGCOLOR="#E0E0E0"
  27582. CELLPADDING="5"
  27583. ><TR
  27584. ><TD
  27585. ><PRE
  27586. CLASS="php"
  27587. >function takes_array($input)
  27588. {
  27589.     echo "$input[0] + $input[1] = ", $input[0]+$input[1];
  27590. }</PRE
  27591. ></TD
  27592. ></TR
  27593. ></TABLE
  27594. ><P
  27595. ></P
  27596. ></DIV
  27597. >
  27598.    </P
  27599. ><DIV
  27600. CLASS="sect2"
  27601. ><HR><H3
  27602. CLASS="sect2"
  27603. ><A
  27604. NAME="functions.arguments.by-reference"
  27605. ></A
  27606. >P°edßvßnφ argument∙ odkazem</H3
  27607. ><P
  27608. >      Implicitn∞ jsou argumenty funkcφ p°edßvßny hodnotou (tak╛e kdy╛ zm∞nφte
  27609.      hodnotu argumentu ve funkci, nezm∞nφ se mimo funkci). Pokud chcete
  27610.      umo╛nit funkci modifikovat svΘ argumenty, musφte je p°edßvat odkazem.
  27611.     </P
  27612. ><P
  27613. >      Pokud chcete, aby byl argument do funkce p°edßvßn v╛dy odkazem, m∙╛ete
  27614.      p°ed nßzev argumentu v definici funkce p°ed°adit ampersand (&):
  27615.  
  27616.      <DIV
  27617. CLASS="informalexample"
  27618. ><A
  27619. NAME="AEN5298"
  27620. ></A
  27621. ><P
  27622. ></P
  27623. ><TABLE
  27624. BORDER="0"
  27625. BGCOLOR="#E0E0E0"
  27626. CELLPADDING="5"
  27627. ><TR
  27628. ><TD
  27629. ><PRE
  27630. CLASS="php"
  27631. >function add_some_extra(&$string)
  27632. {
  27633.     $string .= 'a n∞co navφc.';
  27634. }
  27635. $str = 'Toto je °et∞zec ';
  27636. add_some_extra($str);
  27637. echo $str;    // vypφ╣e 'Toto je °et∞zec a n∞co navφc.'</PRE
  27638. ></TD
  27639. ></TR
  27640. ></TABLE
  27641. ><P
  27642. ></P
  27643. ></DIV
  27644. >
  27645.     </P
  27646. ></DIV
  27647. ><DIV
  27648. CLASS="sect2"
  27649. ><HR><H3
  27650. CLASS="sect2"
  27651. ><A
  27652. NAME="functions.arguments.default"
  27653. ></A
  27654. >Implicitnφ hodnoty argument∙</H3
  27655. ><P
  27656. >      Funkce m∙╛e ve stylu C++ definovat implicitnφ hodnoty pro skalßrnφ
  27657.      argumenty takto:
  27658.  
  27659.      <DIV
  27660. CLASS="informalexample"
  27661. ><A
  27662. NAME="AEN5303"
  27663. ></A
  27664. ><P
  27665. ></P
  27666. ><TABLE
  27667. BORDER="0"
  27668. BGCOLOR="#E0E0E0"
  27669. CELLPADDING="5"
  27670. ><TR
  27671. ><TD
  27672. ><PRE
  27673. CLASS="php"
  27674. >function makecoffee ($type = "cappucina")
  27675. {
  27676.     return "D∞lßm ╣ßlek $type.\n";
  27677. }
  27678. echo makecoffee ();
  27679. echo makecoffee ("espressa");</PRE
  27680. ></TD
  27681. ></TR
  27682. ></TABLE
  27683. ><P
  27684. ></P
  27685. ></DIV
  27686. >
  27687.     </P
  27688. ><P
  27689. >      V²stupem v²╣e uvedenΘho k≤du je:
  27690.  
  27691.      <TABLE
  27692. BORDER="0"
  27693. BGCOLOR="#E0E0E0"
  27694. CELLPADDING="5"
  27695. ><TR
  27696. ><TD
  27697. ><PRE
  27698. CLASS="screen"
  27699. >D∞lßm ╣ßlek cappucina.
  27700. D∞lßm ╣ßlek espressa.</PRE
  27701. ></TD
  27702. ></TR
  27703. ></TABLE
  27704. >
  27705.     </P
  27706. ><P
  27707. >      Implicitnφ hodnota musφ b²t konstantnφ v²raz, ne (nap°φklad) prom∞nnß
  27708.      nebo polo╛ka t°φdy.
  27709.     </P
  27710. ><P
  27711. >      Uv∞domte si, ╛e kdy╛ pou╛φvßte implicitnφ argumenty, jakΘkoli implicitnφ
  27712.      hodnoty by m∞ly b²t na pravΘ stan∞ neimplicitnφho argumentu; jinak
  27713.      to nebude pracovat podle oΦekßvßnφ. Uva╛ujme tento kus k≤du:
  27714.  
  27715.      <DIV
  27716. CLASS="informalexample"
  27717. ><A
  27718. NAME="AEN5309"
  27719. ></A
  27720. ><P
  27721. ></P
  27722. ><TABLE
  27723. BORDER="0"
  27724. BGCOLOR="#E0E0E0"
  27725. CELLPADDING="5"
  27726. ><TR
  27727. ><TD
  27728. ><PRE
  27729. CLASS="php"
  27730. >function makeyogurt ($type = "acidophilus", $flavour)
  27731. {
  27732.     return "D∞lßm kelφmek jogurtu $type $flavour.\n";
  27733. }
  27734.  
  27735. echo makeyogurt ("malina");   // nebude pracovat podle oΦekßvßnφ</PRE
  27736. ></TD
  27737. ></TR
  27738. ></TABLE
  27739. ><P
  27740. ></P
  27741. ></DIV
  27742. >
  27743.     </P
  27744. ><P
  27745. >      V²stupem uvedenΘho p°φkladu bude:
  27746.  
  27747.      <TABLE
  27748. BORDER="0"
  27749. BGCOLOR="#E0E0E0"
  27750. CELLPADDING="5"
  27751. ><TR
  27752. ><TD
  27753. ><PRE
  27754. CLASS="screen"
  27755. >Warning: Missing argument 2 in call to makeyogurt() in 
  27756. /usr/local/etc/httpd/htdocs/php3test/functest.html on line 41
  27757. D∞lßm kelφmek jogurtu malina.</PRE
  27758. ></TD
  27759. ></TR
  27760. ></TABLE
  27761. >
  27762.     </P
  27763. ><P
  27764. >      A nynφ to porovnejme s tφmto:
  27765.  
  27766.      <DIV
  27767. CLASS="informalexample"
  27768. ><A
  27769. NAME="AEN5314"
  27770. ></A
  27771. ><P
  27772. ></P
  27773. ><TABLE
  27774. BORDER="0"
  27775. BGCOLOR="#E0E0E0"
  27776. CELLPADDING="5"
  27777. ><TR
  27778. ><TD
  27779. ><PRE
  27780. CLASS="php"
  27781. >function makeyogurt ($flavour, $type = "acidophilus")
  27782. {
  27783.     return "D∞lßm kelφmek jogurtu $type $flavour.\n";
  27784. }
  27785.  
  27786. echo makeyogurt ("malina");   // pracuje podle oΦekßvßnφ</PRE
  27787. ></TD
  27788. ></TR
  27789. ></TABLE
  27790. ><P
  27791. ></P
  27792. ></DIV
  27793. >
  27794.     </P
  27795. ><P
  27796. >      P°φklad vytiskne:
  27797.  
  27798.      <TABLE
  27799. BORDER="0"
  27800. BGCOLOR="#E0E0E0"
  27801. CELLPADDING="5"
  27802. ><TR
  27803. ><TD
  27804. ><PRE
  27805. CLASS="screen"
  27806. >D∞lßm kelφmek jogurtu acidophilus malina.</PRE
  27807. ></TD
  27808. ></TR
  27809. ></TABLE
  27810. >
  27811.     </P
  27812. ></DIV
  27813. ><DIV
  27814. CLASS="sect2"
  27815. ><HR><H3
  27816. CLASS="sect2"
  27817. ><A
  27818. NAME="functions.variable-arg-list"
  27819. ></A
  27820. >Seznam argument∙ prom∞nnΘ dΘlky</H3
  27821. ><P
  27822. >      PHP 4 mß podporu pro seznam argument∙ prom∞nnΘ dΘlky v u╛ivatelsk²ch
  27823.      funkcφch. Je to opravdu jednoduchΘ, pou╛itφm funkcφ
  27824.      <A
  27825. HREF="#function.func-num-args"
  27826. ><B
  27827. CLASS="function"
  27828. >func_num_args()</B
  27829. ></A
  27830. >,
  27831.      <A
  27832. HREF="#function.func-get-arg"
  27833. ><B
  27834. CLASS="function"
  27835. >func_get_arg()</B
  27836. ></A
  27837. >, a
  27838.      <A
  27839. HREF="#function.func-get-args"
  27840. ><B
  27841. CLASS="function"
  27842. >func_get_args()</B
  27843. ></A
  27844. >.
  27845.     </P
  27846. ><P
  27847. >      Nenφ t°eba ╛ßdnß zvlß╣tnφ syntaxe, seznam argument∙ m∙╛e b²t stßle
  27848.      explicitn∞ poskytovßn definicemi funkcφ a bude se chovat jako normßln∞.
  27849.     </P
  27850. ></DIV
  27851. ></DIV
  27852. ><DIV
  27853. CLASS="sect1"
  27854. ><HR><H2
  27855. CLASS="sect1"
  27856. ><A
  27857. NAME="functions.returning-values"
  27858. ></A
  27859. >NßvratovΘ hodnoty</H2
  27860. ><P
  27861. >     Hodnoty jsou vraceny pomocφ nepovinnΘ klausule return. M∙╛e b²t vracen
  27862.     libovoln² typ, vΦetn∞ seznam∙ a objekt∙. Klasule zp∙sobuje, ╛e funkce
  27863.     okam╛it∞ ukonΦφ sv∙j b∞h a p°edß °φzenφ zp∞t na °ßdek, odkud byla volßna.
  27864.     Pro vφce informacφ viz <A
  27865. HREF="#function.return"
  27866. ><B
  27867. CLASS="function"
  27868. >return()</B
  27869. ></A
  27870. >.
  27871.     <DIV
  27872. CLASS="informalexample"
  27873. ><A
  27874. NAME="AEN5329"
  27875. ></A
  27876. ><P
  27877. ></P
  27878. ><TABLE
  27879. BORDER="0"
  27880. BGCOLOR="#E0E0E0"
  27881. CELLPADDING="5"
  27882. ><TR
  27883. ><TD
  27884. ><PRE
  27885. CLASS="php"
  27886. >function square ($num)
  27887. {
  27888.     return $num * $num;
  27889. }
  27890. echo square (4);   // vypφ╣e '16'.</PRE
  27891. ></TD
  27892. ></TR
  27893. ></TABLE
  27894. ><P
  27895. ></P
  27896. ></DIV
  27897. >
  27898.    </P
  27899. ><P
  27900. >     Z funkce nem∙╛ete vracet vφce hodnot, ale podobnΘho v²sledku m∙╛e b²t
  27901.     dosa╛eno vrßcenφm seznamu.
  27902.  
  27903.     <DIV
  27904. CLASS="informalexample"
  27905. ><A
  27906. NAME="AEN5332"
  27907. ></A
  27908. ><P
  27909. ></P
  27910. ><TABLE
  27911. BORDER="0"
  27912. BGCOLOR="#E0E0E0"
  27913. CELLPADDING="5"
  27914. ><TR
  27915. ><TD
  27916. ><PRE
  27917. CLASS="php"
  27918. >function small_numbers()
  27919. {
  27920.     return array (0, 1, 2);
  27921. }
  27922. list ($zero, $one, $two) = small_numbers();</PRE
  27923. ></TD
  27924. ></TR
  27925. ></TABLE
  27926. ><P
  27927. ></P
  27928. ></DIV
  27929. >
  27930.    </P
  27931. ><P
  27932. >     K vrßcenφ odkazu z funkce musφte pou╛φt referenΦnφ operßtor & jak
  27933.     v deklaraci funkce, tak p°i p°i°azovßnφ vrßcenΘ hodnoty do prom∞nnΘ:
  27934.     <DIV
  27935. CLASS="informalexample"
  27936. ><A
  27937. NAME="AEN5335"
  27938. ></A
  27939. ><P
  27940. ></P
  27941. ><TABLE
  27942. BORDER="0"
  27943. BGCOLOR="#E0E0E0"
  27944. CELLPADDING="5"
  27945. ><TR
  27946. ><TD
  27947. ><PRE
  27948. CLASS="php"
  27949. >function &returns_reference()
  27950. {
  27951.     return $someref;
  27952. }
  27953.  
  27954. $newref =& returns_reference();</PRE
  27955. ></TD
  27956. ></TR
  27957. ></TABLE
  27958. ><P
  27959. ></P
  27960. ></DIV
  27961. >
  27962.    </P
  27963. ><P
  27964. >     Pro dal╣φ informace o odkazech se laskav∞ podφvejte na
  27965.     <A
  27966. HREF="#language.references"
  27967. >Vysv∞tlenφ odkaz∙</A
  27968. >.
  27969.    </P
  27970. ></DIV
  27971. ><DIV
  27972. CLASS="sect1"
  27973. ><HR><H2
  27974. CLASS="sect1"
  27975. ><A
  27976. NAME="functions.old-syntax"
  27977. ></A
  27978. ><TT
  27979. CLASS="literal"
  27980. >old_function</TT
  27981. ></H2
  27982. ><P
  27983. >     Klausule <TT
  27984. CLASS="literal"
  27985. >old_function</TT
  27986. > umo╛≥uje deklarovat funkci
  27987.     s identickou syntaxφ jako v PHP/FI2 (krom∞ toho, ╛e musφte 'function'
  27988.     nahradit 'old_function'.
  27989.    </P
  27990. ><P
  27991. >     Toto je zavr╛enß mo╛nost a m∞la by b²t pou╛φvßna pouze PHP/FI2->PHP 3
  27992.     konvertorem.
  27993.    </P
  27994. ><DIV
  27995. CLASS="warning"
  27996. ><P
  27997. ></P
  27998. ><TABLE
  27999. CLASS="warning"
  28000. BORDER="1"
  28001. WIDTH="100%"
  28002. ><TR
  28003. ><TD
  28004. ALIGN="CENTER"
  28005. ><B
  28006. >Varovßnφ</B
  28007. ></TD
  28008. ></TR
  28009. ><TR
  28010. ><TD
  28011. ALIGN="LEFT"
  28012. ><P
  28013. >      Funkce deklarovanΘ jako <TT
  28014. CLASS="literal"
  28015. >old_function</TT
  28016. > nelze volat
  28017.      z internφho k≤du PHP. To mj. znamenß, ╛e je nem∙╛ete pou╛φvat ve funkcφch
  28018.      jako <A
  28019. HREF="#function.usort"
  28020. ><B
  28021. CLASS="function"
  28022. >usort()</B
  28023. ></A
  28024. >, <A
  28025. HREF="#function.array-walk"
  28026. ><B
  28027. CLASS="function"
  28028. >array_walk()</B
  28029. ></A
  28030. >, a
  28031.      <A
  28032. HREF="#function.register-shutdown-function"
  28033. ><B
  28034. CLASS="function"
  28035. >register_shutdown_function()</B
  28036. ></A
  28037. >. Toto omezenφ m∙╛ete
  28038.      obejφt napsßnφm wrapperu (v normßlnφ PHP 3 form∞), z n∞ho╛ volßte
  28039.      <TT
  28040. CLASS="literal"
  28041. >old_function</TT
  28042. >.
  28043.     </P
  28044. ></TD
  28045. ></TR
  28046. ></TABLE
  28047. ></DIV
  28048. ></DIV
  28049. ><DIV
  28050. CLASS="sect1"
  28051. ><HR><H2
  28052. CLASS="sect1"
  28053. ><A
  28054. NAME="functions.variable-functions"
  28055. ></A
  28056. >Funkce v prom∞nn²ch</H2
  28057. ><P
  28058. >     PHP podporuje koncept funkcφ v prom∞nn²ch. To znamenß, ╛e kdy╛
  28059.     mß nßzev prom∞nnΘ p°ipojeny zßvorky, PHP bude hledat funkci se stejn²m
  28060.     nßzvem, jako mß hodnota prom∞nnΘ, a pokusφ se ji provΘst. To lze mj.
  28061.     pou╛φt k implementacφ zp∞tn²ch volßnφ, tabulek funkcφ atd.
  28062.    </P
  28063. ><P
  28064. >     Funkce v prom∞nn²ch nebudou fungovat s jazykov²mi konstrukty jin²mi ne╛
  28065.     <A
  28066. HREF="#function.print"
  28067. ><B
  28068. CLASS="function"
  28069. >print()</B
  28070. ></A
  28071. >, jako je <A
  28072. HREF="#function.echo"
  28073. ><B
  28074. CLASS="function"
  28075. >echo()</B
  28076. ></A
  28077. >,
  28078.     <A
  28079. HREF="#function.unset"
  28080. ><B
  28081. CLASS="function"
  28082. >unset()</B
  28083. ></A
  28084. >, <A
  28085. HREF="#function.isset"
  28086. ><B
  28087. CLASS="function"
  28088. >isset()</B
  28089. ></A
  28090. > a
  28091.     <A
  28092. HREF="#function.empty"
  28093. ><B
  28094. CLASS="function"
  28095. >empty()</B
  28096. ></A
  28097. >. To je jeden z velk²ch rozdφl∙ mezi funkcemi
  28098.     PHP a jazykov²mi konstrukty.
  28099.    </P
  28100. ><P
  28101. >     <TABLE
  28102. WIDTH="100%"
  28103. BORDER="0"
  28104. CELLPADDING="0"
  28105. CELLSPACING="0"
  28106. CLASS="EXAMPLE"
  28107. ><TR
  28108. ><TD
  28109. ><DIV
  28110. CLASS="example"
  28111. ><A
  28112. NAME="AEN5362"
  28113. ></A
  28114. ><P
  28115. ><B
  28116. >P°φklad 12-1. P°φklad na funkce v prom∞nn²ch</B
  28117. ></P
  28118. ><TABLE
  28119. BORDER="0"
  28120. BGCOLOR="#E0E0E0"
  28121. CELLPADDING="5"
  28122. ><TR
  28123. ><TD
  28124. ><PRE
  28125. CLASS="php"
  28126. ><?php
  28127. function foo()
  28128. {
  28129.     echo "V foo()<br>\n";
  28130. }
  28131.  
  28132. function bar($arg = '')
  28133. {
  28134.     echo "V bar(); byl argument '$arg'.<br>\n";
  28135. }
  28136.  
  28137. $func = 'foo';
  28138. $func();
  28139. $func = 'bar';
  28140. $func('test');
  28141. ?></PRE
  28142. ></TD
  28143. ></TR
  28144. ></TABLE
  28145. ></DIV
  28146. ></TD
  28147. ></TR
  28148. ></TABLE
  28149. >
  28150.    </P
  28151. ></DIV
  28152. ></DIV
  28153. ><DIV
  28154. CLASS="chapter"
  28155. ><HR><H1
  28156. ><A
  28157. NAME="language.oop"
  28158. >Kapitola 13. Classes and Objects</A
  28159. ></H1
  28160. ><DIV
  28161. CLASS="sect1"
  28162. ><H2
  28163. CLASS="sect1"
  28164. ><A
  28165. NAME="keyword.class"
  28166. ></A
  28167. ><TT
  28168. CLASS="literal"
  28169. >class</TT
  28170. ></H2
  28171. ><P
  28172. >     A class is a collection of variables and functions working with
  28173.     these variables.  A class is defined using the following syntax:
  28174.    </P
  28175. ><P
  28176. >     <DIV
  28177. CLASS="informalexample"
  28178. ><A
  28179. NAME="AEN5372"
  28180. ></A
  28181. ><P
  28182. ></P
  28183. ><TABLE
  28184. BORDER="0"
  28185. BGCOLOR="#E0E0E0"
  28186. CELLPADDING="5"
  28187. ><TR
  28188. ><TD
  28189. ><PRE
  28190. CLASS="php"
  28191. ><?php
  28192. class Cart
  28193. {
  28194.     var $items;  // Items in our shopping cart
  28195.    
  28196.     // Add $num articles of $artnr to the cart
  28197.  
  28198.     function add_item ($artnr, $num)
  28199.     {
  28200.         $this->items[$artnr] += $num;
  28201.     }
  28202.    
  28203.     // Take $num articles of $artnr out of the cart
  28204.  
  28205.     function remove_item ($artnr, $num)
  28206.     {
  28207.         if ($this->items[$artnr] > $num) {
  28208.             $this->items[$artnr] -= $num;
  28209.             return true;
  28210.         } else {
  28211.             return false;
  28212.         }   
  28213.     }
  28214. }
  28215. ?></PRE
  28216. ></TD
  28217. ></TR
  28218. ></TABLE
  28219. ><P
  28220. ></P
  28221. ></DIV
  28222. >
  28223.    </P
  28224. ><P
  28225. >     This defines a class named Cart that consists of an associative
  28226.     array of articles in the cart and two functions to add and remove
  28227.     items from this cart.
  28228.    </P
  28229. ><DIV
  28230. CLASS="warning"
  28231. ><P
  28232. ></P
  28233. ><TABLE
  28234. CLASS="warning"
  28235. BORDER="1"
  28236. WIDTH="100%"
  28237. ><TR
  28238. ><TD
  28239. ALIGN="CENTER"
  28240. ><B
  28241. >Varovßnφ</B
  28242. ></TD
  28243. ></TR
  28244. ><TR
  28245. ><TD
  28246. ALIGN="LEFT"
  28247. ><P
  28248. >      You can <SPAN
  28249. CLASS="emphasis"
  28250. ><I
  28251. CLASS="emphasis"
  28252. >NOT</I
  28253. ></SPAN
  28254. > break up a class definition into
  28255.      multiple files, or multiple PHP blocks. The following will not work:
  28256.     </P
  28257. ><P
  28258. >      <DIV
  28259. CLASS="informalexample"
  28260. ><A
  28261. NAME="AEN5379"
  28262. ></A
  28263. ><P
  28264. ></P
  28265. ><TABLE
  28266. BORDER="0"
  28267. BGCOLOR="#E0E0E0"
  28268. CELLPADDING="5"
  28269. ><TR
  28270. ><TD
  28271. ><PRE
  28272. CLASS="php"
  28273. ><?php
  28274. class test {
  28275. ?>
  28276. <?php
  28277.     function test() {
  28278.         print 'OK';
  28279.     }
  28280. }
  28281. ?></PRE
  28282. ></TD
  28283. ></TR
  28284. ></TABLE
  28285. ><P
  28286. ></P
  28287. ></DIV
  28288. >
  28289.     </P
  28290. ></TD
  28291. ></TR
  28292. ></TABLE
  28293. ></DIV
  28294. ><P
  28295. >     The following cautionary notes are valid for PHP 4.
  28296.    </P
  28297. ><DIV
  28298. CLASS="caution"
  28299. ><P
  28300. ></P
  28301. ><TABLE
  28302. CLASS="caution"
  28303. BORDER="1"
  28304. WIDTH="100%"
  28305. ><TR
  28306. ><TD
  28307. ALIGN="CENTER"
  28308. ><B
  28309. >V²straha</B
  28310. ></TD
  28311. ></TR
  28312. ><TR
  28313. ><TD
  28314. ALIGN="LEFT"
  28315. ><P
  28316. >      The name <TT
  28317. CLASS="literal"
  28318. >stdClass</TT
  28319. > is used interally by
  28320.      Zend and is reserved. You cannot have a class named
  28321.      <TT
  28322. CLASS="literal"
  28323. >stdClass</TT
  28324. > in PHP.
  28325.     </P
  28326. ></TD
  28327. ></TR
  28328. ></TABLE
  28329. ></DIV
  28330. ><DIV
  28331. CLASS="caution"
  28332. ><P
  28333. ></P
  28334. ><TABLE
  28335. CLASS="caution"
  28336. BORDER="1"
  28337. WIDTH="100%"
  28338. ><TR
  28339. ><TD
  28340. ALIGN="CENTER"
  28341. ><B
  28342. >V²straha</B
  28343. ></TD
  28344. ></TR
  28345. ><TR
  28346. ><TD
  28347. ALIGN="LEFT"
  28348. ><P
  28349. >       The function names <TT
  28350. CLASS="literal"
  28351. >__sleep</TT
  28352. > and
  28353.       <TT
  28354. CLASS="literal"
  28355. >__wakeup</TT
  28356. > are magical in PHP classes. You
  28357.       cannot have functions with these names in any of your
  28358.       classes unless you want the magic functionality associated
  28359.       with them. See below for more information.
  28360.     </P
  28361. ></TD
  28362. ></TR
  28363. ></TABLE
  28364. ></DIV
  28365. ><DIV
  28366. CLASS="caution"
  28367. ><P
  28368. ></P
  28369. ><TABLE
  28370. CLASS="caution"
  28371. BORDER="1"
  28372. WIDTH="100%"
  28373. ><TR
  28374. ><TD
  28375. ALIGN="CENTER"
  28376. ><B
  28377. >V²straha</B
  28378. ></TD
  28379. ></TR
  28380. ><TR
  28381. ><TD
  28382. ALIGN="LEFT"
  28383. ><P
  28384. >       PHP reserves all function names starting with __ as magical.
  28385.       It is recommended that you do not use function names with
  28386.       __ in PHP unless you want some documented magic functionality.
  28387.     </P
  28388. ></TD
  28389. ></TR
  28390. ></TABLE
  28391. ></DIV
  28392. ><P
  28393. >     In PHP 4, only constant initializers for <TT
  28394. CLASS="literal"
  28395. >var</TT
  28396. >
  28397.     variables are allowed. To initialize variables with non-constant
  28398.     values, you need an initialization function which is called
  28399.     automatically when an object is being constructed from the
  28400.     class. Such a function is called a constructor (see below).
  28401.    </P
  28402. ><DIV
  28403. CLASS="informalexample"
  28404. ><A
  28405. NAME="AEN5394"
  28406. ></A
  28407. ><P
  28408. ></P
  28409. ><TABLE
  28410. BORDER="0"
  28411. BGCOLOR="#E0E0E0"
  28412. CELLPADDING="5"
  28413. ><TR
  28414. ><TD
  28415. ><PRE
  28416. CLASS="php"
  28417. ><?php
  28418. class Cart
  28419. {
  28420.     /* None of these will work in PHP 4. */
  28421.     var $todays_date = date("Y-m-d");
  28422.     var $name = $firstname;
  28423.     var $owner = 'Fred ' . 'Jones';
  28424.     /* Arrays containing constant values will, though. */
  28425.     var $items = array("VCR", "TV");
  28426. }
  28427.  
  28428. /* This is how it should be done. */
  28429. class Cart
  28430. {
  28431.     var $todays_date;
  28432.     var $name;
  28433.     var $owner;
  28434.     var $items = array("VCR", "TV");
  28435.  
  28436.     function Cart()
  28437.     {
  28438.         $this->todays_date = date("Y-m-d");
  28439.         $this->name = $GLOBALS['firstname'];
  28440.         /* etc. . . */
  28441.     }
  28442. }
  28443. ?></PRE
  28444. ></TD
  28445. ></TR
  28446. ></TABLE
  28447. ><P
  28448. ></P
  28449. ></DIV
  28450. ><P
  28451. >     Classes are types, that is, they are blueprints for actual
  28452.     variables. You have to create a variable of the desired type with
  28453.     the <TT
  28454. CLASS="literal"
  28455. >new</TT
  28456. > operator.
  28457.    </P
  28458. ><DIV
  28459. CLASS="informalexample"
  28460. ><A
  28461. NAME="AEN5398"
  28462. ></A
  28463. ><P
  28464. ></P
  28465. ><TABLE
  28466. BORDER="0"
  28467. BGCOLOR="#E0E0E0"
  28468. CELLPADDING="5"
  28469. ><TR
  28470. ><TD
  28471. ><PRE
  28472. CLASS="php"
  28473. ><?php
  28474. $cart = new Cart;
  28475. $cart->add_item("10", 1);
  28476.  
  28477. $another_cart = new Cart;
  28478. $another_cart->add_item("0815", 3);
  28479. ?></PRE
  28480. ></TD
  28481. ></TR
  28482. ></TABLE
  28483. ><P
  28484. ></P
  28485. ></DIV
  28486. ><P
  28487. >     This creates the objects <TT
  28488. CLASS="varname"
  28489. >$cart</TT
  28490. > and
  28491.     <TT
  28492. CLASS="varname"
  28493. >$another_cart</TT
  28494. >, both of the class Cart. The function
  28495.     add_item() of the <TT
  28496. CLASS="varname"
  28497. >$cart</TT
  28498. > object is being called to add 1
  28499.     item of article number 10 to the <TT
  28500. CLASS="varname"
  28501. >$cart</TT
  28502. >. 3 items of
  28503.     article number 0815 are being added to <TT
  28504. CLASS="varname"
  28505. >$another_cart</TT
  28506. >.
  28507.    </P
  28508. ><P
  28509. >     Both, <TT
  28510. CLASS="varname"
  28511. >$cart</TT
  28512. > and <TT
  28513. CLASS="varname"
  28514. >$another_cart</TT
  28515. >, have
  28516.     functions add_item(), remove_item() and a variable items. These are
  28517.     distinct functions and variables. You can think of the objects as
  28518.     something similar to directories in a filesystem. In a filesystem you can
  28519.     have two different files README.TXT, as long as they are in different
  28520.     directories.  Just like with directories where you'll have to type the
  28521.     full pathname in order to reach each file from the toplevel directory, you
  28522.     have to specify the complete name of the function you want to call: In PHP
  28523.     terms, the toplevel directory would be the global namespace, and the
  28524.     pathname separator would be <TT
  28525. CLASS="literal"
  28526. >-></TT
  28527. >.  Thus, the names
  28528.     <TT
  28529. CLASS="varname"
  28530. >$cart->items</TT
  28531. > and
  28532.     <TT
  28533. CLASS="varname"
  28534. >$another_cart->items</TT
  28535. > name two different variables.
  28536.     Note that the variable is named <TT
  28537. CLASS="varname"
  28538. >$cart->items</TT
  28539. >, not
  28540.     <TT
  28541. CLASS="varname"
  28542. >$cart->$items</TT
  28543. >, that is, a variable name in PHP has
  28544.     only a single dollar sign.
  28545.    </P
  28546. ><DIV
  28547. CLASS="informalexample"
  28548. ><A
  28549. NAME="AEN5414"
  28550. ></A
  28551. ><P
  28552. ></P
  28553. ><TABLE
  28554. BORDER="0"
  28555. BGCOLOR="#E0E0E0"
  28556. CELLPADDING="5"
  28557. ><TR
  28558. ><TD
  28559. ><PRE
  28560. CLASS="php"
  28561. ><?php
  28562. // correct, single $
  28563. $cart->items = array("10" => 1); 
  28564.  
  28565. // invalid, because $cart->$items becomes $cart->""
  28566. $cart->$items = array("10" => 1);
  28567.  
  28568. // correct, but may or may not be what was intended:
  28569. // $cart->$myvar becomes $cart->items
  28570. $myvar = 'items';
  28571. $cart->$myvar = array("10" => 1);  
  28572. ?></PRE
  28573. ></TD
  28574. ></TR
  28575. ></TABLE
  28576. ><P
  28577. ></P
  28578. ></DIV
  28579. ><P
  28580. >     Within a class definition, you do not know under which name the object
  28581.     will be accessible in your program: at the time the Cart class was
  28582.     written, it was unknown that the object will be named
  28583.     <TT
  28584. CLASS="varname"
  28585. >$cart</TT
  28586. > or <TT
  28587. CLASS="varname"
  28588. >$another_cart</TT
  28589. > later. Thus,
  28590.     you cannot write <TT
  28591. CLASS="varname"
  28592. >$cart->items</TT
  28593. > within the Cart class
  28594.     itself. Instead, in order to be able to access it's own functions and
  28595.     variables from within a class, one can use the pseudo-variable
  28596.     <TT
  28597. CLASS="varname"
  28598. >$this</TT
  28599. > which can be read as 'my own' or 'current
  28600.     object'. Thus, '<TT
  28601. CLASS="varname"
  28602. >$this->items[$artnr]</TT
  28603. > +=
  28604.     <TT
  28605. CLASS="varname"
  28606. >$num</TT
  28607. >' can be read as 'add <TT
  28608. CLASS="varname"
  28609. >$num</TT
  28610. > to
  28611.     the <TT
  28612. CLASS="varname"
  28613. >$artnr</TT
  28614. > counter of my own items array' or 'add
  28615.     <TT
  28616. CLASS="varname"
  28617. >$num</TT
  28618. > to the <TT
  28619. CLASS="varname"
  28620. >$artnr</TT
  28621. > counter of the
  28622.     items array within the current object'.
  28623.    </P
  28624. ><DIV
  28625. CLASS="note"
  28626. ><BLOCKQUOTE
  28627. CLASS="note"
  28628. ><P
  28629. ><B
  28630. >Poznßmka: </B
  28631. >
  28632.     There are some nice functions to handle classes and objects. You might want
  28633.     to take a look at the <A
  28634. HREF="#ref.classobj"
  28635. >Class/Object
  28636.     Functions</A
  28637. >
  28638.     </P
  28639. ></BLOCKQUOTE
  28640. ></DIV
  28641. ></DIV
  28642. ><DIV
  28643. CLASS="sect1"
  28644. ><HR><H2
  28645. CLASS="sect1"
  28646. ><A
  28647. NAME="keyword.extends"
  28648. ></A
  28649. ><TT
  28650. CLASS="literal"
  28651. >extends</TT
  28652. ></H2
  28653. ><P
  28654. >     Often you need classes with similar variables and functions
  28655.     to another existing class. In fact, it is good practice to
  28656.     define a generic class which can be used in all your
  28657.     projects and adapt this class for the needs of each of your
  28658.     specific projects. To facilitate this, classes can be
  28659.     extensions of other classes.  The extended or derived class
  28660.     has all variables and functions of the base class (this is
  28661.     called 'inheritance' despite the fact that nobody died) and what
  28662.     you add in the extended definition. It is not possible to
  28663.     substract from a class, that is, to undefine any existing 
  28664.     functions or variables. An extended class is always dependent
  28665.     on a single base class, that is, multiple inheritance is
  28666.     not supported. Classes are extended using the keyword 'extends'.
  28667.    </P
  28668. ><DIV
  28669. CLASS="informalexample"
  28670. ><A
  28671. NAME="AEN5434"
  28672. ></A
  28673. ><P
  28674. ></P
  28675. ><TABLE
  28676. BORDER="0"
  28677. BGCOLOR="#E0E0E0"
  28678. CELLPADDING="5"
  28679. ><TR
  28680. ><TD
  28681. ><PRE
  28682. CLASS="php"
  28683. ><?php
  28684. class Named_Cart extends Cart
  28685. {
  28686.     var $owner;
  28687.   
  28688.     function set_owner ($name)
  28689.     {
  28690.         $this->owner = $name;
  28691.     }
  28692. }
  28693. ?></PRE
  28694. ></TD
  28695. ></TR
  28696. ></TABLE
  28697. ><P
  28698. ></P
  28699. ></DIV
  28700. ><P
  28701. >     This defines a class Named_Cart that has all variables and functions of
  28702.     Cart plus an additional variable <TT
  28703. CLASS="varname"
  28704. >$owner</TT
  28705. > and an
  28706.     additional function set_owner(). You create a named cart the usual way and
  28707.     can now set and get the carts owner. You can still use normal cart
  28708.     functions on named carts:
  28709.    </P
  28710. ><DIV
  28711. CLASS="informalexample"
  28712. ><A
  28713. NAME="AEN5438"
  28714. ></A
  28715. ><P
  28716. ></P
  28717. ><TABLE
  28718. BORDER="0"
  28719. BGCOLOR="#E0E0E0"
  28720. CELLPADDING="5"
  28721. ><TR
  28722. ><TD
  28723. ><PRE
  28724. CLASS="php"
  28725. ><?php
  28726. $ncart = new Named_Cart;    // Create a named cart
  28727. $ncart->set_owner("kris");  // Name that cart
  28728. print $ncart->owner;        // print the cart owners name
  28729. $ncart->add_item("10", 1);  // (inherited functionality from cart)
  28730. ?></PRE
  28731. ></TD
  28732. ></TR
  28733. ></TABLE
  28734. ><P
  28735. ></P
  28736. ></DIV
  28737. ><P
  28738. >     This is also called a "parent-child" relationship. You create a class,
  28739.     parent, and use <TT
  28740. CLASS="literal"
  28741. >extends</TT
  28742. > to create a new class
  28743.     <SPAN
  28744. CLASS="emphasis"
  28745. ><I
  28746. CLASS="emphasis"
  28747. >based</I
  28748. ></SPAN
  28749. > on the parent class: the child class. You can
  28750.     even use this new child class and create another class based on this child
  28751.     class.
  28752.    </P
  28753. ><DIV
  28754. CLASS="note"
  28755. ><BLOCKQUOTE
  28756. CLASS="note"
  28757. ><P
  28758. ><B
  28759. >Poznßmka: </B
  28760. >
  28761.      Classes must be defined before they are used! If you want the class
  28762.      <TT
  28763. CLASS="literal"
  28764. >Named_Cart</TT
  28765. > to extend the class
  28766.      <TT
  28767. CLASS="literal"
  28768. >Cart</TT
  28769. >, you will have to define the class
  28770.      <TT
  28771. CLASS="literal"
  28772. >Cart</TT
  28773. > first. If you want to create another class called
  28774.      <TT
  28775. CLASS="literal"
  28776. >Yellow_named_cart</TT
  28777. > based on the class
  28778.      <TT
  28779. CLASS="literal"
  28780. >Named_Cart</TT
  28781. > you have to define
  28782.      <TT
  28783. CLASS="literal"
  28784. >Named_Cart</TT
  28785. > first. To make it short: the order in which
  28786.      the classes are defined is important.
  28787.     </P
  28788. ></BLOCKQUOTE
  28789. ></DIV
  28790. ></DIV
  28791. ><DIV
  28792. CLASS="sect1"
  28793. ><HR><H2
  28794. CLASS="sect1"
  28795. ><A
  28796. NAME="language.oop.constructor"
  28797. ></A
  28798. ><TT
  28799. CLASS="literal"
  28800. >Constructors</TT
  28801. ></H2
  28802. ><DIV
  28803. CLASS="caution"
  28804. ><P
  28805. ></P
  28806. ><TABLE
  28807. CLASS="caution"
  28808. BORDER="1"
  28809. WIDTH="100%"
  28810. ><TR
  28811. ><TD
  28812. ALIGN="CENTER"
  28813. ><B
  28814. >V²straha</B
  28815. ></TD
  28816. ></TR
  28817. ><TR
  28818. ><TD
  28819. ALIGN="LEFT"
  28820. ><P
  28821. >      In PHP 3 and PHP 4 constructors behave differently. The PHP 4
  28822.      semantics are strongly preferred.
  28823.     </P
  28824. ></TD
  28825. ></TR
  28826. ></TABLE
  28827. ></DIV
  28828. ><P
  28829. >     Constructors are functions in a class that are automatically
  28830.     called when you create a new instance of a class with
  28831.     <TT
  28832. CLASS="literal"
  28833. >new</TT
  28834. >. In PHP 3, a
  28835.     function becomes a constructor when it has the same name as 
  28836.     the class. In PHP 4, a function becomes a constructor, when
  28837.     it has the same name as the class it is defined in - the
  28838.     difference is subtle, but crucial (see below).
  28839.    </P
  28840. ><DIV
  28841. CLASS="informalexample"
  28842. ><A
  28843. NAME="AEN5458"
  28844. ></A
  28845. ><P
  28846. ></P
  28847. ><TABLE
  28848. BORDER="0"
  28849. BGCOLOR="#E0E0E0"
  28850. CELLPADDING="5"
  28851. ><TR
  28852. ><TD
  28853. ><PRE
  28854. CLASS="php"
  28855. ><?php
  28856. // Works in PHP 3 and PHP 4.
  28857. class Auto_Cart extends Cart
  28858. {
  28859.     function Auto_Cart()
  28860.     {
  28861.         $this->add_item ("10", 1);
  28862.     }
  28863. }
  28864. ?></PRE
  28865. ></TD
  28866. ></TR
  28867. ></TABLE
  28868. ><P
  28869. ></P
  28870. ></DIV
  28871. ><P
  28872. >     This defines a class Auto_Cart that is a Cart plus a constructor
  28873.     which initializes the cart with one item of article number "10"
  28874.     each time a new Auto_Cart is being made with "new". Constructors
  28875.     can take arguments and these arguments can be optional, which
  28876.     makes them much more useful. To be able to still use the class
  28877.     without parameters, all parameters to constructors should be
  28878.     made optional by providing default values.
  28879.    </P
  28880. ><DIV
  28881. CLASS="informalexample"
  28882. ><A
  28883. NAME="AEN5461"
  28884. ></A
  28885. ><P
  28886. ></P
  28887. ><TABLE
  28888. BORDER="0"
  28889. BGCOLOR="#E0E0E0"
  28890. CELLPADDING="5"
  28891. ><TR
  28892. ><TD
  28893. ><PRE
  28894. CLASS="php"
  28895. ><?php
  28896. // Works in PHP 3 and PHP 4.
  28897. class Constructor_Cart extends Cart
  28898. {
  28899.     function Constructor_Cart($item = "10", $num = 1)
  28900.     {
  28901.         $this->add_item ($item, $num);
  28902.     }
  28903. }
  28904.  
  28905. // Shop the same old boring stuff.
  28906.  
  28907. $default_cart = new Constructor_Cart;
  28908.  
  28909. // Shop for real...
  28910.  
  28911. $different_cart = new Constructor_Cart("20", 17);
  28912. ?></PRE
  28913. ></TD
  28914. ></TR
  28915. ></TABLE
  28916. ><P
  28917. ></P
  28918. ></DIV
  28919. ><P
  28920. >     You also can use the <TT
  28921. CLASS="literal"
  28922. >@</TT
  28923. > operator to
  28924.     <SPAN
  28925. CLASS="emphasis"
  28926. ><I
  28927. CLASS="emphasis"
  28928. >mute</I
  28929. ></SPAN
  28930. > errors occurring in the constructor, e.g.
  28931.     <TT
  28932. CLASS="literal"
  28933. >@new</TT
  28934. >.
  28935.    </P
  28936. ><DIV
  28937. CLASS="caution"
  28938. ><P
  28939. ></P
  28940. ><TABLE
  28941. CLASS="caution"
  28942. BORDER="1"
  28943. WIDTH="100%"
  28944. ><TR
  28945. ><TD
  28946. ALIGN="CENTER"
  28947. ><B
  28948. >V²straha</B
  28949. ></TD
  28950. ></TR
  28951. ><TR
  28952. ><TD
  28953. ALIGN="LEFT"
  28954. ><P
  28955. >      In PHP 3, derived classes and constructors have a number of
  28956.      limitations. The following examples should be read carefully
  28957.      to understand these limitations.
  28958.     </P
  28959. ></TD
  28960. ></TR
  28961. ></TABLE
  28962. ></DIV
  28963. ><DIV
  28964. CLASS="informalexample"
  28965. ><A
  28966. NAME="AEN5469"
  28967. ></A
  28968. ><P
  28969. ></P
  28970. ><TABLE
  28971. BORDER="0"
  28972. BGCOLOR="#E0E0E0"
  28973. CELLPADDING="5"
  28974. ><TR
  28975. ><TD
  28976. ><PRE
  28977. CLASS="php"
  28978. ><?php
  28979. class A
  28980. {
  28981.     function A()
  28982.     {
  28983.       echo "I am the constructor of A.<br>\n";
  28984.     }
  28985. }
  28986.  
  28987. class B extends A
  28988. {
  28989.     function C()
  28990.     {
  28991.         echo "I am a regular function.<br>\n";
  28992.     }
  28993. }
  28994.  
  28995. // no constructor is being called in PHP 3.
  28996. $b = new B;
  28997. ?></PRE
  28998. ></TD
  28999. ></TR
  29000. ></TABLE
  29001. ><P
  29002. ></P
  29003. ></DIV
  29004. ><P
  29005. >     In PHP 3, no constructor is being called in the above example.
  29006.     The rule in PHP 3 is: 'A constructor is a function of the same
  29007.     name as the class.'. The name of the class is B, and there is
  29008.     no function called B() in class B. Nothing happens.
  29009.    </P
  29010. ><P
  29011. >     This is fixed in PHP 4 by introducing another rule: If a class
  29012.     has no constructor, the constructor of the base class is being
  29013.     called, if it exists. The above example would have printed
  29014.     'I am the constructor of A.<br>' in PHP 4.
  29015.    </P
  29016. ><DIV
  29017. CLASS="informalexample"
  29018. ><A
  29019. NAME="AEN5473"
  29020. ></A
  29021. ><P
  29022. ></P
  29023. ><TABLE
  29024. BORDER="0"
  29025. BGCOLOR="#E0E0E0"
  29026. CELLPADDING="5"
  29027. ><TR
  29028. ><TD
  29029. ><PRE
  29030. CLASS="php"
  29031. ><?php
  29032. class A
  29033. {
  29034.     function A()
  29035.     {
  29036.         echo "I am the constructor of A.<br>\n";
  29037.     }
  29038.  
  29039.     function B()
  29040.     {
  29041.         echo "I am a regular function named B in class A.<br>\n";
  29042.         echo "I am not a constructor in A.<br>\n";
  29043.     }
  29044. }
  29045.  
  29046. class B extends A
  29047. {
  29048.     function C()
  29049.     {
  29050.         echo "I am a regular function.<br>\n";
  29051.     }
  29052. }
  29053.  
  29054. // This will call B() as a constructor.
  29055. $b = new B;
  29056. ?></PRE
  29057. ></TD
  29058. ></TR
  29059. ></TABLE
  29060. ><P
  29061. ></P
  29062. ></DIV
  29063. ><P
  29064. >     In PHP 3, the function B() in class A will suddenly become a
  29065.     constructor in class B, although it was never intended to be.
  29066.     The rule in PHP 3 is: 'A constructor is a function of the same
  29067.     name as the class.'. PHP 3 does not care if the function is
  29068.     being defined in class B, or if it has been inherited.
  29069.    </P
  29070. ><P
  29071. >     This is fixed in PHP 4 by modifying the rule to: 'A constructor
  29072.     is a function of the same name as the class it is being defined
  29073.     in.'. Thus in PHP 4, the class B would have no constructor function
  29074.     of its own and the constructor of the base class would have been
  29075.     called, printing 'I am the constructor of A.<br>'.
  29076.    </P
  29077. ><DIV
  29078. CLASS="caution"
  29079. ><P
  29080. ></P
  29081. ><TABLE
  29082. CLASS="caution"
  29083. BORDER="1"
  29084. WIDTH="100%"
  29085. ><TR
  29086. ><TD
  29087. ALIGN="CENTER"
  29088. ><B
  29089. >V²straha</B
  29090. ></TD
  29091. ></TR
  29092. ><TR
  29093. ><TD
  29094. ALIGN="LEFT"
  29095. ><P
  29096. >      Neither PHP 3 nor PHP 4 call constructors of the base class 
  29097.      automatically from a constructor of a derived class. It is
  29098.      your responsibility to propagate the call to constructors
  29099.      upstream where appropriate.
  29100.     </P
  29101. ></TD
  29102. ></TR
  29103. ></TABLE
  29104. ></DIV
  29105. ><DIV
  29106. CLASS="note"
  29107. ><BLOCKQUOTE
  29108. CLASS="note"
  29109. ><P
  29110. ><B
  29111. >Poznßmka: </B
  29112. >
  29113.      There are no destructors in PHP 3 or PHP 4. You may use
  29114.      <A
  29115. HREF="#function.register-shutdown-function"
  29116. ><B
  29117. CLASS="function"
  29118. >register_shutdown_function()</B
  29119. ></A
  29120. > instead
  29121.      to simulate most effects of destructors.
  29122.     </P
  29123. ></BLOCKQUOTE
  29124. ></DIV
  29125. ><P
  29126. >     Destructors are functions that are called automatically
  29127.     when an object is destroyed, either with <A
  29128. HREF="#function.unset"
  29129. ><B
  29130. CLASS="function"
  29131. >unset()</B
  29132. ></A
  29133. >
  29134.     or by simply going out of scope. There are no destructors
  29135.     in PHP.
  29136.    </P
  29137. ></DIV
  29138. ><DIV
  29139. CLASS="sect1"
  29140. ><HR><H2
  29141. CLASS="sect1"
  29142. ><A
  29143. NAME="keyword.paamayim-nekudotayim"
  29144. ></A
  29145. ><TT
  29146. CLASS="literal"
  29147. >::</TT
  29148. ></H2
  29149. ><DIV
  29150. CLASS="caution"
  29151. ><P
  29152. ></P
  29153. ><TABLE
  29154. CLASS="caution"
  29155. BORDER="1"
  29156. WIDTH="100%"
  29157. ><TR
  29158. ><TD
  29159. ALIGN="CENTER"
  29160. ><B
  29161. >V²straha</B
  29162. ></TD
  29163. ></TR
  29164. ><TR
  29165. ><TD
  29166. ALIGN="LEFT"
  29167. ><P
  29168. >      The following is valid for PHP 4 and later only.
  29169.     </P
  29170. ></TD
  29171. ></TR
  29172. ></TABLE
  29173. ></DIV
  29174. ><P
  29175. >     Sometimes it is useful to refer to functions and variables
  29176.     in base classes or to refer to functions in classes that
  29177.     have not yet any instances. The :: operator is being used
  29178.     for this.
  29179.    </P
  29180. ><DIV
  29181. CLASS="informalexample"
  29182. ><A
  29183. NAME="AEN5490"
  29184. ></A
  29185. ><P
  29186. ></P
  29187. ><TABLE
  29188. BORDER="0"
  29189. BGCOLOR="#E0E0E0"
  29190. CELLPADDING="5"
  29191. ><TR
  29192. ><TD
  29193. ><PRE
  29194. CLASS="php"
  29195. ><?php
  29196. class A
  29197. {
  29198.     function example()
  29199.     {
  29200.         echo "I am the original function A::example().<br>\n";
  29201.     }
  29202. }
  29203.  
  29204. class B extends A
  29205. {
  29206.     function example()
  29207.     {
  29208.         echo "I am the redefined function B::example().<br>\n";
  29209.         A::example();
  29210.     }
  29211. }
  29212.  
  29213. // there is no object of class A.
  29214. // this will print
  29215. //   I am the original function A::example().<br>
  29216. A::example();
  29217.  
  29218. // create an object of class B.
  29219. $b = new B;
  29220.  
  29221. // this will print 
  29222. //   I am the redefined function B::example().<br>
  29223. //   I am the original function A::example().<br>
  29224. $b->example();
  29225. ?></PRE
  29226. ></TD
  29227. ></TR
  29228. ></TABLE
  29229. ><P
  29230. ></P
  29231. ></DIV
  29232. ><P
  29233. >     The above example calls the function example() in
  29234.     class A, but there is no object of class A, so that
  29235.     we cannot write $a->example() or similar. Instead we
  29236.     call example() as a 'class function', that is, as a
  29237.     function of the class itself, not any object of that
  29238.     class.
  29239.    </P
  29240. ><P
  29241. >     There are class functions, but there are no class variables.
  29242.     In fact, there is no object at all at the time of the call.
  29243.     Thus, a class function may not use any object variables (but
  29244.     it can use local and global variables), and it may no use
  29245.     <TT
  29246. CLASS="varname"
  29247. >$this</TT
  29248. > at all.
  29249.    </P
  29250. ><P
  29251. >     In the above example, class B redefines the function example(). 
  29252.     The original definition in class A is shadowed
  29253.     and no longer available, unless you are referring specifically
  29254.     to the implementation of example() in class A using the 
  29255.     ::-operator. Write A::example() to do this (in fact, you
  29256.     should be writing parent::example(), as shown in the next
  29257.     section).
  29258.    </P
  29259. ><P
  29260. >     In this context, there is a current object and it may have object
  29261.     variables. Thus, when used from WITHIN an object function, you may use
  29262.     <TT
  29263. CLASS="varname"
  29264. >$this</TT
  29265. > and object variables.
  29266.    </P
  29267. ></DIV
  29268. ><DIV
  29269. CLASS="sect1"
  29270. ><HR><H2
  29271. CLASS="sect1"
  29272. ><A
  29273. NAME="keyword.parent"
  29274. ></A
  29275. ><TT
  29276. CLASS="literal"
  29277. >parent</TT
  29278. ></H2
  29279. ><P
  29280. >    You may find yourself writing code that refers to
  29281.    variables and functions in base classes. This is
  29282.    particularly true if your derived class is a refinement
  29283.    or specialisation of code in your base class. 
  29284.   </P
  29285. ><P
  29286. >    Instead of using the literal name of the base class in your
  29287.    code, you should be using the special name
  29288.    <TT
  29289. CLASS="literal"
  29290. >parent</TT
  29291. >, which refers to the name of your
  29292.    base class as given in the <TT
  29293. CLASS="literal"
  29294. >extends</TT
  29295. >
  29296.    declaration of your class. By doing this, you avoid using the
  29297.    name of your base class in more than one place. Should
  29298.    your inheritance tree change during implementation, the
  29299.    change is easily made by simply changing the 
  29300.    <TT
  29301. CLASS="literal"
  29302. >extends</TT
  29303. > declaration of your class.
  29304.   </P
  29305. ><DIV
  29306. CLASS="informalexample"
  29307. ><A
  29308. NAME="AEN5506"
  29309. ></A
  29310. ><P
  29311. ></P
  29312. ><TABLE
  29313. BORDER="0"
  29314. BGCOLOR="#E0E0E0"
  29315. CELLPADDING="5"
  29316. ><TR
  29317. ><TD
  29318. ><PRE
  29319. CLASS="php"
  29320. ><?php
  29321. class A
  29322. {
  29323.     function example()
  29324.     {
  29325.         echo "I am A::example() and provide basic functionality.<br>\n";
  29326.     }
  29327. }
  29328.  
  29329. class B extends A
  29330. {
  29331.     function example()
  29332.     {
  29333.         echo "I am B::example() and provide additional functionality.<br>\n";
  29334.         parent::example();
  29335.     }
  29336. }
  29337.  
  29338. $b = new B;
  29339.  
  29340. // This will call B::example(), which will in turn call A::example().
  29341. $b->example();
  29342. ?></PRE
  29343. ></TD
  29344. ></TR
  29345. ></TABLE
  29346. ><P
  29347. ></P
  29348. ></DIV
  29349. ></DIV
  29350. ><DIV
  29351. CLASS="sect1"
  29352. ><HR><H2
  29353. CLASS="sect1"
  29354. ><A
  29355. NAME="language.oop.serialization"
  29356. ></A
  29357. >Serializing objects - objects in sessions</H2
  29358. ><DIV
  29359. CLASS="note"
  29360. ><BLOCKQUOTE
  29361. CLASS="note"
  29362. ><P
  29363. ><B
  29364. >Poznßmka: </B
  29365. >
  29366.     In PHP 3, objects will lose their class association
  29367.     throughout the process of serialization and unserialization. 
  29368.     The resulting variable is of type object, but has no class
  29369.     and no methods, thus it is pretty useless (it has become
  29370.     just like an array with a funny syntax).
  29371.    </P
  29372. ></BLOCKQUOTE
  29373. ></DIV
  29374. ><DIV
  29375. CLASS="caution"
  29376. ><P
  29377. ></P
  29378. ><TABLE
  29379. CLASS="caution"
  29380. BORDER="1"
  29381. WIDTH="100%"
  29382. ><TR
  29383. ><TD
  29384. ALIGN="CENTER"
  29385. ><B
  29386. >V²straha</B
  29387. ></TD
  29388. ></TR
  29389. ><TR
  29390. ><TD
  29391. ALIGN="LEFT"
  29392. ><P
  29393. >     The following information is valid for PHP 4 only. 
  29394.    </P
  29395. ></TD
  29396. ></TR
  29397. ></TABLE
  29398. ></DIV
  29399. ><P
  29400. >    <A
  29401. HREF="#function.serialize"
  29402. ><B
  29403. CLASS="function"
  29404. >serialize()</B
  29405. ></A
  29406. > returns a string containing a
  29407.    byte-stream representation of any value that can be stored in
  29408.    PHP. <A
  29409. HREF="#function.unserialize"
  29410. ><B
  29411. CLASS="function"
  29412. >unserialize()</B
  29413. ></A
  29414. > can use this string to
  29415.    recreate the original variable values. Using serialize to
  29416.    save an object will save all variables in an object.  The
  29417.    functions in an object will not be saved, only the name of
  29418.    the class.
  29419.   </P
  29420. ><P
  29421. >    In order to be able to <A
  29422. HREF="#function.unserialize"
  29423. ><B
  29424. CLASS="function"
  29425. >unserialize()</B
  29426. ></A
  29427. > an object, the
  29428.    class of that object needs to be defined. That is, if you have an object
  29429.    <TT
  29430. CLASS="varname"
  29431. >$a</TT
  29432. > of class A on page1.php and serialize this, you'll
  29433.    get a string that refers to class A and contains all values of variabled
  29434.    contained in <TT
  29435. CLASS="varname"
  29436. >$a</TT
  29437. >. If you want to be able to unserialize
  29438.    this on page2.php, recreating <TT
  29439. CLASS="varname"
  29440. >$a</TT
  29441. > of class A, the
  29442.    definition of class A must be present in page2.php. This can be done for
  29443.    example by storing the class definition of class A in an include file and
  29444.    including this file in both page1.php and page2.php.
  29445.   </P
  29446. ><DIV
  29447. CLASS="informalexample"
  29448. ><A
  29449. NAME="AEN5522"
  29450. ></A
  29451. ><P
  29452. ></P
  29453. ><TABLE
  29454. BORDER="0"
  29455. BGCOLOR="#E0E0E0"
  29456. CELLPADDING="5"
  29457. ><TR
  29458. ><TD
  29459. ><PRE
  29460. CLASS="php"
  29461. ><?php
  29462. // classa.inc:
  29463.   
  29464.   class A 
  29465.   {
  29466.       var $one = 1;
  29467.     
  29468.       function show_one()
  29469.       {
  29470.           echo $this->one;
  29471.       }
  29472.   }
  29473.   
  29474. // page1.php:
  29475.  
  29476.   include("classa.inc");
  29477.   
  29478.   $a = new A;
  29479.   $s = serialize($a);
  29480.   // store $s somewhere where page2.php can find it.
  29481.   $fp = fopen("store", "w");
  29482.   fputs($fp, $s);
  29483.   fclose($fp);
  29484.  
  29485. // page2.php:
  29486.   
  29487.   // this is needed for the unserialize to work properly.
  29488.   include("classa.inc");
  29489.  
  29490.   $s = implode("", @file("store"));
  29491.   $a = unserialize($s);
  29492.  
  29493.   // now use the function show_one() of the $a object.  
  29494.   $a->show_one();
  29495. ?></PRE
  29496. ></TD
  29497. ></TR
  29498. ></TABLE
  29499. ><P
  29500. ></P
  29501. ></DIV
  29502. ><P
  29503. >    If you are using sessions and use <A
  29504. HREF="#function.session-register"
  29505. ><B
  29506. CLASS="function"
  29507. >session_register()</B
  29508. ></A
  29509. >
  29510.    to register objects, these objects are serialized automatically
  29511.    at the end of each PHP page, and are unserialized automatically on
  29512.    each of the following pages. This basically means that these objects
  29513.    can show up on any of your pages once they become part of your
  29514.    session.
  29515.   </P
  29516. ><P
  29517. >    It is strongly recommended that you include the class
  29518.    definitions of all such registered objects on all of your
  29519.    pages, even if you do not actually use these classes on all
  29520.    of your pages. If you don't and an object is being
  29521.    unserialized without its class definition being present, it
  29522.    will lose its class association and become an object of class
  29523.    <TT
  29524. CLASS="literal"
  29525. >stdClass</TT
  29526. > without any functions available
  29527.    at all, that is, it will become quite useless.
  29528.   </P
  29529. ><P
  29530. >    So if in the example above <TT
  29531. CLASS="varname"
  29532. >$a</TT
  29533. > became part of a session
  29534.    by running <TT
  29535. CLASS="literal"
  29536. >session_register("a")</TT
  29537. >, you should include the
  29538.    file <TT
  29539. CLASS="literal"
  29540. >classa.inc</TT
  29541. > on all of your pages, not only page1.php
  29542.    and page2.php.
  29543.   </P
  29544. ></DIV
  29545. ><DIV
  29546. CLASS="sect1"
  29547. ><HR><H2
  29548. CLASS="sect1"
  29549. ><A
  29550. NAME="language.oop.magic-functions"
  29551. ></A
  29552. >The magic functions <TT
  29553. CLASS="literal"
  29554. >__sleep</TT
  29555. > and <TT
  29556. CLASS="literal"
  29557. >__wakeup</TT
  29558. ></H2
  29559. ><P
  29560. >    <A
  29561. HREF="#function.serialize"
  29562. ><B
  29563. CLASS="function"
  29564. >serialize()</B
  29565. ></A
  29566. > checks if your class has a function with
  29567.    the magic name <TT
  29568. CLASS="literal"
  29569. >__sleep</TT
  29570. >. If so, that function is
  29571.    being run prior to any serialization. It can clean up the object
  29572.    and is supposed to return an array with the names of all variables
  29573.    of that object that should be serialized.
  29574.   </P
  29575. ><P
  29576. >    The intended use of <TT
  29577. CLASS="literal"
  29578. >__sleep</TT
  29579. > is to close any
  29580.    database connections that object may have, committing pending
  29581.    data or perform similar cleanup tasks. Also, the function is
  29582.    useful if you have very large objects which need not be
  29583.    saved completely.
  29584.   </P
  29585. ><P
  29586. >    Conversely, <A
  29587. HREF="#function.unserialize"
  29588. ><B
  29589. CLASS="function"
  29590. >unserialize()</B
  29591. ></A
  29592. > checks for the
  29593.    presence of a function with the magic name 
  29594.    <TT
  29595. CLASS="literal"
  29596. >__wakeup</TT
  29597. >. If present, this function can
  29598.    reconstruct any resources that object may have.
  29599.   </P
  29600. ><P
  29601. >     The intended use of <TT
  29602. CLASS="literal"
  29603. >__wakeup</TT
  29604. > is to
  29605.     reestablish any database connections that may have been lost
  29606.     during serialization and perform other reinitialization
  29607.     tasks.
  29608.   </P
  29609. ></DIV
  29610. ><DIV
  29611. CLASS="sect1"
  29612. ><HR><H2
  29613. CLASS="sect1"
  29614. ><A
  29615. NAME="language.oop.newref"
  29616. ></A
  29617. >References inside the constructor</H2
  29618. ><P
  29619. >     Creating references within the constructor can lead to confusing
  29620.     results. This tutorial-like section helps you to avoid problems.
  29621.  
  29622.     <DIV
  29623. CLASS="informalexample"
  29624. ><A
  29625. NAME="AEN5549"
  29626. ></A
  29627. ><P
  29628. ></P
  29629. ><TABLE
  29630. BORDER="0"
  29631. BGCOLOR="#E0E0E0"
  29632. CELLPADDING="5"
  29633. ><TR
  29634. ><TD
  29635. ><PRE
  29636. CLASS="php"
  29637. ><?php
  29638. class Foo
  29639. {
  29640.     function Foo($name)
  29641.     {
  29642.         // create a reference inside the global array $globalref
  29643.         global $globalref;
  29644.         $globalref[] = &$this;
  29645.         // set name to passed value
  29646.         $this->setName($name);
  29647.         // and put it out
  29648.         $this->echoName();
  29649.     }
  29650.  
  29651.     function echoName()
  29652.     {
  29653.         echo "<br>",$this->name;
  29654.     }
  29655.  
  29656.     function setName($name)
  29657.     {
  29658.         $this->name = $name;
  29659.     }
  29660. }
  29661. ?></PRE
  29662. ></TD
  29663. ></TR
  29664. ></TABLE
  29665. ><P
  29666. ></P
  29667. ></DIV
  29668. >
  29669.   </P
  29670. ><P
  29671. >     Let us check out if there is a difference between
  29672.     <TT
  29673. CLASS="varname"
  29674. >$bar1</TT
  29675. > which has been created using
  29676.     the copy <TT
  29677. CLASS="literal"
  29678. >=</TT
  29679. > operator and
  29680.     <TT
  29681. CLASS="varname"
  29682. >$bar2</TT
  29683. > which has been created using
  29684.     the reference <TT
  29685. CLASS="literal"
  29686. >=&</TT
  29687. > operator...
  29688.  
  29689.     <DIV
  29690. CLASS="informalexample"
  29691. ><A
  29692. NAME="AEN5556"
  29693. ></A
  29694. ><P
  29695. ></P
  29696. ><TABLE
  29697. BORDER="0"
  29698. BGCOLOR="#E0E0E0"
  29699. CELLPADDING="5"
  29700. ><TR
  29701. ><TD
  29702. ><PRE
  29703. CLASS="php"
  29704. ><?php
  29705. $bar1 = new Foo('set in constructor');
  29706. $bar1->echoName();
  29707. $globalref[0]->echoName();
  29708.  
  29709. /* output:
  29710. set in constructor
  29711. set in constructor
  29712. set in constructor */
  29713.  
  29714. $bar2 =& new Foo('set in constructor');
  29715. $bar2->echoName();
  29716. $globalref[1]->echoName();
  29717.  
  29718. /* output:
  29719. set in constructor
  29720. set in constructor
  29721. set in constructor */
  29722. ?></PRE
  29723. ></TD
  29724. ></TR
  29725. ></TABLE
  29726. ><P
  29727. ></P
  29728. ></DIV
  29729. >
  29730.    </P
  29731. ><P
  29732. >     Apparently there is no difference, but in fact there is a
  29733.     very significant one: <TT
  29734. CLASS="varname"
  29735. >$bar1</TT
  29736. > and
  29737.     <TT
  29738. CLASS="varname"
  29739. >$globalref[0]</TT
  29740. > are _NOT_ referenced, they
  29741.     are NOT the same variable. This is because "new" does not
  29742.     return a reference by default, instead it returns a copy.
  29743.     <DIV
  29744. CLASS="note"
  29745. ><BLOCKQUOTE
  29746. CLASS="note"
  29747. ><P
  29748. ><B
  29749. >Poznßmka: </B
  29750. >
  29751.       There is no performance loss (since PHP 4 and up use reference
  29752.       counting) returning copies instead of references. On the
  29753.       contrary it is most often better to simply work with copies
  29754.       instead of references, because creating references takes some
  29755.       time where creating copies virtually takes no time (unless none
  29756.       of them is a large array or object and one of them gets changed
  29757.       and the other(s) one(s) subsequently, then it would be wise to
  29758.       use references to change them all concurrently).
  29759.      </P
  29760. ></BLOCKQUOTE
  29761. ></DIV
  29762. >
  29763.     To prove what is written above let us watch the code below.
  29764.  
  29765.     <DIV
  29766. CLASS="informalexample"
  29767. ><A
  29768. NAME="AEN5563"
  29769. ></A
  29770. ><P
  29771. ></P
  29772. ><TABLE
  29773. BORDER="0"
  29774. BGCOLOR="#E0E0E0"
  29775. CELLPADDING="5"
  29776. ><TR
  29777. ><TD
  29778. ><PRE
  29779. CLASS="php"
  29780. ><?php
  29781. // now we will change the name. what do you expect?
  29782. // you could expect that both $bar1 and $globalref[0] change their names...
  29783. $bar1->setName('set from outside');
  29784.  
  29785. // as mentioned before this is not the case.
  29786. $bar1->echoName();
  29787. $globalref[0]->echoName();
  29788.  
  29789. /* output:
  29790. set from outside
  29791. set in constructor */
  29792.  
  29793. // let us see what is different with $bar2 and $globalref[1]
  29794. $bar2->setName('set from outside');
  29795.  
  29796. // luckily they are not only equal, they are the same variable
  29797. // thus $bar2->name and $globalref[1]->name are the same too
  29798. $bar2->echoName();
  29799. $globalref[1]->echoName();
  29800.  
  29801. /* output:
  29802. set from outside
  29803. set from outside */
  29804. ?></PRE
  29805. ></TD
  29806. ></TR
  29807. ></TABLE
  29808. ><P
  29809. ></P
  29810. ></DIV
  29811. >   
  29812.    </P
  29813. ><P
  29814. >    Another final example, try to understand it.
  29815.    
  29816.     <DIV
  29817. CLASS="informalexample"
  29818. ><A
  29819. NAME="AEN5566"
  29820. ></A
  29821. ><P
  29822. ></P
  29823. ><TABLE
  29824. BORDER="0"
  29825. BGCOLOR="#E0E0E0"
  29826. CELLPADDING="5"
  29827. ><TR
  29828. ><TD
  29829. ><PRE
  29830. CLASS="php"
  29831. ><?php
  29832. class A
  29833. {
  29834.     function A($i)
  29835.     {
  29836.         $this->value = $i;
  29837.         // try to figure out why we do not need a reference here
  29838.         $this->b = new B($this);
  29839.     }
  29840.  
  29841.     function createRef()
  29842.     {
  29843.         $this->c = new B($this);
  29844.     }
  29845.  
  29846.     function echoValue()
  29847.     {
  29848.         echo "<br>","class ",get_class($this),': ',$this->value;
  29849.     }
  29850. }
  29851.  
  29852.  
  29853. class B
  29854. {
  29855.     function B(&$a)
  29856.     {
  29857.         $this->a = &$a;
  29858.     }
  29859.  
  29860.     function echoValue()
  29861.     {
  29862.         echo "<br>","class ",get_class($this),': ',$this->a->value;
  29863.     }
  29864. }
  29865.  
  29866. // try to understand why using a simple copy here would yield
  29867. // in an undesired result in the *-marked line
  29868. $a =& new A(10);
  29869. $a->createRef();
  29870.  
  29871. $a->echoValue();
  29872. $a->b->echoValue();
  29873. $a->c->echoValue();
  29874.  
  29875. $a->value = 11;
  29876.  
  29877. $a->echoValue();
  29878. $a->b->echoValue(); // *
  29879. $a->c->echoValue();
  29880.  
  29881. /*
  29882. output:
  29883. class A: 10
  29884. class B: 10
  29885. class B: 10
  29886. class A: 11
  29887. class B: 11
  29888. class B: 11
  29889. */
  29890. ?></PRE
  29891. ></TD
  29892. ></TR
  29893. ></TABLE
  29894. ><P
  29895. ></P
  29896. ></DIV
  29897. >
  29898.    </P
  29899. ></DIV
  29900. ><DIV
  29901. CLASS="sect1"
  29902. ><HR><H2
  29903. CLASS="sect1"
  29904. ><A
  29905. NAME="language.oop.object-comparison-php4"
  29906. ></A
  29907. >Comparing objects in PHP 4</H2
  29908. ><P
  29909. >    In PHP 4, objects are compared in a very simple manner, namely: Two object
  29910.    instances are equal if they have the same attributes and values, and are
  29911.    instances of the same class. Similar rules are applied when comparing two
  29912.    objects using the identity operator (<TT
  29913. CLASS="literal"
  29914. >===</TT
  29915. >).
  29916.   </P
  29917. ><P
  29918. >    If we were to execute the code in the example below:
  29919.    <TABLE
  29920. WIDTH="100%"
  29921. BORDER="0"
  29922. CELLPADDING="0"
  29923. CELLSPACING="0"
  29924. CLASS="EXAMPLE"
  29925. ><TR
  29926. ><TD
  29927. ><DIV
  29928. CLASS="example"
  29929. ><A
  29930. NAME="AEN5573"
  29931. ></A
  29932. ><P
  29933. ><B
  29934. >P°φklad 13-1. Example of object comparison in PHP 4</B
  29935. ></P
  29936. ><TABLE
  29937. BORDER="0"
  29938. BGCOLOR="#E0E0E0"
  29939. CELLPADDING="5"
  29940. ><TR
  29941. ><TD
  29942. ><PRE
  29943. CLASS="php"
  29944. ><?php
  29945. function bool2str($bool) {
  29946.     if ($bool === false) {
  29947.             return 'FALSE';
  29948.     } else {
  29949.             return 'TRUE';
  29950.     }
  29951. }
  29952.  
  29953. function compareObjects(&$o1, &$o2) {
  29954.     echo 'o1 == o2 : '.bool2str($o1 == $o2)."\n";
  29955.     echo 'o1 != o2 : '.bool2str($o1 != $o2)."\n";
  29956.     echo 'o1 === o2 : '.bool2str($o1 === $o2)."\n";
  29957.     echo 'o1 !== o2 : '.bool2str($o1 !== $o2)."\n";
  29958. }
  29959.  
  29960. class Flag {
  29961.     var $flag;
  29962.  
  29963.     function Flag($flag=true) {
  29964.             $this->flag = $flag;
  29965.     }
  29966. }
  29967.  
  29968. class SwitchableFlag extends Flag {
  29969.  
  29970.     function turnOn() {
  29971.         $this->flag = true;
  29972.     }
  29973.  
  29974.     function turnOff() {
  29975.         $this->flag = false;
  29976.     }
  29977. }
  29978.  
  29979. $o = new Flag();
  29980. $p = new Flag(false);
  29981. $q = new Flag();
  29982.  
  29983. $r = new SwitchableFlag();
  29984.  
  29985. echo "Compare instances created with the same parameters\n";
  29986. compareObjects($o, $q);
  29987.  
  29988. echo "\nCompare instances created with different parameters\n";
  29989. compareObjects($o, $p);
  29990.  
  29991. echo "\nCompare an instance of a parent class with one from a subclass\n";
  29992. compareObjects($o, $r);
  29993. ?></PRE
  29994. ></TD
  29995. ></TR
  29996. ></TABLE
  29997. ></DIV
  29998. ></TD
  29999. ></TR
  30000. ></TABLE
  30001. >
  30002.    We will see:
  30003.    <TABLE
  30004. BORDER="0"
  30005. BGCOLOR="#E0E0E0"
  30006. CELLPADDING="5"
  30007. ><TR
  30008. ><TD
  30009. ><PRE
  30010. CLASS="screen"
  30011. >Compare instances created with the same parameters
  30012. o1 == o2 : TRUE
  30013. o1 != o2 : FALSE
  30014. o1 === o2 : TRUE
  30015. o1 !== o2 : FALSE
  30016.  
  30017. Compare instances created with different parameters
  30018. o1 == o2 : FALSE
  30019. o1 != o2 : TRUE
  30020. o1 === o2 : FALSE
  30021. o1 !== o2 : TRUE
  30022.  
  30023. Compare an instance of a parent class with one from a subclass
  30024. o1 == o2 : FALSE
  30025. o1 != o2 : TRUE
  30026. o1 === o2 : FALSE
  30027. o1 !== o2 : TRUE</PRE
  30028. ></TD
  30029. ></TR
  30030. ></TABLE
  30031. >
  30032.    Which is the output we will expect to obtain given the comparison rules
  30033.    above. Only instances with the same values for their attributes and from the same
  30034.    class are considered equal and identical.
  30035.   </P
  30036. ><P
  30037. >    Even in the cases where we have object composition, the same comparison
  30038.    rules apply. In the example below we create a container class that stores
  30039.    an associative array of <B
  30040. CLASS="classname"
  30041. >Flag</B
  30042. > objects.
  30043.    <TABLE
  30044. WIDTH="100%"
  30045. BORDER="0"
  30046. CELLPADDING="0"
  30047. CELLSPACING="0"
  30048. CLASS="EXAMPLE"
  30049. ><TR
  30050. ><TD
  30051. ><DIV
  30052. CLASS="example"
  30053. ><A
  30054. NAME="AEN5579"
  30055. ></A
  30056. ><P
  30057. ><B
  30058. >P°φklad 13-2. Compound object comparisons in PHP 4</B
  30059. ></P
  30060. ><TABLE
  30061. BORDER="0"
  30062. BGCOLOR="#E0E0E0"
  30063. CELLPADDING="5"
  30064. ><TR
  30065. ><TD
  30066. ><PRE
  30067. CLASS="php"
  30068. ><?php
  30069. class FlagSet {
  30070.     var $set;
  30071.  
  30072.     function FlagSet($flagArr = array()) {
  30073.         $this->set = $flagArr;
  30074.     }
  30075.  
  30076.     function addFlag($name, $flag) {
  30077.         $this->set[$name] = $flag;
  30078.     }
  30079.  
  30080.     function removeFlag($name) {
  30081.         if (array_key_exists($name, $this->set)) {
  30082.             unset($this->set[$name]);
  30083.         }
  30084.     }
  30085. }
  30086.  
  30087.  
  30088. $u = new FlagSet();
  30089. $u->addFlag('flag1', $o);
  30090. $u->addFlag('flag2', $p);
  30091. $v = new FlagSet(array('flag1'=>$q, 'flag2'=>$p));
  30092. $w = new FlagSet(array('flag1'=>$q));
  30093.  
  30094. echo "\nComposite objects u(o,p) and v(q,p)\n";
  30095. compareObjects($u, $v);
  30096.  
  30097. echo "\nu(o,p) and w(q)\n";
  30098. compareObjects($u, $w);
  30099. ?></PRE
  30100. ></TD
  30101. ></TR
  30102. ></TABLE
  30103. ></DIV
  30104. ></TD
  30105. ></TR
  30106. ></TABLE
  30107. >
  30108.    Which gives the expected output:
  30109.    <TABLE
  30110. BORDER="0"
  30111. BGCOLOR="#E0E0E0"
  30112. CELLPADDING="5"
  30113. ><TR
  30114. ><TD
  30115. ><PRE
  30116. CLASS="screen"
  30117. >Composite objects u(o,p) and v(q,p)
  30118. o1 == o2 : TRUE
  30119. o1 != o2 : FALSE
  30120. o1 === o2 : TRUE
  30121. o1 !== o2 : FALSE
  30122.  
  30123. u(o,p) and w(q)
  30124. o1 == o2 : FALSE
  30125. o1 != o2 : TRUE
  30126. o1 === o2 : FALSE
  30127. o1 !== o2 : TRUE</PRE
  30128. ></TD
  30129. ></TR
  30130. ></TABLE
  30131. >
  30132.   </P
  30133. ></DIV
  30134. ><DIV
  30135. CLASS="sect1"
  30136. ><HR><H2
  30137. CLASS="sect1"
  30138. ><A
  30139. NAME="language.oop.object-comparison-php5"
  30140. ></A
  30141. >Comparing objects in PHP 5</H2
  30142. ><DIV
  30143. CLASS="warning"
  30144. ><P
  30145. ></P
  30146. ><TABLE
  30147. CLASS="warning"
  30148. BORDER="1"
  30149. WIDTH="100%"
  30150. ><TR
  30151. ><TD
  30152. ALIGN="CENTER"
  30153. ><B
  30154. >Varovßnφ</B
  30155. ></TD
  30156. ></TR
  30157. ><TR
  30158. ><TD
  30159. ALIGN="LEFT"
  30160. ><P
  30161. >Toto roz╣φ°enφ je
  30162. <SPAN
  30163. CLASS="emphasis"
  30164. ><I
  30165. CLASS="emphasis"
  30166. >EXPERIMENT┴LN═</I
  30167. ></SPAN
  30168. >. Chovßnφ tohoto roz╣φ°enφ,
  30169. nßzvy funkcφ a v╣echno ostatnφ, co je zde zdokumentovßno, se v budoucφch
  30170. verzφch PHP m∙╛e bez ohlß╣enφ zm∞nit. Berte to v ·vahu a pou╛φvejte tento modul
  30171. na vlastnφ nebezpeΦφ.</P
  30172. ></TD
  30173. ></TR
  30174. ></TABLE
  30175. ></DIV
  30176. ><P
  30177. >     In PHP 5, object comparison is a more complicated than in PHP 4 and more
  30178.     in accordance to what one will expect from an Object Oriented Language
  30179.     (not that PHP 5 is such a language).
  30180.    </P
  30181. ><P
  30182. >     When using the comparison operator (<TT
  30183. CLASS="literal"
  30184. >==</TT
  30185. >), 
  30186.     object variables are compared in a simple manner, namely: Two object
  30187.     instances are equal if they have the same attributes and values, and are
  30188.     instances of the same class.
  30189.    </P
  30190. ><P
  30191. >     On the other hand, when using the identity operator (<TT
  30192. CLASS="literal"
  30193. >===</TT
  30194. >),
  30195.     object variables are identical if and only if they refer to the same
  30196.     instance of the same class.
  30197.    </P
  30198. ><P
  30199. >     An example will clarify these rules.
  30200.     <TABLE
  30201. WIDTH="100%"
  30202. BORDER="0"
  30203. CELLPADDING="0"
  30204. CELLSPACING="0"
  30205. CLASS="EXAMPLE"
  30206. ><TR
  30207. ><TD
  30208. ><DIV
  30209. CLASS="example"
  30210. ><A
  30211. NAME="AEN5594"
  30212. ></A
  30213. ><P
  30214. ><B
  30215. >P°φklad 13-3. Example of object comparison in PHP 5</B
  30216. ></P
  30217. ><TABLE
  30218. BORDER="0"
  30219. BGCOLOR="#E0E0E0"
  30220. CELLPADDING="5"
  30221. ><TR
  30222. ><TD
  30223. ><PRE
  30224. CLASS="php"
  30225. ><?php
  30226. function bool2str($bool) {
  30227.     if ($bool === false) {
  30228.             return 'FALSE';
  30229.     } else {
  30230.             return 'TRUE';
  30231.     }
  30232. }
  30233.  
  30234. function compareObjects(&$o1, &$o2) {
  30235.     echo 'o1 == o2 : '.bool2str($o1 == $o2)."\n";
  30236.     echo 'o1 != o2 : '.bool2str($o1 != $o2)."\n";
  30237.     echo 'o1 === o2 : '.bool2str($o1 === $o2)."\n";
  30238.     echo 'o1 !== o2 : '.bool2str($o1 !== $o2)."\n";
  30239. }
  30240.  
  30241. class Flag {
  30242.     var $flag;
  30243.  
  30244.     function Flag($flag=true) {
  30245.             $this->flag = $flag;
  30246.     }
  30247. }
  30248.  
  30249. class OtherFlag {
  30250.     var $flag;
  30251.  
  30252.     function OtherFlag($flag=true) {
  30253.             $this->flag = $flag;
  30254.     }
  30255. }
  30256.  
  30257. $o = new Flag();
  30258. $p = new Flag();
  30259. $q = $o;
  30260. $r = new OtherFlag();
  30261.  
  30262. echo "Two instances of the same class\n";
  30263. compareObjects($o, $p);
  30264.  
  30265. echo "\nTwo references to the same instance\n";
  30266. compareObjects($o, $q);
  30267.  
  30268. echo "\nInstances of two different classes\n";
  30269. compareObjects($o, $r);
  30270. ?></PRE
  30271. ></TD
  30272. ></TR
  30273. ></TABLE
  30274. ></DIV
  30275. ></TD
  30276. ></TR
  30277. ></TABLE
  30278. >
  30279.     This example will output:
  30280.     <TABLE
  30281. BORDER="0"
  30282. BGCOLOR="#E0E0E0"
  30283. CELLPADDING="5"
  30284. ><TR
  30285. ><TD
  30286. ><PRE
  30287. CLASS="screen"
  30288. >Two instances of the same class
  30289. o1 == o2 : TRUE
  30290. o1 != o2 : FALSE
  30291. o1 === o2 : FALSE
  30292. o1 !== o2 : TRUE
  30293.  
  30294. Two references to the same instance
  30295. o1 == o2 : TRUE
  30296. o1 != o2 : FALSE
  30297. o1 === o2 : TRUE
  30298. o1 !== o2 : FALSE
  30299.  
  30300. Instances of two different classes
  30301. o1 == o2 : FALSE
  30302. o1 != o2 : TRUE
  30303. o1 === o2 : FALSE
  30304. o1 !== o2 : TRUE</PRE
  30305. ></TD
  30306. ></TR
  30307. ></TABLE
  30308. >
  30309.    </P
  30310. ></DIV
  30311. ></DIV
  30312. ><DIV
  30313. CLASS="chapter"
  30314. ><HR><H1
  30315. ><A
  30316. NAME="language.references"
  30317. >Kapitola 14. Vysv∞tlenφ referencφ (odkaz∙)</A
  30318. ></H1
  30319. ><DIV
  30320. CLASS="sect1"
  30321. ><H2
  30322. CLASS="sect1"
  30323. ><A
  30324. NAME="language.references.whatare"
  30325. ></A
  30326. >Co jsou reference</H2
  30327. ><P
  30328. >     Reference (odkazy) jsou prost°edek, jak v PHP p°istupovat k tΘmu╛ obsahu
  30329.     prom∞nnΘ pod r∙zn²mi jmΘny. Nejsou to ukazatele (pointery) jako v C, jsou
  30330.     to aliasy v tabulce symbol∙. Uv∞domte si, ╛e v PHP je rozdφl mezi
  30331.     nßzvem prom∞nnΘ a jejφm obsahem, tak╛e stejn² obsah m∙╛e mφt r∙znΘ nßzvy.
  30332.     Nejbli╛╣φ analogiφ jsou nßzvy soubor∙ a soubory v UNIXu - nßzvy
  30333.     prom∞nn²ch jsou polo╛ky adresß°e, obsahy prom∞nn²ch samotnΘ soubory.
  30334.     Na reference m∙╛e b²t nazφrßno jako na hardlinky v UNIXovΘm systΘmu
  30335.     soubor∙.
  30336.    </P
  30337. ></DIV
  30338. ><DIV
  30339. CLASS="sect1"
  30340. ><HR><H2
  30341. CLASS="sect1"
  30342. ><A
  30343. NAME="language.references.whatdo"
  30344. ></A
  30345. >Co reference d∞lajφ</H2
  30346. ><P
  30347. >     PHP reference umo╛≥ujφ zajistit, aby dv∞ prom∞nnΘ odkazovaly na tent²╛
  30348.     obsah. Tzn. kdy╛ provedete:    
  30349.     <DIV
  30350. CLASS="informalexample"
  30351. ><A
  30352. NAME="AEN5606"
  30353. ></A
  30354. ><P
  30355. ></P
  30356. ><TABLE
  30357. BORDER="0"
  30358. BGCOLOR="#E0E0E0"
  30359. CELLPADDING="5"
  30360. ><TR
  30361. ><TD
  30362. ><PRE
  30363. CLASS="php"
  30364. >$a =& $b</PRE
  30365. ></TD
  30366. ></TR
  30367. ></TABLE
  30368. ><P
  30369. ></P
  30370. ></DIV
  30371. >
  30372.     znamenß to, ╛e <TT
  30373. CLASS="varname"
  30374. >$a</TT
  30375. > a <TT
  30376. CLASS="varname"
  30377. >$b</TT
  30378. > ukazujφ
  30379.     na stejnou prom∞nnou.
  30380.     <DIV
  30381. CLASS="note"
  30382. ><BLOCKQUOTE
  30383. CLASS="note"
  30384. ><P
  30385. ><B
  30386. >Poznßmka: </B
  30387. >
  30388.       <TT
  30389. CLASS="varname"
  30390. >$a</TT
  30391. > a <TT
  30392. CLASS="varname"
  30393. >$b</TT
  30394. > jsou zde ·pln∞
  30395.       ekvivalentnφ, tj. nikoliv ╛e <TT
  30396. CLASS="varname"
  30397. >$a</TT
  30398. > ukazuje na
  30399.       <TT
  30400. CLASS="varname"
  30401. >$b</TT
  30402. > apod., n²br╛ ╛e <TT
  30403. CLASS="varname"
  30404. >$a</TT
  30405. >
  30406.       a <TT
  30407. CLASS="varname"
  30408. >$b</TT
  30409. > ukazujφ na stejnΘ mφsto.
  30410.      </P
  30411. ></BLOCKQUOTE
  30412. ></DIV
  30413. >
  30414.    </P
  30415. ><P
  30416. >     Stejnß syntaxe se m∙╛e pou╛φt s funkcemi, kterΘ vracφ reference a 
  30417.    s operßtorem <TT
  30418. CLASS="literal"
  30419. >new</TT
  30420. > (v PHP 4.0.4 a pozd∞j╣φch):
  30421.     <DIV
  30422. CLASS="informalexample"
  30423. ><A
  30424. NAME="AEN5620"
  30425. ></A
  30426. ><P
  30427. ></P
  30428. ><TABLE
  30429. BORDER="0"
  30430. BGCOLOR="#E0E0E0"
  30431. CELLPADDING="5"
  30432. ><TR
  30433. ><TD
  30434. ><PRE
  30435. CLASS="php"
  30436. >$bar =& new fooclass();
  30437. $foo =& find_var ($bar);</PRE
  30438. ></TD
  30439. ></TR
  30440. ></TABLE
  30441. ><P
  30442. ></P
  30443. ></DIV
  30444. >
  30445.     </P
  30446. ><DIV
  30447. CLASS="note"
  30448. ><BLOCKQUOTE
  30449. CLASS="note"
  30450. ><P
  30451. ><B
  30452. >Poznßmka: </B
  30453. >
  30454.       Nepou╛itφ operßtoru <TT
  30455. CLASS="literal"
  30456. >&</TT
  30457. > zp∙sobφ zkopφrovßnφ
  30458.       objektu. Kdy╛ ve t°φd∞ pou╛ijete <TT
  30459. CLASS="literal"
  30460. >$this</TT
  30461. >, bude se
  30462.       pracovat s aktußlnφ instancφ t°φdy. P°i°azenφ bez
  30463.       <TT
  30464. CLASS="literal"
  30465. >&</TT
  30466. > zkopφruje instanci (nap°. objektu) a
  30467.      <TT
  30468. CLASS="literal"
  30469. >$this</TT
  30470. > bude pracovat s touto kopiφ, co╛ nenφ v╛dy to,
  30471.      co se po╛aduje. V∞t╣inou chcete mφt jedinou instanci, s nφ╛ budete
  30472.      pracovat, kv∙li rychlosti a alokaci pam∞ti.
  30473.      </P
  30474. ></BLOCKQUOTE
  30475. ></DIV
  30476. ><P
  30477. >     Druhou v∞cφ, kterou reference d∞lajφ, je p°edßvßnφ prom∞nn²ch odkazem.
  30478.     To se d∞lß vytvo°enφm lokßlnφ prom∞nnΘ ve funkci a prom∞nnΘ v kontextu
  30479.     volajφcφho prost°edφ, kdy se odkazuje na tent²╛ obsah. Nap°φklad:
  30480.     <DIV
  30481. CLASS="informalexample"
  30482. ><A
  30483. NAME="AEN5629"
  30484. ></A
  30485. ><P
  30486. ></P
  30487. ><TABLE
  30488. BORDER="0"
  30489. BGCOLOR="#E0E0E0"
  30490. CELLPADDING="5"
  30491. ><TR
  30492. ><TD
  30493. ><PRE
  30494. CLASS="php"
  30495. >function foo (&$var)
  30496. {
  30497.     $var++;
  30498. }
  30499.  
  30500. $a=5;
  30501. foo ($a);</PRE
  30502. ></TD
  30503. ></TR
  30504. ></TABLE
  30505. ><P
  30506. ></P
  30507. ></DIV
  30508. >
  30509.     nastavφ do <TT
  30510. CLASS="varname"
  30511. >$a</TT
  30512. > hodnotu 6. To proto, ╛e ve funkci
  30513.     <TT
  30514. CLASS="varname"
  30515. >foo</TT
  30516. > prom∞nnß <TT
  30517. CLASS="varname"
  30518. >$var</TT
  30519. > odkazuje tent²╛
  30520.     obsah jako <TT
  30521. CLASS="varname"
  30522. >$a</TT
  30523. >. Viz detailn∞j╣φ vysv∞tlenφ o
  30524.     <A
  30525. HREF="#language.references.pass"
  30526. >p°edßvßnφ odkazem</A
  30527. >.
  30528.    </P
  30529. ><P
  30530. >     T°etφ v∞cφ, kterou mohou reference d∞lat, je
  30531.     <A
  30532. HREF="#language.references.return"
  30533. >vracenφ p°es reference</A
  30534. >.
  30535.    </P
  30536. ></DIV
  30537. ><DIV
  30538. CLASS="sect1"
  30539. ><HR><H2
  30540. CLASS="sect1"
  30541. ><A
  30542. NAME="language.references.arent"
  30543. ></A
  30544. >Co reference nejsou</H2
  30545. ><P
  30546. >     Jak ji╛ bylo °eΦeno, reference nejsou ukazatele. To znamenß, ╛e tento
  30547.     konstrukt nebude d∞lat to, co oΦekßvßte:
  30548.     <DIV
  30549. CLASS="informalexample"
  30550. ><A
  30551. NAME="AEN5641"
  30552. ></A
  30553. ><P
  30554. ></P
  30555. ><TABLE
  30556. BORDER="0"
  30557. BGCOLOR="#E0E0E0"
  30558. CELLPADDING="5"
  30559. ><TR
  30560. ><TD
  30561. ><PRE
  30562. CLASS="php"
  30563. >function foo (&$var)
  30564. {
  30565.     $var =& $GLOBALS["baz"];
  30566. }
  30567. foo($bar);</PRE
  30568. ></TD
  30569. ></TR
  30570. ></TABLE
  30571. ><P
  30572. ></P
  30573. ></DIV
  30574. >
  30575.    </P
  30576. ><P
  30577. >     Nastane to, ╛e <TT
  30578. CLASS="varname"
  30579. >$var</TT
  30580. > ve funkci <TT
  30581. CLASS="varname"
  30582. >foo</TT
  30583. >
  30584.     bude p°i°azena <TT
  30585. CLASS="varname"
  30586. >$bar</TT
  30587. > ve volajφcφm kontextu, av╣ak potΘ
  30588.     bude p°i°azena <TT
  30589. CLASS="varname"
  30590. >$GLOBALS["baz"]</TT
  30591. >. Nenφ zp∙sob, jak
  30592.     p°i°adit <TT
  30593. CLASS="varname"
  30594. >$bar</TT
  30595. > ve volajφcφm kontextu n∞Φemu jinΘmu
  30596.     za pou╛itφ mechanismu referencφ, proto╛e <TT
  30597. CLASS="varname"
  30598. >$bar</TT
  30599. > nenφ
  30600.     ve funkci <TT
  30601. CLASS="varname"
  30602. >foo</TT
  30603. > dostupnß (je reprezentovßna
  30604.     <TT
  30605. CLASS="varname"
  30606. >$var</TT
  30607. >, ale <TT
  30608. CLASS="varname"
  30609. >$var</TT
  30610. > mß pouze obsah
  30611.     a nikoli spojenφ nßzvu s hodnotou v tabulce symbol∙).
  30612.    </P
  30613. ></DIV
  30614. ><DIV
  30615. CLASS="sect1"
  30616. ><HR><H2
  30617. CLASS="sect1"
  30618. ><A
  30619. NAME="language.references.pass"
  30620. ></A
  30621. >P°edßvßnφ referencφ (odkazem)</H2
  30622. ><P
  30623. >     M∙╛ete p°edßvat prom∞nnou do funkce pomocφ odkazu, tak╛e funkce m∙╛e
  30624.     modifikovat jejφ argumenty. Syntaxe je nßsledujφcφ:
  30625.     <DIV
  30626. CLASS="informalexample"
  30627. ><A
  30628. NAME="AEN5656"
  30629. ></A
  30630. ><P
  30631. ></P
  30632. ><TABLE
  30633. BORDER="0"
  30634. BGCOLOR="#E0E0E0"
  30635. CELLPADDING="5"
  30636. ><TR
  30637. ><TD
  30638. ><PRE
  30639. CLASS="php"
  30640. >function foo (&$var)
  30641. {
  30642.     $var++;
  30643. }
  30644.  
  30645. $a=5;
  30646. foo ($a);
  30647. // $a je te∩ 6</PRE
  30648. ></TD
  30649. ></TR
  30650. ></TABLE
  30651. ><P
  30652. ></P
  30653. ></DIV
  30654. >
  30655.     V╣imn∞te si, ╛e ve volßnφ funkce nenφ znak reference - pouze v jejφ
  30656.     definici. Samotnß definice funkce staΦφ na sprßvnΘ p°edßvßnφ argumentu
  30657.     odkazem. 
  30658.   </P
  30659. ><P
  30660. >   Nßsledujφcφ v∞ci lze p°edßvat referencφ:
  30661.    <P
  30662. ></P
  30663. ><UL
  30664. ><LI
  30665. ><P
  30666. >       Prom∞nnß, nap°. <TT
  30667. CLASS="literal"
  30668. >foo($a)</TT
  30669. >
  30670.      </P
  30671. ></LI
  30672. ><LI
  30673. ><P
  30674. >       Konstrukt s new, nap°. <TT
  30675. CLASS="literal"
  30676. >foo(new foobar())</TT
  30677. >
  30678.      </P
  30679. ></LI
  30680. ><LI
  30681. ><P
  30682. >       Reference, vracenß z funkce, nap°.:
  30683.     <DIV
  30684. CLASS="informalexample"
  30685. ><A
  30686. NAME="AEN5668"
  30687. ></A
  30688. ><P
  30689. ></P
  30690. ><TABLE
  30691. BORDER="0"
  30692. BGCOLOR="#E0E0E0"
  30693. CELLPADDING="5"
  30694. ><TR
  30695. ><TD
  30696. ><PRE
  30697. CLASS="php"
  30698. >function &bar()
  30699. {
  30700.     $a = 5;
  30701.     return $a;
  30702. }
  30703. foo(bar());</PRE
  30704. ></TD
  30705. ></TR
  30706. ></TABLE
  30707. ><P
  30708. ></P
  30709. ></DIV
  30710. >
  30711.     Viz takΘ vysv∞tlenφ
  30712.     <A
  30713. HREF="#language.references.return"
  30714. >vracenφ p°es reference</A
  30715. >. 
  30716.      </P
  30717. ></LI
  30718. ></UL
  30719. >
  30720.   </P
  30721. ><P
  30722. >    «ßdnΘ jinΘ v²razy nemohou b²t p°edßvßny odkazem, v²sledek tohoto nenφ
  30723.    definovßn. Nap°φklad, nßsledujφcφ ukßzky p°edßvßnφ odkazem jsou neplatnΘ:
  30724.     <DIV
  30725. CLASS="informalexample"
  30726. ><A
  30727. NAME="AEN5672"
  30728. ></A
  30729. ><P
  30730. ></P
  30731. ><TABLE
  30732. BORDER="0"
  30733. BGCOLOR="#E0E0E0"
  30734. CELLPADDING="5"
  30735. ><TR
  30736. ><TD
  30737. ><PRE
  30738. CLASS="php"
  30739. >function bar() // V╣imn∞te si chyb∞jφcφho &
  30740. {
  30741.     $a = 5;
  30742.     return $a;
  30743. }
  30744. foo(bar());
  30745.  
  30746. foo($a = 5) // V²raz, nikoli prom∞nnß
  30747. foo(5) // Konstanta, nikoli prom∞nnß</PRE
  30748. ></TD
  30749. ></TR
  30750. ></TABLE
  30751. ><P
  30752. ></P
  30753. ></DIV
  30754. >
  30755.         Tyto po╛adavky platφ pro PHP 4.0.4 a pozd∞j╣φ.
  30756.   </P
  30757. ></DIV
  30758. ><DIV
  30759. CLASS="sect1"
  30760. ><HR><H2
  30761. CLASS="sect1"
  30762. ><A
  30763. NAME="language.references.return"
  30764. ></A
  30765. >Vracenφ referencφ</H2
  30766. ><P
  30767. >     Vracenφ odkazem je u╛iteΦnΘ, kdy╛ chcete pou╛φt funkci k nalezenφ
  30768.     prom∞nnΘ, kterß by m∞la b²t odkazu p°i°azena. P°i vracenφ referencφ
  30769.     pou╛ijte tuto syntaxi:
  30770.     <DIV
  30771. CLASS="informalexample"
  30772. ><A
  30773. NAME="AEN5677"
  30774. ></A
  30775. ><P
  30776. ></P
  30777. ><TABLE
  30778. BORDER="0"
  30779. BGCOLOR="#E0E0E0"
  30780. CELLPADDING="5"
  30781. ><TR
  30782. ><TD
  30783. ><PRE
  30784. CLASS="php"
  30785. >function &find_var ($param)
  30786. {
  30787.     ...n∞jak² k≤d...
  30788.     return $found_var;
  30789. }
  30790.  
  30791. $foo =& find_var ($bar);
  30792. $foo->x = 2;</PRE
  30793. ></TD
  30794. ></TR
  30795. ></TABLE
  30796. ><P
  30797. ></P
  30798. ></DIV
  30799. >
  30800.     V tomto p°φkladu by bylo funkcφ <TT
  30801. CLASS="varname"
  30802. >find_var</TT
  30803. > nastaveno
  30804.     vlastnictvφ tΘho╛ objektu, nikoli jeho kopie, jak by se stalo bez pou╛itφ
  30805.     syntaxe bez odkaz∙.
  30806.    </P
  30807. ><DIV
  30808. CLASS="note"
  30809. ><BLOCKQUOTE
  30810. CLASS="note"
  30811. ><P
  30812. ><B
  30813. >Poznßmka: </B
  30814. >
  30815.      Narozdφl od p°edßvßnφ parametru, zde musφte <TT
  30816. CLASS="literal"
  30817. >&</TT
  30818. >
  30819.      pou╛φt na obou mφstech - k indikaci, ╛e vracφte odkaz a nikoli kopii
  30820.      jako obvykle, a k indikaci p°i°azenφ reference do <TT
  30821. CLASS="varname"
  30822. >$foo</TT
  30823. >
  30824.      namφsto b∞╛nΘho p°i°azenφ (hodnoty).
  30825.     </P
  30826. ></BLOCKQUOTE
  30827. ></DIV
  30828. ></DIV
  30829. ><DIV
  30830. CLASS="sect1"
  30831. ><HR><H2
  30832. CLASS="sect1"
  30833. ><A
  30834. NAME="language.references.unset"
  30835. ></A
  30836. >Odnastavenφ odkaz∙</H2
  30837. ><P
  30838. >     Kdy╛ odnastavφte referenci, p°eru╣φte vazbu mezi nßzvem prom∞nnΘ a jejφm
  30839.     obsahem. To neznamenß, ╛e by obsah byl zniΦen. Nap°φklad:
  30840.     <DIV
  30841. CLASS="informalexample"
  30842. ><A
  30843. NAME="AEN5687"
  30844. ></A
  30845. ><P
  30846. ></P
  30847. ><TABLE
  30848. BORDER="0"
  30849. BGCOLOR="#E0E0E0"
  30850. CELLPADDING="5"
  30851. ><TR
  30852. ><TD
  30853. ><PRE
  30854. CLASS="php"
  30855. >$a = 1;
  30856. $b =& $a;
  30857. unset ($a);</PRE
  30858. ></TD
  30859. ></TR
  30860. ></TABLE
  30861. ><P
  30862. ></P
  30863. ></DIV
  30864. >
  30865.     neodnastavφ <TT
  30866. CLASS="varname"
  30867. >$b</TT
  30868. >, n²br╛ pouze <TT
  30869. CLASS="varname"
  30870. >$a</TT
  30871. >. 
  30872.    </P
  30873. ><P
  30874. >     Znovu je dobrΘ si p°ipomenout analogii s UNIXov²m p°φkazem
  30875.     <B
  30876. CLASS="command"
  30877. >unlink</B
  30878. >.
  30879.    </P
  30880. ></DIV
  30881. ><DIV
  30882. CLASS="sect1"
  30883. ><HR><H2
  30884. CLASS="sect1"
  30885. ><A
  30886. NAME="language.references.spot"
  30887. ></A
  30888. >Dal╣φ v²skyt referencφ</H2
  30889. ><P
  30890. >     Mnoho syntaktick²ch konstrukt∙ v PHP je implementovßno p°es odkazov²
  30891.     mechanismus, tak╛e v╣e, co bylo °eΦeno v²╣e o p°i°azovßnφ referencφ,
  30892.     platφ i na tyto konstrukty. N∞kterΘ konstrukty, jako p°edßvßnφ a
  30893.     vracenφ p°es odkazy, byly ji╛ zmφn∞ny. Ostatnφ konstrukty pou╛φvajφcφ
  30894.     reference jsou:
  30895.    </P
  30896. ><DIV
  30897. CLASS="sect2"
  30898. ><HR><H3
  30899. CLASS="sect2"
  30900. ><A
  30901. NAME="references.global"
  30902. ></A
  30903. >odkazy <TT
  30904. CLASS="literal"
  30905. >global</TT
  30906. ></H3
  30907. ><P
  30908. >      Kdy╛ deklarujete prom∞nnou jako <B
  30909. CLASS="command"
  30910. >global $var</B
  30911. >, ve
  30912.      skuteΦnosti vytvß°φte odkaz na globßlnφ prom∞nnou. Tzn. je to totΘ╛,
  30913.      jako:
  30914.      <DIV
  30915. CLASS="informalexample"
  30916. ><A
  30917. NAME="AEN5701"
  30918. ></A
  30919. ><P
  30920. ></P
  30921. ><TABLE
  30922. BORDER="0"
  30923. BGCOLOR="#E0E0E0"
  30924. CELLPADDING="5"
  30925. ><TR
  30926. ><TD
  30927. ><PRE
  30928. CLASS="php"
  30929. >$var =& $GLOBALS["var"];</PRE
  30930. ></TD
  30931. ></TR
  30932. ></TABLE
  30933. ><P
  30934. ></P
  30935. ></DIV
  30936. >
  30937.     </P
  30938. ><P
  30939. >      To znamenß, nap°φklad, ╛e odnastavenφ <TT
  30940. CLASS="varname"
  30941. >$var</TT
  30942. >
  30943.      neodnastavφ globßlnφ prom∞nnou.
  30944.     </P
  30945. ></DIV
  30946. ><DIV
  30947. CLASS="sect2"
  30948. ><HR><H3
  30949. CLASS="sect2"
  30950. ><A
  30951. NAME="references.this"
  30952. ></A
  30953. ><TT
  30954. CLASS="literal"
  30955. >$this</TT
  30956. ></H3
  30957. ><P
  30958. >      V metod∞ objektu je <TT
  30959. CLASS="varname"
  30960. >$this</TT
  30961. > v╛dy odkazem na volajφcφ
  30962.      objekt.
  30963.     </P
  30964. ></DIV
  30965. ></DIV
  30966. ></DIV
  30967. ></DIV
  30968. ><DIV
  30969. CLASS="PART"
  30970. ><A
  30971. NAME="security"
  30972. ></A
  30973. ><DIV
  30974. CLASS="TITLEPAGE"
  30975. ><H1
  30976. CLASS="title"
  30977. >III. Security</H1
  30978. ><DIV
  30979. CLASS="TOC"
  30980. ><DL
  30981. ><DT
  30982. ><B
  30983. >Obsah</B
  30984. ></DT
  30985. ><DT
  30986. >15. <A
  30987. HREF="#security.index"
  30988. >Security</A
  30989. ></DT
  30990. ></DL
  30991. ></DIV
  30992. ></DIV
  30993. ><DIV
  30994. CLASS="chapter"
  30995. ><HR><H1
  30996. ><A
  30997. NAME="security.index"
  30998. >Kapitola 15. Security</A
  30999. ></H1
  31000. ><P
  31001. >    PHP is a powerful language and the interpreter, whether included
  31002.    in a web server as a module or executed as a separate
  31003.    <SPAN
  31004. CLASS="acronym"
  31005. >CGI</SPAN
  31006. > binary, is able to access files, execute
  31007.    commands and open network connections on the server.  These
  31008.    properties make anything run on a web server insecure by default.
  31009.    PHP is designed specifically to be a more secure language for
  31010.    writing CGI programs than Perl or C, and with correct selection of
  31011.    compile-time and runtime configuration options, and proper coding
  31012.    practices, it can give you exactly the combination of freedom and
  31013.    security you need.
  31014.   </P
  31015. ><P
  31016. >    As there are many different ways of utilizing PHP, there are many
  31017.    configuration options controlling its behaviour.  A large
  31018.    selection of options guarantees you can use PHP for a lot of
  31019.    purposes, but it also means there are combinations of these
  31020.    options and server configurations that result in an insecure
  31021.    setup.
  31022.   </P
  31023. ><P
  31024. >    The configuration flexibility of PHP is equally rivalled by the
  31025.    code flexibility. PHP can be used to build complete server
  31026.    applications, with all the power of a shell user, or it can be used
  31027.    for simple server-side includes with little risk in a tightly
  31028.    controlled environment. How you build that environment, and how
  31029.    secure it is, is largely up to the PHP developer.
  31030.   </P
  31031. ><P
  31032. >    This chapter starts with some general security advice, explains
  31033.    the different configuration option combinations and the situations
  31034.    they can be safely used, and describes different considerations in
  31035.    coding for different levels of security.
  31036.   </P
  31037. ><DIV
  31038. CLASS="sect1"
  31039. ><HR><H2
  31040. CLASS="sect1"
  31041. ><A
  31042. NAME="security.general"
  31043. ></A
  31044. >General considerations</H2
  31045. ><P
  31046. >     A completely secure system is a virtual impossibility, so an
  31047.     approach often used in the security profession is one of balancing
  31048.     risk and usability. If every variable submitted by a user required
  31049.     two forms of biometric validation (such as a retinal scan and a
  31050.     fingerprint), you would have an extremely high level of
  31051.     accountability. It would also take half an hour to fill out a fairly
  31052.     complex form, which would tend to encourage users to find ways of
  31053.     bypassing the security.
  31054.    </P
  31055. ><P
  31056. >     The best security is often inobtrusive enough to suit the
  31057.     requirements without the user being prevented from accomplishing
  31058.     their work, or over-burdening the code author with excessive
  31059.     complexity. Indeed, some security attacks are merely exploits of
  31060.     this kind of overly built security, which tends to erode over time.
  31061.    </P
  31062. ><P
  31063. >     A phrase worth remembering: A system is only as good as the weakest
  31064.     link in a chain. If all transactions are heavily logged based on
  31065.     time, location, transaction type, etc. but the user is only
  31066.     verified based on a single cookie, the validity of tying the users
  31067.     to the transaction log is severely weakened.
  31068.    </P
  31069. ><P
  31070. >     When testing, keep in mind that you will not be able to test all
  31071.     possibilities for even the simplest of pages. The input you
  31072.     may expect will be completely unrelated to the input given by
  31073.     a disgruntled employee, a cracker with months of time on their
  31074.     hands, or a housecat walking across the keyboard. This is why it's
  31075.     best to look at the code from a logical perspective, to discern
  31076.     where unexpected data can be introduced, and then follow how it is
  31077.     modified, reduced, or amplified.
  31078.    </P
  31079. ><P
  31080. >     The Internet is filled with people trying to make a name for
  31081.     themselves by breaking your code, crashing your site, posting
  31082.     inappropriate content, and otherwise making your day interesting.
  31083.     It doesn't matter if you have a small or large site, you are
  31084.     a target by simply being online, by having a server that can be
  31085.     connected to. Many cracking programs do not discern by size, they
  31086.     simply trawl massive IP blocks looking for victims. Try not to
  31087.     become one.
  31088.    </P
  31089. ></DIV
  31090. ><DIV
  31091. CLASS="sect1"
  31092. ><HR><H2
  31093. CLASS="sect1"
  31094. ><A
  31095. NAME="security.cgi-bin"
  31096. ></A
  31097. >Installed as CGI binary</H2
  31098. ><DIV
  31099. CLASS="sect2"
  31100. ><H3
  31101. CLASS="sect2"
  31102. ><A
  31103. NAME="security.cgi-bin.attacks"
  31104. ></A
  31105. >Possible attacks</H3
  31106. ><P
  31107. >      Using PHP as a <SPAN
  31108. CLASS="acronym"
  31109. >CGI</SPAN
  31110. > binary is an option for
  31111.      setups that for some reason do not wish to integrate PHP as a
  31112.      module into server software (like Apache), or will use PHP with
  31113.      different kinds of CGI wrappers to create safe chroot and setuid
  31114.      environments for scripts.  This setup usually involves installing
  31115.      executable PHP binary to the web server cgi-bin directory.  CERT
  31116.      advisory <A
  31117. HREF="http://www.cert.org/advisories/CA-1996-11.html"
  31118. TARGET="_top"
  31119. >CA-96.11</A
  31120. > recommends
  31121.      against placing any interpreters into cgi-bin.  Even if the PHP
  31122.      binary can be used as a standalone interpreter, PHP is designed
  31123.      to prevent the attacks this setup makes possible:
  31124.     </P
  31125. ><P
  31126. ></P
  31127. ><UL
  31128. ><LI
  31129. ><P
  31130. >        Accessing system files: <TT
  31131. CLASS="filename"
  31132. >http://my.host/cgi-bin/php?/etc/passwd</TT
  31133. >
  31134.       </P
  31135. ><P
  31136. >        The query information in a url after the question mark (?)  is
  31137.        passed as command line arguments to the interpreter by the CGI
  31138.        interface.  Usually interpreters open and execute the file
  31139.        specified as the first argument on the command line.
  31140.       </P
  31141. ><P
  31142. >        When invoked as a CGI binary, PHP refuses to interpret the
  31143.        command line arguments.
  31144.       </P
  31145. ></LI
  31146. ><LI
  31147. ><P
  31148. >        Accessing any web document on server: <TT
  31149. CLASS="filename"
  31150. >http://my.host/cgi-bin/php/secret/doc.html</TT
  31151. >
  31152.       </P
  31153. ><P
  31154. >        The path information part of the url after the PHP binary name,
  31155.        <TT
  31156. CLASS="filename"
  31157. >/secret/doc.html</TT
  31158. > is
  31159.        conventionally used to specify the name of the file to be
  31160.        opened and interpreted by the <SPAN
  31161. CLASS="acronym"
  31162. >CGI</SPAN
  31163. > program.
  31164.        Usually some web server configuration directives (Apache:
  31165.        Action) are used to redirect requests to documents like
  31166.        <TT
  31167. CLASS="filename"
  31168. >http://my.host/secret/script.php</TT
  31169. > to the
  31170.        PHP interpreter.  With this setup, the web server first checks
  31171.        the access permissions to the directory <TT
  31172. CLASS="filename"
  31173. >/secret</TT
  31174. >, and after that creates the
  31175.        redirected request <TT
  31176. CLASS="filename"
  31177. >http://my.host/cgi-bin/php/secret/script.php</TT
  31178. >.
  31179.        Unfortunately, if the request is originally given in this form,
  31180.        no access checks are made by web server for file <TT
  31181. CLASS="filename"
  31182. >/secret/script.php</TT
  31183. >, but only for the
  31184.        <TT
  31185. CLASS="filename"
  31186. >/cgi-bin/php</TT
  31187. > file.  This way
  31188.        any user able to access <TT
  31189. CLASS="filename"
  31190. >/cgi-bin/php</TT
  31191. > is able to access any
  31192.        protected document on the web server.
  31193.       </P
  31194. ><P
  31195. >        In PHP, compile-time configuration option <A
  31196. HREF="#install.configure.enable-force-cgi-redirect"
  31197. >--enable-force-cgi-redirect</A
  31198. >
  31199.        and runtime configuration directives <A
  31200. HREF="#ini.doc-root"
  31201. >doc_root</A
  31202. > and <A
  31203. HREF="#ini.user-dir"
  31204. >user_dir</A
  31205. > can be used to prevent
  31206.        this attack, if the server document tree has any directories
  31207.        with access restrictions.  See below for full the explanation
  31208.        of the different combinations.
  31209.       </P
  31210. ></LI
  31211. ></UL
  31212. ></DIV
  31213. ><DIV
  31214. CLASS="sect2"
  31215. ><HR><H3
  31216. CLASS="sect2"
  31217. ><A
  31218. NAME="security.cgi-bin.default"
  31219. ></A
  31220. >Case 1: only public files served</H3
  31221. ><P
  31222. >      If your server does not have any content that is not restricted
  31223.      by password or ip based access control, there is no need for
  31224.      these configuration options.  If your web server does not allow
  31225.      you to do redirects, or the server does not have a way to
  31226.      communicate to the PHP binary that the request is a safely
  31227.      redirected request, you can specify the option <A
  31228. HREF="#install.configure.enable-force-cgi-redirect"
  31229. >--enable-force-cgi-redirect</A
  31230. >
  31231.      to the configure script.  You still have to make sure your PHP
  31232.      scripts do not rely on one or another way of calling the script,
  31233.      neither by directly <TT
  31234. CLASS="filename"
  31235. >http://my.host/cgi-bin/php/dir/script.php</TT
  31236. >
  31237.      nor by redirection <TT
  31238. CLASS="filename"
  31239. >http://my.host/dir/script.php</TT
  31240. >.
  31241.     </P
  31242. ><P
  31243. >      Redirection can be configured in Apache by using AddHandler and
  31244.      Action directives (see below).
  31245.     </P
  31246. ></DIV
  31247. ><DIV
  31248. CLASS="sect2"
  31249. ><HR><H3
  31250. CLASS="sect2"
  31251. ><A
  31252. NAME="security.cgi-bin.force-redirect"
  31253. ></A
  31254. >Case 2: using --enable-force-cgi-redirect</H3
  31255. ><P
  31256. >      This compile-time option prevents anyone from calling PHP
  31257.      directly with a url like <TT
  31258. CLASS="filename"
  31259. >http://my.host/cgi-bin/php/secretdir/script.php</TT
  31260. >.
  31261.      Instead, PHP will only parse in this mode if it has gone through
  31262.      a web server redirect rule.
  31263.     </P
  31264. ><P
  31265. >      Usually the redirection in the Apache configuration is done with
  31266.      the following directives:
  31267.     </P
  31268. ><TABLE
  31269. BORDER="0"
  31270. BGCOLOR="#E0E0E0"
  31271. CELLPADDING="5"
  31272. ><TR
  31273. ><TD
  31274. ><PRE
  31275. CLASS="apache-conf"
  31276. >Action php-script /cgi-bin/php
  31277. AddHandler php-script .php</PRE
  31278. ></TD
  31279. ></TR
  31280. ></TABLE
  31281. ><P
  31282. >      This option has only been tested with the Apache web server, and
  31283.      relies on Apache to set the non-standard CGI environment variable
  31284.      <TT
  31285. CLASS="envar"
  31286. >REDIRECT_STATUS</TT
  31287. > on redirected requests.  If your
  31288.      web server does not support any way of telling if the request is
  31289.      direct or redirected, you cannot use this option and you must use
  31290.      one of the other ways of running the CGI version documented
  31291.      here.
  31292.     </P
  31293. ></DIV
  31294. ><DIV
  31295. CLASS="sect2"
  31296. ><HR><H3
  31297. CLASS="sect2"
  31298. ><A
  31299. NAME="security.cgi-bin.doc-root"
  31300. ></A
  31301. >Case 3: setting doc_root or user_dir</H3
  31302. ><P
  31303. >      To include active content, like scripts and executables, in the
  31304.      web server document directories is sometimes considered an insecure
  31305.      practice.  If, because of some configuration mistake, the scripts
  31306.      are not executed but displayed as regular HTML documents, this
  31307.      may result in leakage of intellectual property or security
  31308.      information like passwords.  Therefore many sysadmins will prefer
  31309.      setting up another directory structure for scripts that are
  31310.      accessible only through the PHP CGI, and therefore always
  31311.      interpreted and not displayed as such.
  31312.     </P
  31313. ><P
  31314. >      Also if the method for making sure the requests are not
  31315.      redirected, as described in the previous section, is not
  31316.      available, it is necessary to set up a script doc_root that is
  31317.      different from web document root.
  31318.     </P
  31319. ><P
  31320. >      You can set the PHP script document root by the configuration
  31321.      directive <A
  31322. HREF="#ini.doc-root"
  31323. >doc_root</A
  31324. > in the
  31325.      <A
  31326. HREF="#configuration.file"
  31327. >configuration file</A
  31328. >, or
  31329.      you can set the environment variable
  31330.      <TT
  31331. CLASS="envar"
  31332. >PHP_DOCUMENT_ROOT</TT
  31333. >.  If it is set, the CGI version
  31334.      of PHP will always construct the file name to open with this
  31335.      <TT
  31336. CLASS="parameter"
  31337. ><I
  31338. >doc_root</I
  31339. ></TT
  31340. > and the path information in the
  31341.      request, so you can be sure no script is executed outside this
  31342.      directory (except for <TT
  31343. CLASS="parameter"
  31344. ><I
  31345. >user_dir</I
  31346. ></TT
  31347. >
  31348.      below).
  31349.     </P
  31350. ><P
  31351. >      Another option usable here is <A
  31352. HREF="#ini.user-dir"
  31353. >user_dir</A
  31354. >.  When user_dir is unset,
  31355.      only thing controlling the opened file name is
  31356.      <TT
  31357. CLASS="parameter"
  31358. ><I
  31359. >doc_root</I
  31360. ></TT
  31361. >.  Opening an url like <TT
  31362. CLASS="filename"
  31363. >http://my.host/~user/doc.php</TT
  31364. > does not
  31365.      result in opening a file under users home directory, but a file
  31366.      called <TT
  31367. CLASS="filename"
  31368. >~user/doc.php</TT
  31369. > under
  31370.      doc_root (yes, a directory name starting with a tilde
  31371.      [<TT
  31372. CLASS="literal"
  31373. >~</TT
  31374. >]).
  31375.     </P
  31376. ><P
  31377. >      If user_dir is set to for example <TT
  31378. CLASS="filename"
  31379. >public_php</TT
  31380. >, a request like <TT
  31381. CLASS="filename"
  31382. >http://my.host/~user/doc.php</TT
  31383. > will open a
  31384.      file called <TT
  31385. CLASS="filename"
  31386. >doc.php</TT
  31387. > under the directory
  31388.      named <TT
  31389. CLASS="filename"
  31390. >public_php</TT
  31391. > under the home
  31392.      directory of the user.  If the home of the user is <TT
  31393. CLASS="filename"
  31394. >/home/user</TT
  31395. >, the file executed is
  31396.      <TT
  31397. CLASS="filename"
  31398. >/home/user/public_php/doc.php</TT
  31399. >.
  31400.     </P
  31401. ><P
  31402. >      <TT
  31403. CLASS="parameter"
  31404. ><I
  31405. >user_dir</I
  31406. ></TT
  31407. > expansion happens regardless of
  31408.      the <TT
  31409. CLASS="parameter"
  31410. ><I
  31411. >doc_root</I
  31412. ></TT
  31413. > setting, so you can control
  31414.      the document root and user directory access
  31415.      separately.
  31416.     </P
  31417. ></DIV
  31418. ><DIV
  31419. CLASS="sect2"
  31420. ><HR><H3
  31421. CLASS="sect2"
  31422. ><A
  31423. NAME="security.cgi-bin.shell"
  31424. ></A
  31425. >Case 4: PHP parser outside of web tree</H3
  31426. ><P
  31427. >      A very secure option is to put the PHP parser binary somewhere
  31428.      outside of the web tree of files.  In <TT
  31429. CLASS="filename"
  31430. >/usr/local/bin</TT
  31431. >, for example.  The only real
  31432.      downside to this option is that you will now have to put a line
  31433.      similar to:
  31434.      <DIV
  31435. CLASS="informalexample"
  31436. ><A
  31437. NAME="AEN5800"
  31438. ></A
  31439. ><P
  31440. ></P
  31441. ><TABLE
  31442. BORDER="0"
  31443. BGCOLOR="#E0E0E0"
  31444. CELLPADDING="5"
  31445. ><TR
  31446. ><TD
  31447. ><PRE
  31448. CLASS="programlisting"
  31449. >#!/usr/local/bin/php</PRE
  31450. ></TD
  31451. ></TR
  31452. ></TABLE
  31453. ><P
  31454. ></P
  31455. ></DIV
  31456. >
  31457.      as the first line of any file containing PHP tags.  You will also
  31458.      need to make the file executable.  That is, treat it exactly as
  31459.      you would treat any other CGI script written in Perl or sh or any
  31460.      other common scripting language which uses the
  31461.      <TT
  31462. CLASS="literal"
  31463. >#!</TT
  31464. > shell-escape mechanism for launching
  31465.      itself.
  31466.     </P
  31467. ><P
  31468. >      To get PHP to handle <TT
  31469. CLASS="envar"
  31470. >PATH_INFO</TT
  31471. > and
  31472.      <TT
  31473. CLASS="envar"
  31474. >PATH_TRANSLATED</TT
  31475. > information correctly with this
  31476.      setup, the PHP parser should be compiled with the <A
  31477. HREF="#install.configure.enable-discard-path"
  31478. >--enable-discard-path</A
  31479. >
  31480.      configure option.
  31481.     </P
  31482. ></DIV
  31483. ></DIV
  31484. ><DIV
  31485. CLASS="sect1"
  31486. ><HR><H2
  31487. CLASS="sect1"
  31488. ><A
  31489. NAME="security.apache"
  31490. ></A
  31491. >Installed as an Apache module</H2
  31492. ><P
  31493. >     When PHP is used as an Apache module it inherits Apache's user
  31494.     permissions (typically those of the "nobody" user). This has several
  31495.     impacts on security and authorization. For example, if you are using
  31496.     PHP to access a database, unless that database has built-in access
  31497.     control, you will have to make the database accessible to the
  31498.     "nobody" user. This means a malicious script could access and modify
  31499.     the database, even without a username and password. It's entirely
  31500.     possible that a web spider could stumble across a database
  31501.     administrator's web page, and drop all of your databases. You can
  31502.     protect against this with Apache authorization, or you can design
  31503.     your own access model using LDAP, <TT
  31504. CLASS="filename"
  31505. >.htaccess</TT
  31506. > files, etc. and include
  31507.     that code as part of your PHP scripts.
  31508.    </P
  31509. ><P
  31510. >     Often, once security is established to the point where the PHP user
  31511.     (in this case, the apache user) has very little risk attached to it,
  31512.     it is discovered that PHP is now prevented from writing any files
  31513.     to user directories. Or perhaps it has been prevented from accessing
  31514.     or changing databases. It has equally been secured from writing
  31515.     good and bad files, or entering good and bad database transactions.
  31516.    </P
  31517. ><P
  31518. >     A frequent security mistake made at this point is to allow apache
  31519.     root permissions, or to escalate apache's abilitites in some other
  31520.     way.
  31521.    </P
  31522. ><P
  31523. >     Escalating the Apache user's permissions to root is extremely
  31524.     dangerous and may compromise the entire system, so sudo'ing,
  31525.     chroot'ing, or otherwise running as root should not be considered by
  31526.     those who are not security professionals.
  31527.    </P
  31528. ><P
  31529. >     There are some simpler solutions. By using
  31530.     <A
  31531. HREF="#ini.open-basedir"
  31532. >open_basedir</A
  31533. > you can control and restrict what
  31534.     directories are allowed to be used for PHP. You can also set up
  31535.     apache-only areas, to restrict all web based activity to non-user,
  31536.     or non-system, files.
  31537.    </P
  31538. ></DIV
  31539. ><DIV
  31540. CLASS="sect1"
  31541. ><HR><H2
  31542. CLASS="sect1"
  31543. ><A
  31544. NAME="security.filesystem"
  31545. ></A
  31546. >Filesystem Security</H2
  31547. ><P
  31548. >     PHP is subject to the security built into most server systems with
  31549.     respect to permissions on a file and directory basis. This allows
  31550.     you to control which files in the filesystem may be read. Care
  31551.     should be taken with any files which are world readable to ensure
  31552.     that they are safe for reading by all users who have access to that
  31553.     filesystem.
  31554.    </P
  31555. ><P
  31556. >     Since PHP was designed to allow user level access to the filesystem,
  31557.     it's entirely possible to write a PHP script that will allow you
  31558.     to read system files such as /etc/passwd, modify your ethernet
  31559.     connections, send massive printer jobs out, etc. This has some
  31560.     obvious implications, in that you need to ensure that the files
  31561.     that you read from and write to are the appropriate ones.
  31562.    </P
  31563. ><P
  31564. >     Consider the following script, where a user indicates that they'd
  31565.     like to delete a file in their home directory. This assumes a
  31566.     situation where a PHP web interface is regularly used for file
  31567.     management, so the Apache user is allowed to delete files in
  31568.     the user home directories.
  31569.    </P
  31570. ><P
  31571. >     <TABLE
  31572. WIDTH="100%"
  31573. BORDER="0"
  31574. CELLPADDING="0"
  31575. CELLSPACING="0"
  31576. CLASS="EXAMPLE"
  31577. ><TR
  31578. ><TD
  31579. ><DIV
  31580. CLASS="example"
  31581. ><A
  31582. NAME="AEN5822"
  31583. ></A
  31584. ><P
  31585. ><B
  31586. >P°φklad 15-1. Poor variable checking leads to....</B
  31587. ></P
  31588. ><TABLE
  31589. BORDER="0"
  31590. BGCOLOR="#E0E0E0"
  31591. CELLPADDING="5"
  31592. ><TR
  31593. ><TD
  31594. ><PRE
  31595. CLASS="php"
  31596. ><?php
  31597. // remove a file from the user's home directory
  31598. $username = $_POST['user_submitted_name'];
  31599. $homedir = "/home/$username";
  31600. $file_to_delete = "$userfile";
  31601. unlink ("$homedir/$userfile");
  31602. echo "$file_to_delete has been deleted!";
  31603. ?></PRE
  31604. ></TD
  31605. ></TR
  31606. ></TABLE
  31607. ></DIV
  31608. ></TD
  31609. ></TR
  31610. ></TABLE
  31611. >
  31612.    Since the username is postable from a user form, they can submit
  31613.    a username and file belonging to someone else, and delete files.
  31614.    In this case, you'd want to use some other form of authentication.
  31615.    Consider what could happen if the variables submitted were
  31616.    "../etc/" and "passwd". The code would then effectively read:
  31617.     <TABLE
  31618. WIDTH="100%"
  31619. BORDER="0"
  31620. CELLPADDING="0"
  31621. CELLSPACING="0"
  31622. CLASS="EXAMPLE"
  31623. ><TR
  31624. ><TD
  31625. ><DIV
  31626. CLASS="example"
  31627. ><A
  31628. NAME="AEN5825"
  31629. ></A
  31630. ><P
  31631. ><B
  31632. >P°φklad 15-2. ... A filesystem attack</B
  31633. ></P
  31634. ><TABLE
  31635. BORDER="0"
  31636. BGCOLOR="#E0E0E0"
  31637. CELLPADDING="5"
  31638. ><TR
  31639. ><TD
  31640. ><PRE
  31641. CLASS="php"
  31642. ><?php
  31643. // removes a file from anywhere on the hard drive that
  31644. // the PHP user has access to. If PHP has root access:
  31645. $username = "../etc/";
  31646. $homedir = "/home/../etc/";
  31647. $file_to_delete = "passwd";
  31648. unlink ("/home/../etc/passwd");
  31649. echo "/home/../etc/passwd has been deleted!";
  31650. ?></PRE
  31651. ></TD
  31652. ></TR
  31653. ></TABLE
  31654. ></DIV
  31655. ></TD
  31656. ></TR
  31657. ></TABLE
  31658. >
  31659.     There are two important measures you should take to prevent these
  31660.     issues.
  31661.     <P
  31662. ></P
  31663. ><UL
  31664. ><LI
  31665. ><P
  31666. >        Only allow limited permissions to the PHP web user binary.
  31667.       </P
  31668. ></LI
  31669. ><LI
  31670. ><P
  31671. >        Check all variables which are submitted.
  31672.       </P
  31673. ></LI
  31674. ></UL
  31675. >
  31676.     Here is an improved script:
  31677.     <TABLE
  31678. WIDTH="100%"
  31679. BORDER="0"
  31680. CELLPADDING="0"
  31681. CELLSPACING="0"
  31682. CLASS="EXAMPLE"
  31683. ><TR
  31684. ><TD
  31685. ><DIV
  31686. CLASS="example"
  31687. ><A
  31688. NAME="AEN5833"
  31689. ></A
  31690. ><P
  31691. ><B
  31692. >P°φklad 15-3. More secure file name checking</B
  31693. ></P
  31694. ><TABLE
  31695. BORDER="0"
  31696. BGCOLOR="#E0E0E0"
  31697. CELLPADDING="5"
  31698. ><TR
  31699. ><TD
  31700. ><PRE
  31701. CLASS="php"
  31702. ><?php
  31703. // removes a file from the hard drive that
  31704. // the PHP user has access to.
  31705. $username = $_SERVER['REMOTE_USER']; // using an authentication mechanisim
  31706.  
  31707. $homedir = "/home/$username";
  31708.  
  31709. $file_to_delete = basename("$userfile"); // strip paths
  31710. unlink ($homedir/$file_to_delete);
  31711.  
  31712. $fp = fopen("/home/logging/filedelete.log","+a"); //log the deletion
  31713. $logstring = "$username $homedir $file_to_delete";
  31714. fputs ($fp, $logstring);
  31715. fclose($fp);
  31716.  
  31717. echo "$file_to_delete has been deleted!";
  31718. ?></PRE
  31719. ></TD
  31720. ></TR
  31721. ></TABLE
  31722. ></DIV
  31723. ></TD
  31724. ></TR
  31725. ></TABLE
  31726. >
  31727.     However, even this is not without it's flaws. If your authentication
  31728.     system allowed users to create their own user logins, and a user
  31729.     chose the login "../etc/", the system is once again exposed. For
  31730.     this reason, you may prefer to write a more customized check:
  31731.     <TABLE
  31732. WIDTH="100%"
  31733. BORDER="0"
  31734. CELLPADDING="0"
  31735. CELLSPACING="0"
  31736. CLASS="EXAMPLE"
  31737. ><TR
  31738. ><TD
  31739. ><DIV
  31740. CLASS="example"
  31741. ><A
  31742. NAME="AEN5836"
  31743. ></A
  31744. ><P
  31745. ><B
  31746. >P°φklad 15-4. More secure file name checking</B
  31747. ></P
  31748. ><TABLE
  31749. BORDER="0"
  31750. BGCOLOR="#E0E0E0"
  31751. CELLPADDING="5"
  31752. ><TR
  31753. ><TD
  31754. ><PRE
  31755. CLASS="php"
  31756. ><?php
  31757. $username = $_SERVER['REMOTE_USER']; // using an authentication mechanisim
  31758. $homedir = "/home/$username";
  31759.  
  31760. if (!ereg('^[^./][^/]*$', $userfile))
  31761.      die('bad filename'); //die, do not process
  31762.  
  31763. if (!ereg('^[^./][^/]*$', $username))
  31764.      die('bad username'); //die, do not process
  31765. //etc...
  31766. ?></PRE
  31767. ></TD
  31768. ></TR
  31769. ></TABLE
  31770. ></DIV
  31771. ></TD
  31772. ></TR
  31773. ></TABLE
  31774. >
  31775.    </P
  31776. ><P
  31777. >     Depending on your operating system, there are a wide variety of files
  31778.     which you should be concerned about, including device entries (/dev/
  31779.     or COM1), configuration files (/etc/ files and the .ini files),
  31780.     well known file storage areas (/home/, My Documents), etc. For this
  31781.     reason, it's usually easier to create a policy where you forbid
  31782.     everything except for what you explicitly allow.
  31783.    </P
  31784. ></DIV
  31785. ><DIV
  31786. CLASS="sect1"
  31787. ><HR><H2
  31788. CLASS="sect1"
  31789. ><A
  31790. NAME="security.database"
  31791. ></A
  31792. >Database Security</H2
  31793. ><P
  31794. >     Nowadays, databases are cardinal components of any web based application by
  31795.     enabling websites to provide varying dynamic content. Since very sensitive
  31796.     or secret information can be stored in a database, you should strongly
  31797.     consider protecting your databases.
  31798.    </P
  31799. ><P
  31800. >     To retrieve or to store any information you need to connect to the database,
  31801.     send a legitimate query, fetch the result, and close the connection.
  31802.     Nowadays, the commonly used query language in this interaction is the
  31803.     Structured Query Language (SQL). See how an attacker can <A
  31804. HREF="#security.database.sql-injection"
  31805. >tamper with an SQL query</A
  31806. >.
  31807.    </P
  31808. ><P
  31809. >     As you can surmise, PHP cannot protect your database by itself. The
  31810.     following sections aim to be an introduction into the very basics of how to
  31811.     access and manipulate databases within PHP scripts.
  31812.    </P
  31813. ><P
  31814. >     Keep in mind this simple rule: defense in depth. The more places you
  31815.     take action to increase the protection of your database, the less
  31816.     probability of an attacker succeeding in exposing or abusing any stored
  31817.     information. Good design of the database schema and the application
  31818.     deals with your greatest fears.
  31819.    </P
  31820. ><DIV
  31821. CLASS="sect2"
  31822. ><HR><H3
  31823. CLASS="sect2"
  31824. ><A
  31825. NAME="security.database.design"
  31826. ></A
  31827. >Designing Databases</H3
  31828. ><P
  31829. >       The first step is always to create the database, unless you want to use
  31830.       one from a third party. When a database is created, it is
  31831.       assigned to an owner, who executed the creation statement. Usually, only
  31832.       the owner (or a superuser) can do anything with the objects in that
  31833.       database, and in order to allow other users to use it, privileges must be
  31834.       granted.
  31835.      </P
  31836. ><P
  31837. >       Applications should never connect to the database as its owner or a
  31838.       superuser, because these users can execute any query at will, for
  31839.       example, modifying the schema (e.g. dropping tables) or deleting its
  31840.       entire content.
  31841.      </P
  31842. ><P
  31843. >       You may create different database users for every aspect of your
  31844.       application with very limited rights to database objects. The most
  31845.       required privileges should be granted only, and avoid that the same user
  31846.       can interact with the database in different use cases. This means that if
  31847.       intruders gain access to your database using your applications credentials,
  31848.       they can only effect as many changes as your application can.
  31849.      </P
  31850. ><P
  31851. >       You are encouraged not to implement all the business logic in the web
  31852.       application (i.e. your script), instead do it in the database schema
  31853.       using views, triggers or rules. If the system evolves, new ports will be
  31854.       intended to open to the database, and you have to re-implement the logic
  31855.       in each separate database client. Over and above, triggers can be used
  31856.       to transparently and automatically handle fields, which often provides
  31857.       insight when debugging problems with your application or tracing back
  31858.       transactions.
  31859.      </P
  31860. ></DIV
  31861. ><DIV
  31862. CLASS="sect2"
  31863. ><HR><H3
  31864. CLASS="sect2"
  31865. ><A
  31866. NAME="security.database.connection"
  31867. ></A
  31868. >Connecting to Database</H3
  31869. ><P
  31870. >      You may want to estabilish the connections over SSL to encrypt
  31871.      client/server communications for increased security, or you can use ssh
  31872.      to encrypt the network connection between clients and the database server.
  31873.      If either of these is used, then monitoring your traffic and gaining
  31874.      information about your database will be difficult for a would-be attacker.
  31875.     </P
  31876. ></DIV
  31877. ><DIV
  31878. CLASS="sect2"
  31879. ><HR><H3
  31880. CLASS="sect2"
  31881. ><A
  31882. NAME="security.database.storage"
  31883. ></A
  31884. >Encrypted Storage Model</H3
  31885. ><P
  31886. >      SSL/SSH protects data travelling from the client to the server, SSL/SSH
  31887.      does not protect the persistent data stored in a database. SSL is an
  31888.      on-the-wire protocol.
  31889.     </P
  31890. ><P
  31891. >      Once an attacker gains access to your database directly (bypassing the
  31892.      webserver), the stored sensitive data may be exposed or misused, unless
  31893.      the information is protected by the database itself. Encrypting the data
  31894.      is a good way to mitigate this threat, but very few databases offer this
  31895.      type of data encryption.
  31896.     </P
  31897. ><P
  31898. >      The easiest way to work around this problem is to first create your own
  31899.      encryption package, and then use it from within your PHP scripts. PHP
  31900.      can assist you in this with several extensions, such as <A
  31901. HREF="#ref.mcrypt"
  31902. >Mcrypt</A
  31903. > and <A
  31904. HREF="#ref.mhash"
  31905. >Mhash</A
  31906. >, covering a wide variety of encryption
  31907.      algorithms. The script encrypts the data before inserting it into the database, and decrypts
  31908.      it when retrieving. See the references for further examples of how
  31909.      encryption works.
  31910.     </P
  31911. ><P
  31912. >      In case of truly hidden data, if its raw representation is not needed
  31913.      (i.e. not be displayed), hashing may also be taken into consideration.
  31914.      The well-known example for the hashing is storing the MD5 hash of a
  31915.      password in a database, instead of the password itself. See also
  31916.      <A
  31917. HREF="#function.crypt"
  31918. ><B
  31919. CLASS="function"
  31920. >crypt()</B
  31921. ></A
  31922. > and <A
  31923. HREF="#function.md5"
  31924. ><B
  31925. CLASS="function"
  31926. >md5()</B
  31927. ></A
  31928. >.
  31929.     </P
  31930. ><TABLE
  31931. WIDTH="100%"
  31932. BORDER="0"
  31933. CELLPADDING="0"
  31934. CELLSPACING="0"
  31935. CLASS="EXAMPLE"
  31936. ><TR
  31937. ><TD
  31938. ><DIV
  31939. CLASS="example"
  31940. ><A
  31941. NAME="AEN5866"
  31942. ></A
  31943. ><P
  31944. ><B
  31945. >P°φklad 15-5. Using hashed password field</B
  31946. ></P
  31947. ><TABLE
  31948. BORDER="0"
  31949. BGCOLOR="#E0E0E0"
  31950. CELLPADDING="5"
  31951. ><TR
  31952. ><TD
  31953. ><PRE
  31954. CLASS="php"
  31955. >// storing password hash
  31956. $query  = sprintf("INSERT INTO users(name,pwd) VALUES('%s','%s');",
  31957.             addslashes($username), md5($password));
  31958. $result = pg_exec($connection, $query);
  31959.  
  31960. // querying if user submitted the right password
  31961. $query = sprintf("SELECT 1 FROM users WHERE name='%s' AND pwd='%s';",
  31962.             addslashes($username), md5($password));
  31963. $result = pg_exec($connection, $query);
  31964.  
  31965. if (pg_numrows($result) > 0) {
  31966.     echo "Welcome, $username!";
  31967. }
  31968. else {
  31969.     echo "Authentication failed for $username.";
  31970. }</PRE
  31971. ></TD
  31972. ></TR
  31973. ></TABLE
  31974. ></DIV
  31975. ></TD
  31976. ></TR
  31977. ></TABLE
  31978. ></DIV
  31979. ><DIV
  31980. CLASS="sect2"
  31981. ><HR><H3
  31982. CLASS="sect2"
  31983. ><A
  31984. NAME="security.database.sql-injection"
  31985. ></A
  31986. >SQL Injection</H3
  31987. ><P
  31988. >      Many web developers are unaware of how SQL queries can be tampered with,
  31989.      and assume that an SQL query is a trusted command. It means that SQL
  31990.      queries are able to circumvent access controls, thereby bypassing standard
  31991.      authentication and authorization checks, and sometimes SQL queries even
  31992.      may allow access to host operating system level commands.
  31993.     </P
  31994. ><P
  31995. >      Direct SQL Command Injection is a technique where an attacker creates or
  31996.      alters existing SQL commands to expose hidden data, or to override valuable
  31997.      ones, or even to execute dangerous system level commands on the database
  31998.      host. This is accomplished by the application taking user input and
  31999.      combining it with static parameters to build a SQL query. The following
  32000.      examples are based on true stories, unfortunately.
  32001.     </P
  32002. ><P
  32003. >      Owing to the lack of input validation and connecting to the database on
  32004.      behalf of a superuser or the one who can create users, the attacker
  32005.      may create a superuser in your database.
  32006.      <TABLE
  32007. WIDTH="100%"
  32008. BORDER="0"
  32009. CELLPADDING="0"
  32010. CELLSPACING="0"
  32011. CLASS="EXAMPLE"
  32012. ><TR
  32013. ><TD
  32014. ><DIV
  32015. CLASS="example"
  32016. ><A
  32017. NAME="AEN5874"
  32018. ></A
  32019. ><P
  32020. ><B
  32021. >P°φklad 15-6. 
  32022.        Splitting the result set into pages ... and making superusers
  32023.        (PostgreSQL and MySQL)
  32024.       </B
  32025. ></P
  32026. ><TABLE
  32027. BORDER="0"
  32028. BGCOLOR="#E0E0E0"
  32029. CELLPADDING="5"
  32030. ><TR
  32031. ><TD
  32032. ><PRE
  32033. CLASS="php"
  32034. >$offset = argv[0]; // beware, no input validation!
  32035. $query  = "SELECT id, name FROM products ORDER BY name LIMIT 20 OFFSET $offset;";
  32036. // with PostgreSQL 
  32037. $result = pg_exec($conn, $query);
  32038. // with MySQL
  32039. $result = mysql_query($query);</PRE
  32040. ></TD
  32041. ></TR
  32042. ></TABLE
  32043. ></DIV
  32044. ></TD
  32045. ></TR
  32046. ></TABLE
  32047. >
  32048.       Normal users click on the 'next', 'prev' links where the <TT
  32049. CLASS="varname"
  32050. >$offset</TT
  32051. >
  32052.       is encoded into the URL. The script expects that the incoming
  32053.       <TT
  32054. CLASS="varname"
  32055. >$offset</TT
  32056. > is a decimal number. However, what if someone tries to
  32057.       break in by appending a <A
  32058. HREF="#function.urlencode"
  32059. ><B
  32060. CLASS="function"
  32061. >urlencode()</B
  32062. ></A
  32063. >'d form of the
  32064.       following to the URL 
  32065.       <DIV
  32066. CLASS="informalexample"
  32067. ><A
  32068. NAME="AEN5880"
  32069. ></A
  32070. ><P
  32071. ></P
  32072. ><TABLE
  32073. BORDER="0"
  32074. BGCOLOR="#E0E0E0"
  32075. CELLPADDING="5"
  32076. ><TR
  32077. ><TD
  32078. ><PRE
  32079. CLASS="programlisting"
  32080. >// in case of PostgreSQL
  32081. 0;
  32082. insert into pg_shadow(usename,usesysid,usesuper,usecatupd,passwd)
  32083.     select 'crack', usesysid, 't','t','crack'
  32084.     from pg_shadow where usename='postgres';
  32085. --
  32086.  
  32087. // in case of MySQL
  32088. 0;
  32089. UPDATE user SET Password=PASSWORD('crack') WHERE user='root';
  32090. FLUSH PRIVILEGES;</PRE
  32091. ></TD
  32092. ></TR
  32093. ></TABLE
  32094. ><P
  32095. ></P
  32096. ></DIV
  32097. >
  32098.       If it happened, then the script would present a superuser access to him.
  32099.       Note that <TT
  32100. CLASS="literal"
  32101. >0;</TT
  32102. > is to supply a valid offset to the
  32103.       original query and to terminate it.
  32104.     </P
  32105. ><DIV
  32106. CLASS="note"
  32107. ><BLOCKQUOTE
  32108. CLASS="note"
  32109. ><P
  32110. ><B
  32111. >Poznßmka: </B
  32112. >
  32113.       It is common technique to force the SQL parser to ignore the rest of the
  32114.       query written by the developer with <TT
  32115. CLASS="literal"
  32116. >--</TT
  32117. > which is the
  32118.       comment sign in SQL.
  32119.      </P
  32120. ></BLOCKQUOTE
  32121. ></DIV
  32122. ><P
  32123. >      A feasible way to gain passwords is to circumvent your search result pages.
  32124.      The only thing the attacker needs to do is to see if there are any submitted variables
  32125.      used in SQL statements which are not handled properly. These filters can be set
  32126.      commonly in a preceding form to customize <TT
  32127. CLASS="literal"
  32128. >WHERE, ORDER BY, 
  32129.      LIMIT</TT
  32130. > and <TT
  32131. CLASS="literal"
  32132. >OFFSET</TT
  32133. > clauses in <TT
  32134. CLASS="literal"
  32135. >SELECT</TT
  32136. >
  32137.      statements. If your database supports the <TT
  32138. CLASS="literal"
  32139. >UNION</TT
  32140. > construct, 
  32141.      the attacker may try to append an entire query to the original one to list 
  32142.      passwords from an arbitrary table. Using encrypted password fields is 
  32143.      strongly encouraged.
  32144.      <TABLE
  32145. WIDTH="100%"
  32146. BORDER="0"
  32147. CELLPADDING="0"
  32148. CELLSPACING="0"
  32149. CLASS="EXAMPLE"
  32150. ><TR
  32151. ><TD
  32152. ><DIV
  32153. CLASS="example"
  32154. ><A
  32155. NAME="AEN5891"
  32156. ></A
  32157. ><P
  32158. ><B
  32159. >P°φklad 15-7. 
  32160.        Listing out articles ... and some passwords (any database server)
  32161.       </B
  32162. ></P
  32163. ><TABLE
  32164. BORDER="0"
  32165. BGCOLOR="#E0E0E0"
  32166. CELLPADDING="5"
  32167. ><TR
  32168. ><TD
  32169. ><PRE
  32170. CLASS="php"
  32171. >$query  = "SELECT id, name, inserted, size FROM products
  32172.                   WHERE size = '$size'
  32173.                   ORDER BY $order LIMIT $limit, $offset;";
  32174. $result = odbc_exec($conn, $query);</PRE
  32175. ></TD
  32176. ></TR
  32177. ></TABLE
  32178. ></DIV
  32179. ></TD
  32180. ></TR
  32181. ></TABLE
  32182. >
  32183.      The static part of the query can be combined with another
  32184.      <TT
  32185. CLASS="literal"
  32186. >SELECT</TT
  32187. > statement which reveals all passwords:
  32188.      <DIV
  32189. CLASS="informalexample"
  32190. ><A
  32191. NAME="AEN5895"
  32192. ></A
  32193. ><P
  32194. ></P
  32195. ><TABLE
  32196. BORDER="0"
  32197. BGCOLOR="#E0E0E0"
  32198. CELLPADDING="5"
  32199. ><TR
  32200. ><TD
  32201. ><PRE
  32202. CLASS="programlisting"
  32203. >'
  32204. union select '1', concat(uname||'-'||passwd) as name, '1971-01-01', '0' from usertable;
  32205. --</PRE
  32206. ></TD
  32207. ></TR
  32208. ></TABLE
  32209. ><P
  32210. ></P
  32211. ></DIV
  32212. >
  32213.      If this query (playing with the <TT
  32214. CLASS="literal"
  32215. >'</TT
  32216. > and
  32217.      <TT
  32218. CLASS="literal"
  32219. >--</TT
  32220. >) were assigned to one of the variables used in
  32221.      <TT
  32222. CLASS="varname"
  32223. >$query</TT
  32224. >, the query beast awakened.
  32225.     </P
  32226. ><P
  32227. >      SQL UPDATE's are also susceptible to attack. These queries are
  32228.      also threatened by chopping and appending an entirely new query to it. But
  32229.      the attacker might fiddle with the <TT
  32230. CLASS="literal"
  32231. >SET</TT
  32232. > clause. In this
  32233.      case some schema information must be possessed to manipulate the query
  32234.      successfully. This can be acquired by examining the form variable names, or
  32235.      just simply brute forcing. There are not so many naming conventions for
  32236.      fields storing passwords or usernames.
  32237.      <TABLE
  32238. WIDTH="100%"
  32239. BORDER="0"
  32240. CELLPADDING="0"
  32241. CELLSPACING="0"
  32242. CLASS="EXAMPLE"
  32243. ><TR
  32244. ><TD
  32245. ><DIV
  32246. CLASS="example"
  32247. ><A
  32248. NAME="AEN5902"
  32249. ></A
  32250. ><P
  32251. ><B
  32252. >P°φklad 15-8. 
  32253.       From resetting a password ... to gaining more privileges (any database server)
  32254.      </B
  32255. ></P
  32256. ><TABLE
  32257. BORDER="0"
  32258. BGCOLOR="#E0E0E0"
  32259. CELLPADDING="5"
  32260. ><TR
  32261. ><TD
  32262. ><PRE
  32263. CLASS="php"
  32264. >$query = "UPDATE usertable SET pwd='$pwd' WHERE uid='$uid';";</PRE
  32265. ></TD
  32266. ></TR
  32267. ></TABLE
  32268. ></DIV
  32269. ></TD
  32270. ></TR
  32271. ></TABLE
  32272. >
  32273.      But a malicious user sumbits the value
  32274.      <TT
  32275. CLASS="literal"
  32276. >' or uid like'%admin%'; --</TT
  32277. > to <TT
  32278. CLASS="varname"
  32279. >$uid</TT
  32280. > to
  32281.      change the admin's password, or simply sets <TT
  32282. CLASS="varname"
  32283. >$pwd</TT
  32284. > to
  32285.      <TT
  32286. CLASS="literal"
  32287. >"hehehe', admin='yes', trusted=100 "</TT
  32288. > (with a trailing
  32289.      space) to gain more privileges. Then, the query will be twisted:
  32290.      <DIV
  32291. CLASS="informalexample"
  32292. ><A
  32293. NAME="AEN5909"
  32294. ></A
  32295. ><P
  32296. ></P
  32297. ><TABLE
  32298. BORDER="0"
  32299. BGCOLOR="#E0E0E0"
  32300. CELLPADDING="5"
  32301. ><TR
  32302. ><TD
  32303. ><PRE
  32304. CLASS="php"
  32305. >// $uid == ' or uid like'%admin%'; --
  32306. $query = "UPDATE usertable SET pwd='...' WHERE uid='' or uid like '%admin%'; --";
  32307.  
  32308. // $pwd == "hehehe', admin='yes', trusted=100 "
  32309. $query = "UPDATE usertable SET pwd='hehehe', admin='yes', trusted=100 WHERE ...;"</PRE
  32310. ></TD
  32311. ></TR
  32312. ></TABLE
  32313. ><P
  32314. ></P
  32315. ></DIV
  32316. >
  32317.     </P
  32318. ><P
  32319. >      A frightening example how operating system level commands can be accessed
  32320.      on some database hosts.
  32321.      <TABLE
  32322. WIDTH="100%"
  32323. BORDER="0"
  32324. CELLPADDING="0"
  32325. CELLSPACING="0"
  32326. CLASS="EXAMPLE"
  32327. ><TR
  32328. ><TD
  32329. ><DIV
  32330. CLASS="example"
  32331. ><A
  32332. NAME="AEN5912"
  32333. ></A
  32334. ><P
  32335. ><B
  32336. >P°φklad 15-9. Attacking the database hosts operating system (MSSQL Server)</B
  32337. ></P
  32338. ><TABLE
  32339. BORDER="0"
  32340. BGCOLOR="#E0E0E0"
  32341. CELLPADDING="5"
  32342. ><TR
  32343. ><TD
  32344. ><PRE
  32345. CLASS="php"
  32346. >$query  = "SELECT * FROM products WHERE id LIKE '%$prod%'";
  32347. $result = mssql_query($query);</PRE
  32348. ></TD
  32349. ></TR
  32350. ></TABLE
  32351. ></DIV
  32352. ></TD
  32353. ></TR
  32354. ></TABLE
  32355. >
  32356.      If attacker submits the value
  32357.      <TT
  32358. CLASS="literal"
  32359. >a%' exec master..xp_cmdshell 'net user test testpass /ADD' --</TT
  32360. >
  32361.      to <TT
  32362. CLASS="varname"
  32363. >$prod</TT
  32364. >, then the <TT
  32365. CLASS="varname"
  32366. >$query</TT
  32367. > will be:
  32368.      <DIV
  32369. CLASS="informalexample"
  32370. ><A
  32371. NAME="AEN5918"
  32372. ></A
  32373. ><P
  32374. ></P
  32375. ><TABLE
  32376. BORDER="0"
  32377. BGCOLOR="#E0E0E0"
  32378. CELLPADDING="5"
  32379. ><TR
  32380. ><TD
  32381. ><PRE
  32382. CLASS="php"
  32383. >$query  = "SELECT * FROM products
  32384.                     WHERE id LIKE '%a%'
  32385.                     exec master..xp_cmdshell 'net user test testpass /ADD'--";
  32386. $result = mssql_query($query);</PRE
  32387. ></TD
  32388. ></TR
  32389. ></TABLE
  32390. ><P
  32391. ></P
  32392. ></DIV
  32393. >
  32394.      MSSQL Server executes the SQL statements in the batch including a command
  32395.      to add a new user to the local accounts database. If this application
  32396.      were running as <TT
  32397. CLASS="literal"
  32398. >sa</TT
  32399. > and the MSSQLSERVER service is
  32400.      running with sufficient privileges, the attacker would now have an
  32401.      account with which to access this machine.
  32402.     </P
  32403. ><DIV
  32404. CLASS="note"
  32405. ><BLOCKQUOTE
  32406. CLASS="note"
  32407. ><P
  32408. ><B
  32409. >Poznßmka: </B
  32410. >
  32411.       Some of the examples above is tied to a specific database server. This
  32412.       does not mean that a similar attack is impossible against other products.
  32413.       Your database server may be similarly vulnerable in another manner.
  32414.      </P
  32415. ></BLOCKQUOTE
  32416. ></DIV
  32417. ><DIV
  32418. CLASS="sect3"
  32419. ><HR><H4
  32420. CLASS="sect3"
  32421. ><A
  32422. NAME="security.database.avoiding"
  32423. ></A
  32424. >Avoiding techniques</H4
  32425. ><P
  32426. >       You may plead that the attacker must possess a piece of information
  32427.       about the database schema in most examples. You are right, but you
  32428.       never know when and how it can be taken out, and if it happens,
  32429.       your database may be exposed. If you are using an open source, or
  32430.       publicly available database handling package, which may belong to a
  32431.       content management system or forum, the intruders easily produce
  32432.       a copy of a piece of your code. It may be also a security risk if it
  32433.       is a poorly designed one.
  32434.      </P
  32435. ><P
  32436. >       These attacks are mainly based on exploiting the code not being written
  32437.       with security in mind. Never trust any kind of input, especially that
  32438.       which comes from the client side, even though it comes from a select box,
  32439.       a hidden input field or a cookie. The first example shows that such a
  32440.       blameless query can cause disasters.
  32441.      </P
  32442. ><P
  32443. ></P
  32444. ><UL
  32445. ><LI
  32446. ><P
  32447. >         Never connect to the database as a superuser or as the database owner.
  32448.         Use always customized users with very limited privileges.
  32449.        </P
  32450. ></LI
  32451. ><LI
  32452. ><P
  32453. >         Check if the given input has the expected data type. PHP has
  32454.         a wide range of input validating functions, from the simplest ones
  32455.         found in <A
  32456. HREF="#ref.variables"
  32457. >Variable Functions</A
  32458. > and
  32459.         in <A
  32460. HREF="#ref.ctype"
  32461. >Character Type Functions</A
  32462. >
  32463.         (e.g. <A
  32464. HREF="#function.is-numeric"
  32465. ><B
  32466. CLASS="function"
  32467. >is_numeric()</B
  32468. ></A
  32469. >, <A
  32470. HREF="#function.ctype-digit"
  32471. ><B
  32472. CLASS="function"
  32473. >ctype_digit()</B
  32474. ></A
  32475. >
  32476.         respectively) and onwards to the
  32477.         <A
  32478. HREF="#ref.pcre"
  32479. >Perl compatible Regular Expressions</A
  32480. >
  32481.         support.
  32482.        </P
  32483. ></LI
  32484. ><LI
  32485. ><P
  32486. >         If the application waits for numerical input, consider verifying data
  32487.         with <A
  32488. HREF="#function.is-numeric"
  32489. ><B
  32490. CLASS="function"
  32491. >is_numeric()</B
  32492. ></A
  32493. >, or silently change its type
  32494.         using <A
  32495. HREF="#function.settype"
  32496. ><B
  32497. CLASS="function"
  32498. >settype()</B
  32499. ></A
  32500. >, or use its numeric representation
  32501.         by <A
  32502. HREF="#function.sprintf"
  32503. ><B
  32504. CLASS="function"
  32505. >sprintf()</B
  32506. ></A
  32507. >.
  32508.         <TABLE
  32509. WIDTH="100%"
  32510. BORDER="0"
  32511. CELLPADDING="0"
  32512. CELLSPACING="0"
  32513. CLASS="EXAMPLE"
  32514. ><TR
  32515. ><TD
  32516. ><DIV
  32517. CLASS="example"
  32518. ><A
  32519. NAME="AEN5942"
  32520. ></A
  32521. ><P
  32522. ><B
  32523. >P°φklad 15-10. A more secure way to compose a query for paging</B
  32524. ></P
  32525. ><TABLE
  32526. BORDER="0"
  32527. BGCOLOR="#E0E0E0"
  32528. CELLPADDING="5"
  32529. ><TR
  32530. ><TD
  32531. ><PRE
  32532. CLASS="php"
  32533. >settype($offset, 'integer');
  32534. $query = "SELECT id, name FROM products ORDER BY name LIMIT 20 OFFSET $offset;";
  32535.  
  32536. // please note %d in the format string, using %s would be meaningless
  32537. $query = sprintf("SELECT id, name FROM products ORDER BY name LIMIT 20 OFFSET %d;",
  32538.                  $offset);</PRE
  32539. ></TD
  32540. ></TR
  32541. ></TABLE
  32542. ></DIV
  32543. ></TD
  32544. ></TR
  32545. ></TABLE
  32546. >
  32547.        </P
  32548. ></LI
  32549. ><LI
  32550. ><P
  32551. >         Quote each non numeric user input which is passed to the database with
  32552.         <A
  32553. HREF="#function.addslashes"
  32554. ><B
  32555. CLASS="function"
  32556. >addslashes()</B
  32557. ></A
  32558. > or <A
  32559. HREF="#function.addcslashes"
  32560. ><B
  32561. CLASS="function"
  32562. >addcslashes()</B
  32563. ></A
  32564. >.
  32565.         See <A
  32566. HREF="#security.database.storage"
  32567. >the first example</A
  32568. >.
  32569.         As the examples shows, quotes burnt into the static part of the query
  32570.         is not enough, and can be easily cracked.
  32571.        </P
  32572. ></LI
  32573. ><LI
  32574. ><P
  32575. >         Do not print out any database specific information, especially
  32576.         about the schema, by fair means or foul. See also <A
  32577. HREF="#security.errors"
  32578. >Error Reporting</A
  32579. > and <A
  32580. HREF="#ref.errorfunc"
  32581. >Error Handling and Logging Functions</A
  32582. >.
  32583.        </P
  32584. ></LI
  32585. ><LI
  32586. ><P
  32587. >         You may use stored procedures and previously defined cursors to abstract
  32588.         data access so that users do not directly access tables or views, but
  32589.         this solution has another impacts.
  32590.        </P
  32591. ></LI
  32592. ></UL
  32593. ><P
  32594. >       Besides these, you benefit from logging queries either within your script
  32595.       or by the database itself, if it supports logging. Obviously, the logging is unable
  32596.       to prevent any harmful attempt, but it can be helpful to trace back which
  32597.       application has been circumvented. The log is not useful by itself, but
  32598.       through the information it contains. More detail is generally better than less.
  32599.      </P
  32600. ></DIV
  32601. ></DIV
  32602. ></DIV
  32603. ><DIV
  32604. CLASS="sect1"
  32605. ><HR><H2
  32606. CLASS="sect1"
  32607. ><A
  32608. NAME="security.errors"
  32609. ></A
  32610. >Error Reporting</H2
  32611. ><P
  32612. >     With PHP security, there are two sides to error reporting. One is
  32613.     beneficial to increasing security, the other is detrimental.
  32614.    </P
  32615. ><P
  32616. >     A standard attack tactic involves profiling a system by feeding
  32617.     it improper data, and checking for the kinds, and contexts, of the
  32618.     errors which are returned. This allows the system cracker to probe
  32619.     for information about the server, to determine possible weaknesses.
  32620.     For example, if an attacker had gleaned information about a page
  32621.     based on a prior form submission, they may attempt to override
  32622.     variables, or modify them:
  32623.     <TABLE
  32624. WIDTH="100%"
  32625. BORDER="0"
  32626. CELLPADDING="0"
  32627. CELLSPACING="0"
  32628. CLASS="EXAMPLE"
  32629. ><TR
  32630. ><TD
  32631. ><DIV
  32632. CLASS="example"
  32633. ><A
  32634. NAME="AEN5961"
  32635. ></A
  32636. ><P
  32637. ><B
  32638. >P°φklad 15-11. Attacking Variables with a custom HTML page</B
  32639. ></P
  32640. ><TABLE
  32641. BORDER="0"
  32642. BGCOLOR="#E0E0E0"
  32643. CELLPADDING="5"
  32644. ><TR
  32645. ><TD
  32646. ><PRE
  32647. CLASS="php"
  32648. ><form method="POST" action="attacktarget?username=badfoo&password=badfoo">
  32649. <input type="hidden" name="username" value="badfoo">
  32650. <input type="hidden" name="password" value="badfoo">
  32651. </form></PRE
  32652. ></TD
  32653. ></TR
  32654. ></TABLE
  32655. ></DIV
  32656. ></TD
  32657. ></TR
  32658. ></TABLE
  32659. >
  32660.    </P
  32661. ><P
  32662. >     The PHP errors which are normally returned can be quite helpful to a
  32663.     developer who is trying to debug a script, indicating such things
  32664.     as the function or file that failed, the PHP file it failed in,
  32665.     and the line number which the failure occured in. This is all
  32666.     information that can be exploited.  It is not uncommon for a php
  32667.     developer to use <A
  32668. HREF="#function.show-source"
  32669. ><B
  32670. CLASS="function"
  32671. >show_source()</B
  32672. ></A
  32673. >,
  32674.     <A
  32675. HREF="#function.highlight-string"
  32676. ><B
  32677. CLASS="function"
  32678. >highlight_string()</B
  32679. ></A
  32680. >, or
  32681.     <A
  32682. HREF="#function.highlight-file"
  32683. ><B
  32684. CLASS="function"
  32685. >highlight_file()</B
  32686. ></A
  32687. > as a debugging measure, but in
  32688.     a live site, this can expose hidden variables, unchecked syntax,
  32689.     and other dangerous information. Especially dangerous is running
  32690.     code from known sources with built-in debugging handlers, or using
  32691.     common debugging techniques. If the attacker can determine what
  32692.     general technique you are using, they may try to brute-force a page,
  32693.     by sending various common debugging strings:
  32694.     <TABLE
  32695. WIDTH="100%"
  32696. BORDER="0"
  32697. CELLPADDING="0"
  32698. CELLSPACING="0"
  32699. CLASS="EXAMPLE"
  32700. ><TR
  32701. ><TD
  32702. ><DIV
  32703. CLASS="example"
  32704. ><A
  32705. NAME="AEN5968"
  32706. ></A
  32707. ><P
  32708. ><B
  32709. >P°φklad 15-12. Exploiting common debugging variables</B
  32710. ></P
  32711. ><TABLE
  32712. BORDER="0"
  32713. BGCOLOR="#E0E0E0"
  32714. CELLPADDING="5"
  32715. ><TR
  32716. ><TD
  32717. ><PRE
  32718. CLASS="php"
  32719. ><form method="POST" action="attacktarget?errors=Y&amp;showerrors=1&amp;debug=1">
  32720. <input type="hidden" name="errors" value="Y">
  32721. <input type="hidden" name="showerrors" value="1">
  32722. <input type="hidden" name="debug" value="1">
  32723. </form></PRE
  32724. ></TD
  32725. ></TR
  32726. ></TABLE
  32727. ></DIV
  32728. ></TD
  32729. ></TR
  32730. ></TABLE
  32731. >
  32732.    </P
  32733. ><P
  32734. >     Regardless of the method of error handling, the ability to probe a
  32735.     system for errors leads to providing an attacker with more
  32736.     information.
  32737.    </P
  32738. ><P
  32739. >     For example, the very style of a generic PHP error indicates a system
  32740.     is running PHP. If the attacker was looking at an .html page, and
  32741.     wanted to probe for the back-end (to look for known weaknesses in
  32742.     the system), by feeding it the wrong data they may be able to
  32743.     determine that a system was built with PHP.
  32744.    </P
  32745. ><P
  32746. >     A function error can indicate whether a system may be running a
  32747.     specific database engine, or give clues as to how a web page or
  32748.     programmed or designed. This allows for deeper investigation into
  32749.     open database ports, or to look for specific bugs or weaknesses
  32750.     in a web page. By feeding different pieces of bad data, for example,
  32751.     an attacker can determine the order of authentication in a script,
  32752.     (from the line number errors) as well as probe for exploits that
  32753.     may be exploited in different locations in the script.
  32754.    </P
  32755. ><P
  32756. >     A filesystem or general PHP error can indicate what permissions
  32757.     the webserver has, as well as the structure and organization of
  32758.     files on the web server. Developer written error code can aggravate
  32759.     this problem, leading to easy exploitation of formerly "hidden"
  32760.     information.
  32761.    </P
  32762. ><P
  32763. >     There are three major solutions to this issue. The first is to
  32764.     scrutinize all functions, and attempt to compensate for the bulk
  32765.     of the errors. The second is to disable error reporting entirely
  32766.     on the running code. The third is to use PHP's custom error
  32767.     handling functions to create your own error handler. Depending
  32768.     on your security policy, you may find all three to be applicable
  32769.     to your situation.
  32770.    </P
  32771. ><P
  32772. >     One way of catching this issue ahead of time is to make use of
  32773.     PHP's own <A
  32774. HREF="#function.error-reporting"
  32775. ><B
  32776. CLASS="function"
  32777. >error_reporting()</B
  32778. ></A
  32779. >, to help you
  32780.     secure your code and find variable usage that may be dangerous.
  32781.     By testing your code, prior to deployment, with E_ALL, you can
  32782.     quickly find areas where your variables may be open to poisoning
  32783.     or modification in other ways. Once you are ready for deployment,
  32784.     by using E_NONE, you insulate your code from probing.
  32785.     <TABLE
  32786. WIDTH="100%"
  32787. BORDER="0"
  32788. CELLPADDING="0"
  32789. CELLSPACING="0"
  32790. CLASS="EXAMPLE"
  32791. ><TR
  32792. ><TD
  32793. ><DIV
  32794. CLASS="example"
  32795. ><A
  32796. NAME="AEN5978"
  32797. ></A
  32798. ><P
  32799. ><B
  32800. >P°φklad 15-13. Finding dangerous variables with E_ALL</B
  32801. ></P
  32802. ><TABLE
  32803. BORDER="0"
  32804. BGCOLOR="#E0E0E0"
  32805. CELLPADDING="5"
  32806. ><TR
  32807. ><TD
  32808. ><PRE
  32809. CLASS="php"
  32810. ><?php
  32811. if ($username) {  // Not initialized or checked before usage
  32812.     $good_login = 1;
  32813. }
  32814. if ($good_login == 1) { // If above test fails, not initialized or checked before usage
  32815.     readfile ("/highly/sensitive/data/index.html");
  32816. }
  32817. ?></PRE
  32818. ></TD
  32819. ></TR
  32820. ></TABLE
  32821. ></DIV
  32822. ></TD
  32823. ></TR
  32824. ></TABLE
  32825. >
  32826.    </P
  32827. ></DIV
  32828. ><DIV
  32829. CLASS="sect1"
  32830. ><HR><H2
  32831. CLASS="sect1"
  32832. ><A
  32833. NAME="security.registerglobals"
  32834. ></A
  32835. >Using Register Globals</H2
  32836. ><P
  32837. >     Perhaps the most controversial change in PHP is when the default value
  32838.     for the PHP directive <A
  32839. HREF="#ini.register-globals"
  32840. >     register_globals</A
  32841. > went from ON to OFF in PHP 
  32842.     <A
  32843. HREF="http://www.php.net/release_4_2_0.php"
  32844. TARGET="_top"
  32845. >4.2.0</A
  32846. >.  Reliance on this
  32847.     directive was quite common and many people didn't even know it existed
  32848.     and assumed it's just how PHP works.  This page will explain how one can
  32849.     write insecure code with this directive but keep in mind that the
  32850.     directive itself isn't insecure but rather it's the misuse of it.
  32851.    </P
  32852. ><P
  32853. >     When on, register_globals will inject (poison) your scripts will all
  32854.     sorts of variables, like request variables from HTML forms.  This
  32855.     coupled with the fact that PHP doesn't require variable initialization
  32856.     means writing insecure code is that much easier.  It was a difficult
  32857.     decision, but the PHP community decided to disable this directive by 
  32858.     default.  When on, people use variables yet really don't know for sure
  32859.     where they come from and can only assume.  Internal variables that are
  32860.     defined in the script itself get mixed up with request data sent by
  32861.     users and disabling register_globals changes this.  Let's demonstrate
  32862.     with an example misuse of register_globals: 
  32863.    </P
  32864. ><P
  32865. >     <TABLE
  32866. WIDTH="100%"
  32867. BORDER="0"
  32868. CELLPADDING="0"
  32869. CELLSPACING="0"
  32870. CLASS="EXAMPLE"
  32871. ><TR
  32872. ><TD
  32873. ><DIV
  32874. CLASS="example"
  32875. ><A
  32876. NAME="AEN5988"
  32877. ></A
  32878. ><P
  32879. ><B
  32880. >P°φklad 15-14. Example misuse with register_globals = on</B
  32881. ></P
  32882. ><TABLE
  32883. BORDER="0"
  32884. BGCOLOR="#E0E0E0"
  32885. CELLPADDING="5"
  32886. ><TR
  32887. ><TD
  32888. ><PRE
  32889. CLASS="php"
  32890. ><?php
  32891. // define $authorized = true only if user is authenticated
  32892. if (authenticated_user()) {
  32893.     $authorized = true;
  32894. }
  32895.  
  32896. // Because we didn't first initialize $authorized as false, this might be
  32897. // defined through register_globals, like from GET auth.php?authorized=1 
  32898. // So, anyone can be seen as authenticated!
  32899. if ($authorized) {
  32900.     include "/highly/sensitive/data.php";
  32901. }
  32902. ?></PRE
  32903. ></TD
  32904. ></TR
  32905. ></TABLE
  32906. ></DIV
  32907. ></TD
  32908. ></TR
  32909. ></TABLE
  32910. >
  32911.    </P
  32912. ><P
  32913. >     When register_globals = on, our logic above may be compromised.  When
  32914.     off, <TT
  32915. CLASS="varname"
  32916. >$authorized</TT
  32917. > can't be set via request so it'll
  32918.     be fine, although it really is generally a good programming practice to 
  32919.     initialize variables first.  For example, in our example above we might
  32920.     have first done <TT
  32921. CLASS="literal"
  32922. >$authorized = false</TT
  32923. >.  Doing this
  32924.     first means our above code would work with register_globals on or off as 
  32925.     users by default would be unauthorized.
  32926.    </P
  32927. ><P
  32928. >     Another example is that of <A
  32929. HREF="#ref.session"
  32930. >sessions</A
  32931. >.
  32932.     When register_globals = on, we could also use
  32933.     <TT
  32934. CLASS="varname"
  32935. >$username</TT
  32936. > in our example below but again you must
  32937.     realize that <TT
  32938. CLASS="varname"
  32939. >$username</TT
  32940. > could also come from other
  32941.     means, such as GET (through the URL).  
  32942.    </P
  32943. ><P
  32944. >     <TABLE
  32945. WIDTH="100%"
  32946. BORDER="0"
  32947. CELLPADDING="0"
  32948. CELLSPACING="0"
  32949. CLASS="EXAMPLE"
  32950. ><TR
  32951. ><TD
  32952. ><DIV
  32953. CLASS="example"
  32954. ><A
  32955. NAME="AEN5999"
  32956. ></A
  32957. ><P
  32958. ><B
  32959. >P°φklad 15-15. Example use of sessions with register_globals on or off</B
  32960. ></P
  32961. ><TABLE
  32962. BORDER="0"
  32963. BGCOLOR="#E0E0E0"
  32964. CELLPADDING="5"
  32965. ><TR
  32966. ><TD
  32967. ><PRE
  32968. CLASS="php"
  32969. ><?php
  32970. // We wouldn't know where $username came from but do know $_SESSION is 
  32971. // for session data 
  32972. if (isset($_SESSION['username'])) {
  32973.     
  32974.     echo "Hello <b>{$_SESSION['username']}</b>";
  32975.  
  32976. } else {
  32977.     
  32978.     echo "Hello <b>Guest</b><br />";
  32979.     echo "Would you like to login?";
  32980.  
  32981. }
  32982. ?></PRE
  32983. ></TD
  32984. ></TR
  32985. ></TABLE
  32986. ></DIV
  32987. ></TD
  32988. ></TR
  32989. ></TABLE
  32990. >
  32991.    </P
  32992. ><P
  32993. >     It's even possible to take preventative measures to warn when forging is
  32994.     being attempted. If you know ahead of time exactly where a variable
  32995.     should be coming from, you can check to see if the submitted data is
  32996.     coming from an inappropriate kind of submission.  While it doesn't
  32997.     guarantee that data has not been forged, it does require an attacker to
  32998.     guess the right kind of forging.  If you don't care where the request
  32999.     data comes from, you can use <TT
  33000. CLASS="varname"
  33001. >$_REQUEST</TT
  33002. > as it contains
  33003.     a mix of GET, POST and COOKIE data.  See also the manual section on
  33004.     using <A
  33005. HREF="#language.variables.external"
  33006. >variables from outside
  33007.     of PHP</A
  33008. >. 
  33009.    </P
  33010. ><P
  33011. >     <TABLE
  33012. WIDTH="100%"
  33013. BORDER="0"
  33014. CELLPADDING="0"
  33015. CELLSPACING="0"
  33016. CLASS="EXAMPLE"
  33017. ><TR
  33018. ><TD
  33019. ><DIV
  33020. CLASS="example"
  33021. ><A
  33022. NAME="AEN6006"
  33023. ></A
  33024. ><P
  33025. ><B
  33026. >P°φklad 15-16. Detecting simple variable poisoning</B
  33027. ></P
  33028. ><TABLE
  33029. BORDER="0"
  33030. BGCOLOR="#E0E0E0"
  33031. CELLPADDING="5"
  33032. ><TR
  33033. ><TD
  33034. ><PRE
  33035. CLASS="php"
  33036. ><?php
  33037. if (isset($_COOKIE['MAGIC_COOKIE'])) {
  33038.     
  33039.     // MAGIC_COOKIE comes from a cookie.
  33040.     // Be sure to validate the cookie data!
  33041.  
  33042. } elseif (isset($_GET['MAGIC_COOKIE']) || isset($_POST['MAGIC_COOKIE'])) {
  33043.    
  33044.    mail("admin@example.com", "Possible breakin attempt", $_SERVER['REMOTE_ADDR']);
  33045.    echo "Security violation, admin has been alerted.";
  33046.    exit;
  33047.  
  33048. } else {
  33049.    
  33050.    // MAGIC_COOKIE isn't set through this REQUEST
  33051.  
  33052. }
  33053. ?></PRE
  33054. ></TD
  33055. ></TR
  33056. ></TABLE
  33057. ></DIV
  33058. ></TD
  33059. ></TR
  33060. ></TABLE
  33061. >
  33062.    </P
  33063. ><P
  33064. >     Of course, simply turning off register_globals does not mean your code
  33065.     is secure.  For every piece of data that is submitted, it should also be
  33066.     checked in other ways.  Always validate your user data and initialize
  33067.     your variables!  To check for unitialized variables you may turn up
  33068.     <A
  33069. HREF="#function.error-reporting"
  33070. ><B
  33071. CLASS="function"
  33072. >error_reporting()</B
  33073. ></A
  33074. > to show
  33075.     <TT
  33076. CLASS="constant"
  33077. ><B
  33078. >E_NOTICE</B
  33079. ></TT
  33080. > level errors.
  33081.    </P
  33082. ><DIV
  33083. CLASS="note"
  33084. ><BLOCKQUOTE
  33085. CLASS="note"
  33086. ><P
  33087. ><B
  33088. >dostupnost superglobßlnφch prom∞nn²ch: </B
  33089. >Od PHP 4.1.0 jsou k dispozici superglobßlnφ pole jako <TT
  33090. CLASS="varname"
  33091. >$_GET
  33092. </TT
  33093. >, <TT
  33094. CLASS="varname"
  33095. >$_POST</TT
  33096. > a <TT
  33097. CLASS="varname"
  33098. >$_SERVER</TT
  33099. >.
  33100. Pro vφce informacφ viz Φßst manußlu o <A
  33101. HREF="#language.variables.predefined"
  33102. >superglobals</A
  33103. ></P
  33104. ></BLOCKQUOTE
  33105. ></DIV
  33106. ></DIV
  33107. ><DIV
  33108. CLASS="sect1"
  33109. ><HR><H2
  33110. CLASS="sect1"
  33111. ><A
  33112. NAME="security.variables"
  33113. ></A
  33114. >User Submitted Data</H2
  33115. ><P
  33116. >     The greatest weakness in many PHP programs is not inherent in the
  33117.     language itself, but merely an issue of code not being written with
  33118.     security in mind. For this reason, you should always take the time
  33119.     to consider the implications of a given piece of code, to ascertain
  33120.     the possible damage if an unexpected variable is submitted to it.
  33121.     <TABLE
  33122. WIDTH="100%"
  33123. BORDER="0"
  33124. CELLPADDING="0"
  33125. CELLSPACING="0"
  33126. CLASS="EXAMPLE"
  33127. ><TR
  33128. ><TD
  33129. ><DIV
  33130. CLASS="example"
  33131. ><A
  33132. NAME="AEN6022"
  33133. ></A
  33134. ><P
  33135. ><B
  33136. >P°φklad 15-17. Dangerous Variable Usage</B
  33137. ></P
  33138. ><TABLE
  33139. BORDER="0"
  33140. BGCOLOR="#E0E0E0"
  33141. CELLPADDING="5"
  33142. ><TR
  33143. ><TD
  33144. ><PRE
  33145. CLASS="php"
  33146. ><?php
  33147. // remove a file from the user's home directory... or maybe
  33148. // somebody else's?
  33149. unlink ($evil_var);
  33150.  
  33151. // Write logging of their access... or maybe an /etc/passwd entry?
  33152. fputs ($fp, $evil_var);
  33153.  
  33154. // Execute something trivial.. or rm -rf *?
  33155. system ($evil_var);
  33156. exec ($evil_var);
  33157.  
  33158. ?></PRE
  33159. ></TD
  33160. ></TR
  33161. ></TABLE
  33162. ></DIV
  33163. ></TD
  33164. ></TR
  33165. ></TABLE
  33166. >
  33167.     You should always carefully examine your code to make sure that any
  33168.     variables being submitted from a web browser are being properly
  33169.     checked, and ask yourself the following questions:
  33170.     <P
  33171. ></P
  33172. ><UL
  33173. ><LI
  33174. ><P
  33175. >        Will this script only affect the intended files?
  33176.       </P
  33177. ></LI
  33178. ><LI
  33179. ><P
  33180. >        Can unusual or undesirable data be acted upon?
  33181.       </P
  33182. ></LI
  33183. ><LI
  33184. ><P
  33185. >        Can this script be used in unintended ways?
  33186.       </P
  33187. ></LI
  33188. ><LI
  33189. ><P
  33190. >        Can this be used in conjunction with other scripts in a negative
  33191.        manner?
  33192.       </P
  33193. ></LI
  33194. ><LI
  33195. ><P
  33196. >        Will any transactions be adequately logged?
  33197.       </P
  33198. ></LI
  33199. ></UL
  33200. >
  33201.     By adequately asking these questions while writing the script,
  33202.     rather than later, you prevent an unfortunate re-write when you
  33203.     need to increase your security. By starting out with this mindset,
  33204.     you won't guarantee the security of your system, but you can help
  33205.     improve it.
  33206.    </P
  33207. ><P
  33208. >     You may also want to consider turning off register_globals,
  33209.     magic_quotes, or other convenience settings which may confuse
  33210.     you as to the validity, source, or value of a given variable.
  33211.     Working with PHP in error_reporting(E_ALL) mode can also help warn
  33212.     you about variables being used before they are checked or
  33213.     initialized (so you can prevent unusual data from being
  33214.     operated upon).
  33215.    </P
  33216. ></DIV
  33217. ><DIV
  33218. CLASS="sect1"
  33219. ><HR><H2
  33220. CLASS="sect1"
  33221. ><A
  33222. NAME="security.hiding"
  33223. ></A
  33224. >Hiding PHP</H2
  33225. ><P
  33226. >     In general, security by obscurity is one of the weakest forms of security.
  33227.     But in some cases, every little bit of extra security is desirable.
  33228.    </P
  33229. ><P
  33230. >     A few simple techniques can help to hide PHP, possibly slowing
  33231.     down an attacker who is attempting to discover weaknesses in your
  33232.     system. By setting expose_php = off in your <TT
  33233. CLASS="filename"
  33234. >php.ini</TT
  33235. > file, you
  33236.     reduce the amount of information available to them.
  33237.    </P
  33238. ><P
  33239. >     Another tactic is to configure web servers such as apache to
  33240.     parse different filetypes through PHP, either with an <TT
  33241. CLASS="filename"
  33242. >.htaccess</TT
  33243. >
  33244.     directive, or in the apache configuration file itself. You can
  33245.     then use misleading file extensions:
  33246.     <TABLE
  33247. WIDTH="100%"
  33248. BORDER="0"
  33249. CELLPADDING="0"
  33250. CELLSPACING="0"
  33251. CLASS="EXAMPLE"
  33252. ><TR
  33253. ><TD
  33254. ><DIV
  33255. CLASS="example"
  33256. ><A
  33257. NAME="AEN6044"
  33258. ></A
  33259. ><P
  33260. ><B
  33261. >P°φklad 15-18. Hiding PHP as another language</B
  33262. ></P
  33263. ><TABLE
  33264. BORDER="0"
  33265. BGCOLOR="#E0E0E0"
  33266. CELLPADDING="5"
  33267. ><TR
  33268. ><TD
  33269. ><PRE
  33270. CLASS="apache-conf"
  33271. ># Make PHP code look like other code types
  33272. AddType application/x-httpd-php .asp .py .pl</PRE
  33273. ></TD
  33274. ></TR
  33275. ></TABLE
  33276. ></DIV
  33277. ></TD
  33278. ></TR
  33279. ></TABLE
  33280. >
  33281.     Or obscure it completely:
  33282.     <TABLE
  33283. WIDTH="100%"
  33284. BORDER="0"
  33285. CELLPADDING="0"
  33286. CELLSPACING="0"
  33287. CLASS="EXAMPLE"
  33288. ><TR
  33289. ><TD
  33290. ><DIV
  33291. CLASS="example"
  33292. ><A
  33293. NAME="AEN6047"
  33294. ></A
  33295. ><P
  33296. ><B
  33297. >P°φklad 15-19. Using unknown types for PHP extensions</B
  33298. ></P
  33299. ><TABLE
  33300. BORDER="0"
  33301. BGCOLOR="#E0E0E0"
  33302. CELLPADDING="5"
  33303. ><TR
  33304. ><TD
  33305. ><PRE
  33306. CLASS="apache-conf"
  33307. ># Make PHP code look like unknown types
  33308. AddType application/x-httpd-php .bop .foo .133t</PRE
  33309. ></TD
  33310. ></TR
  33311. ></TABLE
  33312. ></DIV
  33313. ></TD
  33314. ></TR
  33315. ></TABLE
  33316. >
  33317.     Or hide it as HTML code, which has a slight performance hit because
  33318.     all HTML will be parsed through the PHP engine:
  33319.     <TABLE
  33320. WIDTH="100%"
  33321. BORDER="0"
  33322. CELLPADDING="0"
  33323. CELLSPACING="0"
  33324. CLASS="EXAMPLE"
  33325. ><TR
  33326. ><TD
  33327. ><DIV
  33328. CLASS="example"
  33329. ><A
  33330. NAME="AEN6050"
  33331. ></A
  33332. ><P
  33333. ><B
  33334. >P°φklad 15-20. Using HTML types for PHP extensions</B
  33335. ></P
  33336. ><TABLE
  33337. BORDER="0"
  33338. BGCOLOR="#E0E0E0"
  33339. CELLPADDING="5"
  33340. ><TR
  33341. ><TD
  33342. ><PRE
  33343. CLASS="apache-conf"
  33344. ># Make all PHP code look like HTML
  33345. AddType application/x-httpd-php .htm .html</PRE
  33346. ></TD
  33347. ></TR
  33348. ></TABLE
  33349. ></DIV
  33350. ></TD
  33351. ></TR
  33352. ></TABLE
  33353. >
  33354.     For this to work effectively, you must rename your PHP files with
  33355.     the above extensions. While it is a form of security through
  33356.     obscurity, it's a minor preventative measure with few drawbacks.
  33357.    </P
  33358. ></DIV
  33359. ><DIV
  33360. CLASS="sect1"
  33361. ><HR><H2
  33362. CLASS="sect1"
  33363. ><A
  33364. NAME="security.current"
  33365. ></A
  33366. >Keeping Current</H2
  33367. ><P
  33368. >     PHP, like any other large system, is under constant scrutiny and
  33369.     improvement. Each new version will often include both major and
  33370.     minor changes to enhance and repair security flaws, configuration
  33371.     mishaps, and other issues that will affect the overall security
  33372.     and stability of your system.
  33373.    </P
  33374. ><P
  33375. >     Like other system-level scripting languages and programs, the best
  33376.     approach is to update often, and maintain awareness of the latest
  33377.     versions and their changes.
  33378.    </P
  33379. ></DIV
  33380. ></DIV
  33381. ></DIV
  33382. ><DIV
  33383. CLASS="PART"
  33384. ><A
  33385. NAME="features"
  33386. ></A
  33387. ><DIV
  33388. CLASS="TITLEPAGE"
  33389. ><H1
  33390. CLASS="title"
  33391. >IV. Vlastnosti</H1
  33392. ><DIV
  33393. CLASS="TOC"
  33394. ><DL
  33395. ><DT
  33396. ><B
  33397. >Obsah</B
  33398. ></DT
  33399. ><DT
  33400. >16. <A
  33401. HREF="#features.http-auth"
  33402. >HTTP autentikace a PHP</A
  33403. ></DT
  33404. ><DT
  33405. >17. <A
  33406. HREF="#features.cookies"
  33407. >Cookies</A
  33408. ></DT
  33409. ><DT
  33410. >18. <A
  33411. HREF="#features.file-upload"
  33412. >Zpracovßnφ uploadu soubor∙</A
  33413. ></DT
  33414. ><DT
  33415. >19. <A
  33416. HREF="#features.remote-files"
  33417. >Pou╛itφ vzdßlen²ch soubor∙</A
  33418. ></DT
  33419. ><DT
  33420. >20. <A
  33421. HREF="#features.connection-handling"
  33422. >Obsluha spojenφ</A
  33423. ></DT
  33424. ><DT
  33425. >21. <A
  33426. HREF="#features.persistent-connections"
  33427. >Persistentnφ databßzovß spojenφ</A
  33428. ></DT
  33429. ><DT
  33430. >22. <A
  33431. HREF="#features.safe-mode"
  33432. >BezpeΦn² re╛im</A
  33433. ></DT
  33434. ><DT
  33435. >23. <A
  33436. HREF="#features.commandline"
  33437. >Pou╛itφ PHP z p°φkazovΘ °ßdky</A
  33438. ></DT
  33439. ></DL
  33440. ></DIV
  33441. ></DIV
  33442. ><DIV
  33443. CLASS="chapter"
  33444. ><HR><H1
  33445. ><A
  33446. NAME="features.http-auth"
  33447. >Kapitola 16. HTTP autentikace a PHP</A
  33448. ></H1
  33449. ><P
  33450. >   Prost°edky HTTP autentikace jsou v PHP p°φstupnΘ pouze pokud PHP b∞╛φ jako
  33451.   modul Apache, tudφ╛ nejsou p°φstupnΘ v CGI verzi. V PHP skriptu b∞╛φcφm pod
  33452.   modulem Apache lze pou╛φt funkci <A
  33453. HREF="#function.header"
  33454. ><B
  33455. CLASS="function"
  33456. >header()</B
  33457. ></A
  33458. > k odeslßnφ
  33459.   zprßvy "Authentication Required" klientskΘmu browseru, co╛ vyvolß zobrazenφ
  33460.   dialogovΘho okna pro vlo╛enφ u╛ivatelskΘho jmΘna a hesla. Jakmile u╛ivatel
  33461.   zadß jmΘno a heslo, URL obsahujφcφ tento PHP skript se zavolß znovu s
  33462.   prom∞nn²mi $PHP_AUTH_USER, $PHP_AUTH_PW and $PHP_AUTH_TYPE obsahujφcφmi
  33463.   jmΘno, heslo a typ autentikace. V souΦasnosti je podporovßna pouze "Basic"
  33464.   autentikace. Vφce informacφ viz funkce <A
  33465. HREF="#function.header"
  33466. ><B
  33467. CLASS="function"
  33468. >header()</B
  33469. ></A
  33470. >.
  33471.   </P
  33472. ><P
  33473. >   Nßsledujφcφ fragment k≤du m∙╛e poslou╛it jako ukßzka vy╛ßdßnφ autentikace
  33474.   u╛ivatele na strßnce:
  33475.  
  33476.    <TABLE
  33477. WIDTH="100%"
  33478. BORDER="0"
  33479. CELLPADDING="0"
  33480. CELLSPACING="0"
  33481. CLASS="EXAMPLE"
  33482. ><TR
  33483. ><TD
  33484. ><DIV
  33485. CLASS="example"
  33486. ><A
  33487. NAME="AEN6065"
  33488. ></A
  33489. ><P
  33490. ><B
  33491. >P°φklad 16-1. Ukßzka HTTP Autentikace</B
  33492. ></P
  33493. ><TABLE
  33494. BORDER="0"
  33495. BGCOLOR="#E0E0E0"
  33496. CELLPADDING="5"
  33497. ><TR
  33498. ><TD
  33499. ><PRE
  33500. CLASS="php"
  33501. ><?php
  33502.   if(!isset($PHP_AUTH_USER)) {
  33503.     Header("WWW-Authenticate: Basic realm=\"My Realm\"");
  33504.     Header("HTTP/1.0 401 Unauthorized");
  33505.     echo "Text, kter² se ode╣le, pokud u╛ivatel zmßΦkne tlaΦφtko Cancel\n";
  33506.     exit;
  33507.   } else {
  33508.     echo "Ahoj $PHP_AUTH_USER.<P>";
  33509.     echo "Jako heslo jsi zadal $PHP_AUTH_PW.<P>";
  33510.   }
  33511. ?></PRE
  33512. ></TD
  33513. ></TR
  33514. ></TABLE
  33515. ></DIV
  33516. ></TD
  33517. ></TR
  33518. ></TABLE
  33519. ></P
  33520. ><P
  33521. >   Mφsto protΘho vyti╣t∞nφ $PHP_AUTH_USER a $PHP_AUTH_PW byste asi
  33522.   cht∞li ov∞°it platnost zadanΘho jmΘna a hesla. Nap°φklad dotazem
  33523.   v databßzi nebo vyhledßnφm u╛ivatele v dbm souboru.
  33524.   </P
  33525. ><P
  33526. >   Pozor na chybovΘ browsery Internet Explorer. Zdß se, ╛e jsou velice
  33527.   vybφravΘ, pokud jde o po°adφ hlaviΦek. Zdß se, ╛e odeslßnφ hlaviΦky
  33528.   <SPAN
  33529. CLASS="emphasis"
  33530. ><I
  33531. CLASS="emphasis"
  33532. >WWW-Authenticate</I
  33533. ></SPAN
  33534. > p°ed hlaviΦkou
  33535.   <SPAN
  33536. CLASS="errorcode"
  33537. >HTTP/1.0 401</SPAN
  33538. > zabφrß.
  33539.   </P
  33540. ><P
  33541. >   Aby se zabrßnilo psanφ skript∙ odhalujφcφch hesla na strßnkßch
  33542.   autentikovan²ch n∞kter²m z tradiΦnφch externφch mechanism∙, PHP_AUTH
  33543.   prom∞nnΘ se nevytvo°φ, pokud je pro tu kterou strßnku zapnuta externφ
  33544.   autentikace. V takovΘm p°φpad∞ m∙╛ete k identifikaci extern∞
  33545.   autentikovanΘho u╛ivatele pou╛φt prom∞nnou $REMOTE_USER.
  33546.   </P
  33547. ><P
  33548. >   V╣imn∞te si nicmΘn∞, ╛e v²╣e uvedenΘ nezabrßnφ krßde╛φm hesel z
  33549.   autentikovan²ch URL osobou, kterß ovlßdß neautentikovanou URL na stejnΘm
  33550.   serveru.
  33551.   </P
  33552. ><P
  33553. >   Jak Netscape, tak Internet Explorer po p°ijetφ response k≤du 401 vyprßzdnφ
  33554.   autentikaΦnφ cache souΦasnΘho realmu. Tak m∙╛ete u╛ivatele v podstat∞
  33555.   "odlogovat". N∞kte°φ lidΘ toho vyu╛φvajφ k "vypr╣enφ" p°ihlß╣enφ nebo
  33556.   tvorb∞ odhla╣ovacφho tlaΦφtka.
  33557.   </P
  33558. ><P
  33559. ></P
  33560. ><TABLE
  33561. WIDTH="100%"
  33562. BORDER="0"
  33563. CELLPADDING="0"
  33564. CELLSPACING="0"
  33565. CLASS="EXAMPLE"
  33566. ><TR
  33567. ><TD
  33568. ><DIV
  33569. CLASS="example"
  33570. ><A
  33571. NAME="AEN6076"
  33572. ></A
  33573. ><P
  33574. ><B
  33575. >P°φklad 16-2. Ukßzka HTTP autentikace vy╛adujφcφ novΘ jmΘno a heslo</B
  33576. ></P
  33577. ><TABLE
  33578. BORDER="0"
  33579. BGCOLOR="#E0E0E0"
  33580. CELLPADDING="5"
  33581. ><TR
  33582. ><TD
  33583. ><PRE
  33584. CLASS="php"
  33585. ><?php
  33586.   function authenticate() {
  33587.     Header( "WWW-Authenticate: Basic realm=\"Test Authentication System\"");
  33588.     Header( "HTTP/1.0 401 Unauthorized");
  33589.     echo "K p°φstupu na tento zdroj musφte zadat platnΘ ID a heslo\n";
  33590.     exit;
  33591.   }
  33592.  
  33593.   if(!isset($PHP_AUTH_USER) || ($SeenBefore == 1 && !strcmp($OldAuth, $PHP_AUTH_USER)) ) {
  33594.    authenticate();
  33595.   }
  33596.   else {
  33597.    echo "Welcome: $PHP_AUTH_USER<BR>";
  33598.    echo "Old: $OldAuth";
  33599.    echo "<FORM ACTION=\"$PHP_SELF\" METHOD=POST>\n";
  33600.    echo "<INPUT TYPE=HIDDEN NAME=\"SeenBefore\" VALUE=\"1\">\n";
  33601.    echo "<INPUT TYPE=HIDDEN NAME=\"OldAuth\" VALUE=\"$PHP_AUTH_USER\">\n";
  33602.    echo "<INPUT TYPE=Submit VALUE=\"Re Authenticate\">\n";
  33603.    echo "</FORM>\n";
  33604.   }
  33605. ?></PRE
  33606. ></TD
  33607. ></TR
  33608. ></TABLE
  33609. ></DIV
  33610. ></TD
  33611. ></TR
  33612. ></TABLE
  33613. ><P
  33614. >   Podle standardu HTTP Basic authentication se toto chovßnφ nevy╛aduje, tak╛e
  33615.   byste na to nikdy nem∞li spolΘhat. Pokusy s Lynxem ukßzaly, ╛e Lynx po p°ijetφ
  33616.   response k≤du 401 nevyprßzdnφ autentikaΦnφ ·daje, tak╛e po stisknutφ back a
  33617.   forward se znovu ukß╛e po╛adovan² zdroj (pokud se nezm∞nily po╛adavky na
  33618.   ·daje).
  33619.   </P
  33620. ><P
  33621. >   Dßle si v╣imn∞te, ╛e tato vlastnost p°i pou╛itφ IIS serveru a CGI verze PHP
  33622.   dφky omezenφm IIS nefunguje.
  33623.   </P
  33624. ></DIV
  33625. ><DIV
  33626. CLASS="chapter"
  33627. ><HR><H1
  33628. ><A
  33629. NAME="features.cookies"
  33630. >Kapitola 17. Cookies</A
  33631. ></H1
  33632. ><P
  33633. >   PHP transparentn∞ podporuje HTTP cookies. Cookies jsou mechanismem na
  33634.   uklßdßnφ dat ve vzdßlenΘm browseru a tudφ╛ sledovßnφ nebo identifikaci
  33635.   vracejφcφch se u╛ivatel∙. Cookies m∙╛ete nastavovat pomocφ funkce
  33636.   <A
  33637. HREF="#function.setcookie"
  33638. ><B
  33639. CLASS="function"
  33640. >setcookie()</B
  33641. ></A
  33642. >. Cookies jsou souΦßstφ HTTP hlaviΦky,
  33643.   tudφ╛ <A
  33644. HREF="#function.setcookie"
  33645. ><B
  33646. CLASS="function"
  33647. >setcookie()</B
  33648. ></A
  33649. > se musφ volat p°ed odeslßnφm v²stupu
  33650.   do browseru. To je stejnΘ omezenφ, jako mß funkce <A
  33651. HREF="#function.header"
  33652. ><B
  33653. CLASS="function"
  33654. >header()</B
  33655. ></A
  33656. >.
  33657.   </P
  33658. ><P
  33659. >   V╣echny cookies p°ijatΘ od klienta se automaticky stßvajφ PHP prom∞nnou
  33660.   stejn∞ jako u GET a POST dat. Pokud chcete p°i°adit jednomu cookie vφce
  33661.   hodnot, p°idejte <SPAN
  33662. CLASS="emphasis"
  33663. ><I
  33664. CLASS="emphasis"
  33665. >[]</I
  33666. ></SPAN
  33667. > na konec jmΘna cookie. Vφce
  33668.   detail∙ viz funkce <A
  33669. HREF="#function.setcookie"
  33670. ><B
  33671. CLASS="function"
  33672. >setcookie()</B
  33673. ></A
  33674. >.</P
  33675. ></DIV
  33676. ><DIV
  33677. CLASS="chapter"
  33678. ><HR><H1
  33679. ><A
  33680. NAME="features.file-upload"
  33681. >Kapitola 18. Zpracovßnφ uploadu soubor∙</A
  33682. ></H1
  33683. ><DIV
  33684. CLASS="sect1"
  33685. ><H2
  33686. CLASS="sect1"
  33687. ><A
  33688. NAME="features.file-upload.post-method"
  33689. ></A
  33690. >Uploading metodou POST</H2
  33691. ><P
  33692. >     PHP umo╛≥uje zpracovßnφ uploadu soubor∙ z jakΘhokoli prohlφ╛eΦe
  33693.     vyhovujφcφho RFC-1867 (co╛ zahrnuje mj. Netscape Navigator 3 a pozd∞j╣φ,
  33694.     Microsoft Internet Explorer 3 se zßplatou od Microsoftu, nebo pozd∞j╣φ
  33695.     bez zßplaty).  Tato schopnost umo╛≥uje lidem uploadovat textovΘ i
  33696.     binßrnφ soubory. S autentizacφ poskytovanou PHP a s funkcemi pro manipulaci
  33697.     se soubory mßte plnou kontrolu nad tφm, kdo smφ uploadovat a co se mß
  33698.     ud∞lat s uploadovan²m souborem.    
  33699.    </P
  33700. ><P
  33701. >     Nezapome≥te, ╛e PHP podporuje takΘ uploady metodou PUT tak, jak se pou╛φvß
  33702.     v Netscape Composeru a v editoru Amaya od W3C. Pro bli╛╣φ detaily viz
  33703.     <A
  33704. HREF="#features.file-upload.put-method"
  33705. >Podpora metody PUT</A
  33706. >.
  33707.    </P
  33708. ><P
  33709. >     Obrazovka pro upload souboru m∙╛e b²t tvo°ena specißlnφm formulß°em, kter²
  33710.     vypadß podobn∞ jako tento:    
  33711.     <TABLE
  33712. WIDTH="100%"
  33713. BORDER="0"
  33714. CELLPADDING="0"
  33715. CELLSPACING="0"
  33716. CLASS="EXAMPLE"
  33717. ><TR
  33718. ><TD
  33719. ><DIV
  33720. CLASS="example"
  33721. ><A
  33722. NAME="AEN6098"
  33723. ></A
  33724. ><P
  33725. ><B
  33726. >P°φklad 18-1. Formulß° pro upload souboru</B
  33727. ></P
  33728. ><TABLE
  33729. BORDER="0"
  33730. BGCOLOR="#E0E0E0"
  33731. CELLPADDING="5"
  33732. ><TR
  33733. ><TD
  33734. ><PRE
  33735. CLASS="html"
  33736. ><form enctype="multipart/form-data" action="_URL_" method="post">
  33737. <input type="hidden" name="MAX_FILE_SIZE" value="1000">
  33738. Send this file: <input name="userfile" type="file">
  33739. <input type="submit" value="Send File">
  33740. </form></PRE
  33741. ></TD
  33742. ></TR
  33743. ></TABLE
  33744. ></DIV
  33745. ></TD
  33746. ></TR
  33747. ></TABLE
  33748. >
  33749.     _URL_ by m∞lo oznaΦovat PHP soubor. SkrytΘ pole MAX_FILE_SIZE musφ
  33750.     p°edchßzet pole pro vlo╛enφ souboru a jeho hodnota specifikuje maximßlnφ
  33751.     akceptovanou velikost souboru. Hodnota je v bytech.    
  33752.     <DIV
  33753. CLASS="warning"
  33754. ><P
  33755. ></P
  33756. ><TABLE
  33757. CLASS="warning"
  33758. BORDER="1"
  33759. WIDTH="100%"
  33760. ><TR
  33761. ><TD
  33762. ALIGN="CENTER"
  33763. ><B
  33764. >Varovßnφ</B
  33765. ></TD
  33766. ></TR
  33767. ><TR
  33768. ><TD
  33769. ALIGN="LEFT"
  33770. ><P
  33771. >       Hodnota MAX_FILE_SIZE je z hlediska prohlφ╛eΦe pouze informativnφ.
  33772.       Je snadnΘ ji obejφt. Tak╛e nepoΦφtejte s tφm, ╛e prohlφ╛eΦ se bude
  33773.       chovat tak, jak si p°ejete. Nastavenφ maximßlnφ velikosti v PHP v╣ak
  33774.       samoz°ejm∞ nem∙╛e b²t obelst∞no.       
  33775.      </P
  33776. ></TD
  33777. ></TR
  33778. ></TABLE
  33779. ></DIV
  33780. >
  33781.    </P
  33782. ><P
  33783. >     Prom∞nnΘ definovanΘ pro uploadovanΘ soubory se li╣φ v zßvislosti na
  33784.     verzi a konfiguraci PHP. Pokud je aktivnφ volba
  33785.     <A
  33786. HREF="#ini.track-vars"
  33787. >track_vars</A
  33788. >, bude inicializovßno pole
  33789.     $HTTP_POST_FILES/$_FILES. KoneΦn∞, souvisejφcφ prom∞nnΘ mohou b²t
  33790.     inicializovßny jako globßlnφ, pokud je zapnuta volba    
  33791.     <A
  33792. HREF="#ini.register-globals"
  33793. >register_globals</A
  33794. >.
  33795.     Ov╣em pou╛φvßnφ globßlnφch prom∞nn²ch nenφ doporuΦeno.
  33796.     Po ·sp∞╣nΘm uploadu budou v cφlovΘm skriptu definovßny nßsledujφcφ
  33797.     prom∞nnΘ:    
  33798.    </P
  33799. ><DIV
  33800. CLASS="note"
  33801. ><BLOCKQUOTE
  33802. CLASS="note"
  33803. ><P
  33804. ><B
  33805. >Poznßmka: </B
  33806. >
  33807.      <A
  33808. HREF="#ini.track-vars"
  33809. >track_vars</A
  33810. > je od PHP 4.0.3
  33811.     v╛dy zapnuto. U PHP 4.1.0 a pozd∞j╣φch m∙╛e b²t pou╛ito $_FILES
  33812.     namφsto <TT
  33813. CLASS="varname"
  33814. >$HTTP_POST_FILES</TT
  33815. >. <TT
  33816. CLASS="varname"
  33817. >$_FILES</TT
  33818. >
  33819.     je v╛dy globßlnφ prom∞nnß, tak╛e by se nem∞la pou╛φvat specifikace
  33820.     <TT
  33821. CLASS="literal"
  33822. >global</TT
  33823. > pro prom∞nnou $_FILES.
  33824.     </P
  33825. ></BLOCKQUOTE
  33826. ></DIV
  33827. ><P
  33828. >     <TT
  33829. CLASS="varname"
  33830. >$HTTP_POST_FILES</TT
  33831. >/<TT
  33832. CLASS="varname"
  33833. >$_FILES</TT
  33834. >
  33835.     obsahuje informace o uploadovanΘm souboru.     
  33836.    </P
  33837. ><P
  33838. >     Obsah <TT
  33839. CLASS="varname"
  33840. >$HTTP_POST_FILES</TT
  33841. > je takov²to (uv∞domte si, ╛e
  33842.     se p°edpoklßdß pou╛itφ nßzvu uploadovanΘho souboru 'userfile' tak,    
  33843.     jako v p°φkladu v²╣e):
  33844.     <P
  33845. ></P
  33846. ><DIV
  33847. CLASS="variablelist"
  33848. ><DL
  33849. ><DT
  33850. ><TT
  33851. CLASS="varname"
  33852. >$HTTP_POST_FILES['userfile']['name']</TT
  33853. ></DT
  33854. ><DD
  33855. ><P
  33856. >         Originßlnφ nßzev souboru na klientskΘm poΦφtaΦi.
  33857.        </P
  33858. ></DD
  33859. ><DT
  33860. ><TT
  33861. CLASS="varname"
  33862. >$HTTP_POST_FILES['userfile']['type']</TT
  33863. ></DT
  33864. ><DD
  33865. ><P
  33866. >         MIME typ souboru, pokud prohlφ╛eΦ tuto informaci poskytuje
  33867.     (nap°. <TT
  33868. CLASS="literal"
  33869. >"image/gif"</TT
  33870. >).
  33871.         </P
  33872. ></DD
  33873. ><DT
  33874. ><TT
  33875. CLASS="varname"
  33876. >$HTTP_POST_FILES['userfile']['size']</TT
  33877. ></DT
  33878. ><DD
  33879. ><P
  33880. >         Velikost uploadovanΘho souboru v bytech.
  33881.        </P
  33882. ></DD
  33883. ><DT
  33884. ><TT
  33885. CLASS="varname"
  33886. >$HTTP_POST_FILES['userfile']['tmp_name']</TT
  33887. ></DT
  33888. ><DD
  33889. ><P
  33890. >         DoΦasn² nßzev souboru, pod nφm╛ byl uploadovan² soubor ulo╛en na server.
  33891.        </P
  33892. ></DD
  33893. ></DL
  33894. ></DIV
  33895. >
  33896.    </P
  33897. ><DIV
  33898. CLASS="note"
  33899. ><BLOCKQUOTE
  33900. CLASS="note"
  33901. ><P
  33902. ><B
  33903. >Poznßmka: </B
  33904. >
  33905.      PHP 4.1.0 a pozd∞j╣φ podporujφ zkrßcen² nßzev prom∞nnΘ
  33906.      <TT
  33907. CLASS="varname"
  33908. >$_FILES</TT
  33909. >. PHP 3 nepodporuje
  33910.      <TT
  33911. CLASS="varname"
  33912. >$HTTP_POST_FILES</TT
  33913. >.
  33914.     </P
  33915. ></BLOCKQUOTE
  33916. ></DIV
  33917. ><P
  33918. >     Obsah prom∞nnßch v situaci, kdy je prom∞nnß
  33919.     <A
  33920. HREF="#ini.register-globals"
  33921. >register_globals</A
  33922. >
  33923.     zapnuta nastavenφm v souboru <TT
  33924. CLASS="filename"
  33925. >php.ini</TT
  33926. > (uv∞domte si, ╛e
  33927.     se p°edpoklßdß pou╛itφ nßzvu uploadovanΘho souboru 'userfile' tak,    
  33928.     jako v p°φkladu v²╣e):
  33929.  
  33930.     <P
  33931. ></P
  33932. ><UL
  33933. ><LI
  33934. ><P
  33935. >        <TT
  33936. CLASS="varname"
  33937. >$userfile</TT
  33938. > - DoΦasn² nßzev souboru, pod kter²m byl
  33939.        uploadovan² soubor ulo╛en na server.
  33940.       </P
  33941. ></LI
  33942. ><LI
  33943. ><P
  33944. >        <TT
  33945. CLASS="varname"
  33946. >$userfile_name</TT
  33947. > - Originßlnφ nßzev souboru nebo cesta
  33948.        na odesφlajφcφm systΘmu.
  33949.       </P
  33950. ></LI
  33951. ><LI
  33952. ><P
  33953. >        <TT
  33954. CLASS="varname"
  33955. >$userfile_size</TT
  33956. > - Velikost uploadovanΘho souboru
  33957.        v bytech.
  33958.       </P
  33959. ></LI
  33960. ><LI
  33961. ><P
  33962. >        <TT
  33963. CLASS="varname"
  33964. >$userfile_type</TT
  33965. > - MIME typ souboru, pokud prohlφ╛eΦ
  33966.        tuto informaci poskytuje (nap°. "image/gif").
  33967.       </P
  33968. ></LI
  33969. ></UL
  33970. >
  33971.     Uv∞domte si, ╛e prom∞nnß "<TT
  33972. CLASS="varname"
  33973. >$userfile</TT
  33974. >" ve skuteΦnosti
  33975.     p°edstavuje nßzev pole <input> se specifikacφ type="file" ve
  33976.     formulß°i. Pro v²╣e uveden² p°φklad jsme zvolili nßzev "userfile".
  33977.    </P
  33978. ><DIV
  33979. CLASS="note"
  33980. ><BLOCKQUOTE
  33981. CLASS="note"
  33982. ><P
  33983. ><B
  33984. >Poznßmka: </B
  33985. >
  33986.      Nastavenφ <TT
  33987. CLASS="literal"
  33988. >register_globals = On</TT
  33989. > se nedoporuΦuje z
  33990.      bezpeΦnostnφch a v²konnostnφch d∙vod∙.     
  33991.     </P
  33992. ></BLOCKQUOTE
  33993. ></DIV
  33994. ><P
  33995. >     Soubory se implicitn∞ uklßdajφ do systΘmovΘho adresß°e pro doΦasnΘ
  33996.     soubory, pokud nebylo direktivou
  33997.     <A
  33998. HREF="#ini.upload-tmp-dir"
  33999. >upload_tmp_dir</A
  34000. > v souboru
  34001.     <TT
  34002. CLASS="filename"
  34003. >php.ini</TT
  34004. > stanoveno jinak. SystΘmov² adresß° pro
  34005.     doΦasnΘ soubory m∙╛e b²t zm∞n∞n nastavenφ prom∞nnΘ prost°edφ
  34006.     <TT
  34007. CLASS="envar"
  34008. >TMPDIR</TT
  34009. > v prost°edφ, kde PHP b∞╛φ. Nastavenφ za pou╛itφ
  34010.     <A
  34011. HREF="#function.putenv"
  34012. ><B
  34013. CLASS="function"
  34014. >putenv()</B
  34015. ></A
  34016. > z PHP skriptu nebude fungovat. Tato
  34017.     prom∞nnß prost°edφ m∙╛e b²t takΘ pou╛ita k uji╣t∞nφ se, ╛e v╣echny
  34018.     ostatnφ operace pracujφ s uploadovan²mi soubory.    
  34019.     <TABLE
  34020. WIDTH="100%"
  34021. BORDER="0"
  34022. CELLPADDING="0"
  34023. CELLSPACING="0"
  34024. CLASS="EXAMPLE"
  34025. ><TR
  34026. ><TD
  34027. ><DIV
  34028. CLASS="example"
  34029. ><A
  34030. NAME="AEN6168"
  34031. ></A
  34032. ><P
  34033. ><B
  34034. >P°φklad 18-2. Ov∞°ovßnφ uploadu souboru</B
  34035. ></P
  34036. ><P
  34037. >       Nßsledujφcφ p°φklady jsou pro verze PHP 4 vy╣╣φ ne╛ PHP 4.0.2.
  34038.       (viz funkce
  34039.       <A
  34040. HREF="#function.is-uploaded-file"
  34041. ><B
  34042. CLASS="function"
  34043. >is_uploaded_file()</B
  34044. ></A
  34045. > a
  34046.       <A
  34047. HREF="#function.move-uploaded-file"
  34048. ><B
  34049. CLASS="function"
  34050. >move_uploaded_file()</B
  34051. ></A
  34052. >).
  34053.      </P
  34054. ><TABLE
  34055. BORDER="0"
  34056. BGCOLOR="#E0E0E0"
  34057. CELLPADDING="5"
  34058. ><TR
  34059. ><TD
  34060. ><PRE
  34061. CLASS="php"
  34062. ><?php 
  34063. // V PHP 4.1.0 a pozd∞j╣φch by m∞lo b²t pou╛ito $_FILES namφsto $HTTP_POST_FILES.
  34064. if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
  34065.     copy($HTTP_POST_FILES['userfile']['tmp_name'], "/place/to/put/uploaded/file");
  34066. } else {
  34067.     echo "Possible file upload attack. Filename: " . $HTTP_POST_FILES['userfile']['name'];
  34068. }
  34069. /* ...or... */
  34070. move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], "/place/to/put/uploaded/file");
  34071. ?></PRE
  34072. ></TD
  34073. ></TR
  34074. ></TABLE
  34075. ></DIV
  34076. ></TD
  34077. ></TR
  34078. ></TABLE
  34079. >
  34080.    </P
  34081. ><P
  34082. >     PHP skript, kter² p°ijφmß uploadovanΘ soubory, by m∞l implementovat
  34083.     ve╣kerou logiku pro stanovenφ, co by se m∞lo ud∞lat s uploadovan²m
  34084.     souborem. M∙╛ete nap°. pou╛φt prom∞nnou
  34085.     <TT
  34086. CLASS="varname"
  34087. >$HTTP_POST_FILES['userfile']['size']</TT
  34088. > pro zahozenφ
  34089.     soubor∙, kterΘ jsou p°φli╣ malΘ nebo velkΘ. Mohli byste pou╛φt takΘ
  34090.     prom∞nnou <TT
  34091. CLASS="varname"
  34092. >$HTTP_POST_FILES['userfile']['type']</TT
  34093. >
  34094.     pro filtraci soubor∙ podle MIME datovΘho typu. Bez ohledu na °e╣enφ,
  34095.     soubor by m∞l b²t smazßn nebo p°esunut jinam.    
  34096.    </P
  34097. ><P
  34098. >     Soubor bude automaticky smazßn z doΦasnΘho adresß°e na konci skriptu,
  34099.     pokud nebyl p°esunut jinam nebo p°ejmenovßn.    
  34100.    </P
  34101. ></DIV
  34102. ><DIV
  34103. CLASS="sect1"
  34104. ><HR><H2
  34105. CLASS="sect1"
  34106. ><A
  34107. NAME="features.file-upload.common-pitfalls"
  34108. ></A
  34109. >╚astß ·skalφ</H2
  34110. ><P
  34111. >     <TT
  34112. CLASS="literal"
  34113. >MAX_FILE_SIZE</TT
  34114. > nem∙╛e specifikovat velikost souboru
  34115.     v∞t╣φ ne╛ je ta, kterß byla nastavena pomocφ
  34116.     <A
  34117. HREF="#ini.upload-max-filesize"
  34118. >upload_max_filesize</A
  34119. >
  34120.     v konfiguraci PHP. Implicitn∞ jsou to 2 MB.    
  34121.    </P
  34122. ><P
  34123. >     Pokud je zapnut limit pam∞ti, m∙╛e b²t pot°eba v∞t╣φ hodnota
  34124.     <A
  34125. HREF="#ini.memory-limit"
  34126. >memory_limit</A
  34127. >. Ujist∞te se, ╛e
  34128.     je hodnota <A
  34129. HREF="#ini.memory-limit"
  34130. >memory_limit</A
  34131. >
  34132.     dostateΦn∞ velkß.
  34133.    </P
  34134. ><P
  34135. >     Pokud je nastavenß hodnota <TT
  34136. CLASS="literal"
  34137. >max_execution_time</TT
  34138. > p°φli╣
  34139.     malß, doba provßd∞nφ skriptu ji m∙╛e p°ekroΦit. Ujist∞te se, ╛e je
  34140.     hodnota <TT
  34141. CLASS="literal"
  34142. >max_execution_time</TT
  34143. > dostateΦn∞ velkß.
  34144.    </P
  34145. ><P
  34146. >     Pokud je nastavenß hodnota <TT
  34147. CLASS="literal"
  34148. >post_max_size</TT
  34149. > p°φli╣ malß,
  34150.     nem∙╛e b²t uploadovßn v∞t╣φ soubor. Ujist∞te se, ╛e je hodnota
  34151.     <TT
  34152. CLASS="literal"
  34153. >post_max_size</TT
  34154. > dostateΦn∞ velkß.
  34155.    </P
  34156. ><P
  34157. >     Neov∞°ovßnφ, se kter²m souborem se pracuje, m∙╛e znamenat, ╛e se u╛ivatelΘ
  34158.     mohou dostat k citliv²m informacφm v jin²ch adresß°φch.
  34159.    </P
  34160. ><P
  34161. >     Uv∞domte si prosφm, ╛e server CERN httpd odstra≥uje v╣echno, co poΦφnaje
  34162.     prvnφ bφlou mezerou (whitespace) v MIME hlaviΦce Content-Type
  34163.     obdr╛φ od klienta. Za existence tohoto jevu nebude CERN httpd podporovat
  34164.     uploading soubor∙.    
  34165.    </P
  34166. ></DIV
  34167. ><DIV
  34168. CLASS="sect1"
  34169. ><HR><H2
  34170. CLASS="sect1"
  34171. ><A
  34172. NAME="features.file-upload.multiple"
  34173. ></A
  34174. >Uploading vφce soubor∙</H2
  34175. ><P
  34176. >     Vφce soubor∙ m∙╛e b²t uploadovßnφ za pou╛itφ r∙zn²ch nßzv∙
  34177.     <TT
  34178. CLASS="literal"
  34179. >name</TT
  34180. > pro souborovΘ pole <TT
  34181. CLASS="literal"
  34182. >input</TT
  34183. >.
  34184.    </P
  34185. ><P
  34186. >     Je takΘ mo╛nΘ uploadovat vφce soubor∙ souΦasn∞ a nechat informace
  34187.     automaticky zorganizovat v polφch. V takovΘm p°φpad∞ je t°eba
  34188.     pou╛φt stejnou syntaxi v HTML formulß°i jako pro vφcenßsobnΘ v²b∞ry
  34189.     a za╣krtßvacφ polφΦka (checkboxy).    
  34190.    </P
  34191. ><DIV
  34192. CLASS="note"
  34193. ><BLOCKQUOTE
  34194. CLASS="note"
  34195. ><P
  34196. ><B
  34197. >Poznßmka: </B
  34198. >
  34199.      Podpora pro upload vφce soubor∙ byla p°idßna ve verzi 3.0.10.
  34200.     </P
  34201. ></BLOCKQUOTE
  34202. ></DIV
  34203. ><P
  34204. >     <TABLE
  34205. WIDTH="100%"
  34206. BORDER="0"
  34207. CELLPADDING="0"
  34208. CELLSPACING="0"
  34209. CLASS="EXAMPLE"
  34210. ><TR
  34211. ><TD
  34212. ><DIV
  34213. CLASS="example"
  34214. ><A
  34215. NAME="AEN6203"
  34216. ></A
  34217. ><P
  34218. ><B
  34219. >P°φklad 18-3. Uploading vφce soubor∙</B
  34220. ></P
  34221. ><TABLE
  34222. BORDER="0"
  34223. BGCOLOR="#E0E0E0"
  34224. CELLPADDING="5"
  34225. ><TR
  34226. ><TD
  34227. ><PRE
  34228. CLASS="html"
  34229. ><form action="file-upload.php" method="post" enctype="multipart/form-data">
  34230.   Send these files:<br>
  34231.   <input name="userfile[]" type="file"><br>
  34232.   <input name="userfile[]" type="file"><br>
  34233.   <input type="submit" value="Send files">
  34234. </form></PRE
  34235. ></TD
  34236. ></TR
  34237. ></TABLE
  34238. ></DIV
  34239. ></TD
  34240. ></TR
  34241. ></TABLE
  34242. >
  34243.    </P
  34244. ><P
  34245. >     Pokud je v²╣e uveden² formulß° odeslßn, pole    
  34246.     <TT
  34247. CLASS="varname"
  34248. >$HTTP_POST_FILES['userfile']</TT
  34249. >,
  34250.     <TT
  34251. CLASS="varname"
  34252. >$HTTP_POST_FILES['userfile']['name']</TT
  34253. >, a
  34254.     <TT
  34255. CLASS="varname"
  34256. >$HTTP_POST_FILES['userfile']['size']</TT
  34257. > budou
  34258.     inicializovßna (jak $_FILES v PHP 4.1.0 a pozd∞j╣φm, tak
  34259.     $HTTP_POST_VARS v PHP 3. Pokud je nastavenφ
  34260.     <TT
  34261. CLASS="literal"
  34262. >register_globals</TT
  34263. > aktivnφ globßlnφ prom∞nnΘ pro
  34264.     uploadovanΘ soubory jsou takΘ inicializovßny). Ka╛dΘ z nich bude
  34265.     Φφseln∞ indexovanΘ pole odpovφdajφcφch hodnot pro odeslanΘ soubory.    
  34266.    </P
  34267. ><P
  34268. >     Kup°φkladu p°edpoklßdejme, ╛e se posφlajφ soubory s nßzvy
  34269.     <TT
  34270. CLASS="filename"
  34271. >/home/test/review.html</TT
  34272. > a
  34273.     <TT
  34274. CLASS="filename"
  34275. >/home/test/xwp.out</TT
  34276. >. V tom p°φpad∞ by
  34277.     <TT
  34278. CLASS="varname"
  34279. >$HTTP_POST_FILES['userfile']['name'][0]</TT
  34280. > obsahovalo
  34281.     hodnotu <TT
  34282. CLASS="filename"
  34283. >review.html</TT
  34284. > a
  34285.     <TT
  34286. CLASS="varname"
  34287. >$HTTP_POST_FILES['userfile']['name'][1]</TT
  34288. > hodnotu
  34289.     <TT
  34290. CLASS="filename"
  34291. >xwp.out</TT
  34292. >. Podobn∞
  34293.     <TT
  34294. CLASS="varname"
  34295. >$HTTP_POST_FILES['userfile']['size'][0]</TT
  34296. > by obsahovalo
  34297.     velikost <TT
  34298. CLASS="filename"
  34299. >review.html</TT
  34300. > atd.
  34301.    </P
  34302. ><P
  34303. >     <TT
  34304. CLASS="varname"
  34305. >$HTTP_POST_FILES['userfile']['name'][0]</TT
  34306. >,
  34307.     <TT
  34308. CLASS="varname"
  34309. >$HTTP_POST_FILES['userfile']['tmp_name'][0]</TT
  34310. >,
  34311.     <TT
  34312. CLASS="varname"
  34313. >$HTTP_POST_FILES['userfile']['size'][0]</TT
  34314. > a
  34315.     <TT
  34316. CLASS="varname"
  34317. >$HTTP_POST_FILES['userfile']['type'][0]</TT
  34318. > budou
  34319.     rovn∞╛ nastaveny.
  34320.    </P
  34321. ></DIV
  34322. ><DIV
  34323. CLASS="sect1"
  34324. ><HR><H2
  34325. CLASS="sect1"
  34326. ><A
  34327. NAME="features.file-upload.put-method"
  34328. ></A
  34329. >Podpora metody PUT</H2
  34330. ><P
  34331. >     PHP poskytuje podporu pro HTTP PUT metodu pou╛φvanou klienty jako
  34332.     Netscape Composer nebo W3C Amaya. Po╛adavky s metodou PUT jsou mnohem
  34333.     jednodu╣╣φ ne╛ upload soubor∙ a vypadajφ p°ibli╛n∞ takto:    
  34334.     <DIV
  34335. CLASS="informalexample"
  34336. ><A
  34337. NAME="AEN6228"
  34338. ></A
  34339. ><P
  34340. ></P
  34341. ><TABLE
  34342. BORDER="0"
  34343. BGCOLOR="#E0E0E0"
  34344. CELLPADDING="5"
  34345. ><TR
  34346. ><TD
  34347. ><PRE
  34348. CLASS="programlisting"
  34349. >PUT /path/filename.html HTTP/1.1</PRE
  34350. ></TD
  34351. ></TR
  34352. ></TABLE
  34353. ><P
  34354. ></P
  34355. ></DIV
  34356. >
  34357.    </P
  34358. ><P
  34359. >     Toto by normßln∞ znamenalo, ╛e by cht∞l klient ulo╛it obsah, kter²
  34360.     nßsleduje za nßzvem /path/filename.html, do svΘho webovΘho stromu.
  34361.     To samoz°ejm∞ nenφ dobr² nßpad, aby Apache nebo PHP automaticky
  34362.     nechal kohokoli p°epsat jakΘkoli soubory ve strom∞. Tak╛e, 
  34363.     pro zpracovßnφ takovΘho po╛adavku je t°eba nejd°φv °ici va╣emu
  34364.     WWW serveru, ╛e chcete po╛adavek zpracovßvat konkrΘtnφm PHP skriptem.
  34365.     U serveru Apache se to provede direktivou    
  34366.     <SPAN
  34367. CLASS="emphasis"
  34368. ><I
  34369. CLASS="emphasis"
  34370. >Script</I
  34371. ></SPAN
  34372. >. M∙╛e b²t umφst∞na kdekoli v konfiguraΦnφm
  34373.     souboru Apache. ╚ast²mi mφsty jsou bloky <Directory> a 
  34374.     <Virtualhost>. Pou╛ije se k tomu °ßdek podobn² tomuto:
  34375.     <DIV
  34376. CLASS="informalexample"
  34377. ><A
  34378. NAME="AEN6232"
  34379. ></A
  34380. ><P
  34381. ></P
  34382. ><TABLE
  34383. BORDER="0"
  34384. BGCOLOR="#E0E0E0"
  34385. CELLPADDING="5"
  34386. ><TR
  34387. ><TD
  34388. ><PRE
  34389. CLASS="programlisting"
  34390. >Skript PUT /put.php</PRE
  34391. ></TD
  34392. ></TR
  34393. ></TABLE
  34394. ><P
  34395. ></P
  34396. ></DIV
  34397. >
  34398.    </P
  34399. ><P
  34400. >     Toto °ekne serveru Apache, aby v╣echny PUT po╛adavky na n∞jak² URI
  34401.     vyhovujφcφ kontextu posφlal skriptu put.php. To pochopiteln∞ p°edpoklßdß,
  34402.     ╛e mßte povoleno PHP pro p°φponu .php a PHP je aktivnφ.     
  34403.    </P
  34404. ><P
  34405. >     V souboru put.php byste potom mohli napsat n∞co jako:
  34406.    </P
  34407. ><P
  34408. >     <DIV
  34409. CLASS="informalexample"
  34410. ><A
  34411. NAME="AEN6237"
  34412. ></A
  34413. ><P
  34414. ></P
  34415. ><TABLE
  34416. BORDER="0"
  34417. BGCOLOR="#E0E0E0"
  34418. CELLPADDING="5"
  34419. ><TR
  34420. ><TD
  34421. ><PRE
  34422. CLASS="php"
  34423. ><?php copy($PHP_UPLOADED_FILE_NAME,$DOCUMENT_ROOT.$REQUEST_URI); ?></PRE
  34424. ></TD
  34425. ></TR
  34426. ></TABLE
  34427. ><P
  34428. ></P
  34429. ></DIV
  34430. >
  34431.    </P
  34432. ><P
  34433. >     Toto by m∞lo zkopφrovat soubor na mφsto po╛adovanΘ vzdßlen²m klientem.
  34434.     Pravd∞podobn∞ byste cht∞li provΘst n∞jakß ov∞°enφ a/nebo autentizace
  34435.     u╛ivatele p°ed provedenφm tohoto zkopφrovßnφ. Jedin²m pou╛iteln²m trikem
  34436.     je, ╛e PHP ulo╛φ p°enesen² soubor do doΦasnΘho adresß°e podobn∞, jako
  34437.     p°i pou╛itφ
  34438.     <A
  34439. HREF="#features.file-upload.post-method"
  34440. >metody POST</A
  34441. >.
  34442.     A╛ skript skonΦφ, doΦasn² soubor bude odstran∞n. Tak╛e vß╣ PHP skipt
  34443.     pro zpracovßnφ PUT po╛adavk∙ musφ soubor zkopφrovat jinam. Nßzev souboru
  34444.     v doΦasnΘm umφst∞nφ je ulo╛en v prom∞nnΘ $PHP_PUT_FILENAME a po╛adovan²
  34445.     nßzev cφlovΘho souboru v prom∞nnΘ $REQUEST_URI (m∙╛e se li╣it u server∙
  34446.     jin²ch ne╛ Apache).  Toto cφlovΘ jmΘno je to jedinΘ, co klient
  34447.     specifikoval. Nemusφte ho poslechnout. Mohli byste, nap°φklad, kopφrovat
  34448.     v╣echny uploadovanΘ soubory do specißlnφho uploadovΘho adresß°e.    
  34449.    </P
  34450. ></DIV
  34451. ></DIV
  34452. ><DIV
  34453. CLASS="chapter"
  34454. ><HR><H1
  34455. ><A
  34456. NAME="features.remote-files"
  34457. >Kapitola 19. Pou╛itφ vzdßlen²ch soubor∙</A
  34458. ></H1
  34459. ><P
  34460. >   Pokud p°i konfiguraci PHP aktivujete podporu "URL fopen wrapper"
  34461.   (standardn∞ je zapnutß, leda╛e pro configure explicitn∞ zadßte
  34462.   <TT
  34463. CLASS="option"
  34464. >--disable-url-fopen-wrapper</TT
  34465. > p°φznak (verze do 4.0.3),
  34466.   nebo (u nov∞j╣φch verzφ) nastavφte <TT
  34467. CLASS="parameter"
  34468. ><I
  34469. >allow_url_fopen</I
  34470. ></TT
  34471. > v
  34472.   php.ini na off), m∙╛ete ve volßnφch v∞t╣iny funkcφ, kterΘ oΦekßvajφ
  34473.   jako argument nßzev souboru (vΦetn∞ <A
  34474. HREF="#function.require"
  34475. ><B
  34476. CLASS="function"
  34477. >require()</B
  34478. ></A
  34479. > a
  34480.   <A
  34481. HREF="#function.include"
  34482. ><B
  34483. CLASS="function"
  34484. >include()</B
  34485. ></A
  34486. >) uvΘst HTTP nebo FTP URL.
  34487.   </P
  34488. ><P
  34489. >    <DIV
  34490. CLASS="note"
  34491. ><BLOCKQUOTE
  34492. CLASS="note"
  34493. ><P
  34494. ><B
  34495. >Poznßmka: </B
  34496. >
  34497.     Na Windows nelze pou╛φvat vzdßlenΘ soubory v
  34498.     <A
  34499. HREF="#function.include"
  34500. ><B
  34501. CLASS="function"
  34502. >include()</B
  34503. ></A
  34504. > a <A
  34505. HREF="#function.require"
  34506. ><B
  34507. CLASS="function"
  34508. >require()</B
  34509. ></A
  34510. > v²razech.
  34511.     </P
  34512. ></BLOCKQUOTE
  34513. ></DIV
  34514. >
  34515.   </P
  34516. ><P
  34517. >   M∙╛ete nap°φklad otev°φt soubor na vzdßlenΘm web serveru, vyseparovat z
  34518.   v²stupu data, kterß pot°ebujete, a tato data potom pou╛φt v dotazu na
  34519.   databßzi, nebo je prost∞ zaΦlenit do v²stupu stylem odpovφdajφcφm zbytku
  34520.   va╣φ web site.
  34521.   </P
  34522. ><P
  34523. >    <TABLE
  34524. WIDTH="100%"
  34525. BORDER="0"
  34526. CELLPADDING="0"
  34527. CELLSPACING="0"
  34528. CLASS="EXAMPLE"
  34529. ><TR
  34530. ><TD
  34531. ><DIV
  34532. CLASS="example"
  34533. ><A
  34534. NAME="AEN6255"
  34535. ></A
  34536. ><P
  34537. ><B
  34538. >P°φklad 19-1. Zφskßnφ nßzvu vzdßlenΘ strßnky</B
  34539. ></P
  34540. ><TABLE
  34541. BORDER="0"
  34542. BGCOLOR="#E0E0E0"
  34543. CELLPADDING="5"
  34544. ><TR
  34545. ><TD
  34546. ><PRE
  34547. CLASS="php"
  34548. ><?php
  34549. $file = fopen ("http://www.php.net/", "r");
  34550. if (!$file) {
  34551.     echo "<p>Nelze otev°φt vzdßlen² soubor.\n";
  34552.     exit;
  34553. }
  34554. while (!feof ($file)) {
  34555.     $line = fgets ($file, 1024);
  34556.     /* Toto bude fungovat pouze pokud jsou tagy a nßzev na jednΘ °ßdce */
  34557.     if (eregi ("<title>(.*)</title>", $line, $out)) {
  34558.         $title = $out[1];
  34559.         break;
  34560.     }
  34561. }
  34562. fclose($file);
  34563. ?></PRE
  34564. ></TD
  34565. ></TR
  34566. ></TABLE
  34567. ></DIV
  34568. ></TD
  34569. ></TR
  34570. ></TABLE
  34571. >
  34572.   </P
  34573. ><P
  34574. >   Pokud se p°ipojφte jako u╛ivatel s dostateΦn²mi prßvy, a dan² soubor u╛
  34575.   neexistuje, m∙╛ete data takΘ uklßdat po FTP. Pokud se chcete p°ipojit jako
  34576.   jin² u╛ivatel ne╛ 'anonymous', musφte v URL udat u╛ivatelskΘ jmΘno (a
  34577.   pravd∞podobn∞ i heslo), nap°.
  34578.   'ftp://uzivatel:heslo@ftp.example.com/path/to/file'. (Pro p°φstup k soubor∙m
  34579.   p°es HTTP, kterΘ vy╛adujφ Basic authentication, m∙╛ete pou╛φt stejnou
  34580.   syntaxi.)
  34581.   </P
  34582. ><P
  34583. >    <TABLE
  34584. WIDTH="100%"
  34585. BORDER="0"
  34586. CELLPADDING="0"
  34587. CELLSPACING="0"
  34588. CLASS="EXAMPLE"
  34589. ><TR
  34590. ><TD
  34591. ><DIV
  34592. CLASS="example"
  34593. ><A
  34594. NAME="AEN6260"
  34595. ></A
  34596. ><P
  34597. ><B
  34598. >P°φklad 19-2. Ulo╛enφ dat na vzdßlenΘm serveru</B
  34599. ></P
  34600. ><TABLE
  34601. BORDER="0"
  34602. BGCOLOR="#E0E0E0"
  34603. CELLPADDING="5"
  34604. ><TR
  34605. ><TD
  34606. ><PRE
  34607. CLASS="php"
  34608. ><?php
  34609. $file = fopen ("ftp://ftp.php.net/incoming/outputfile", "w");
  34610. if (!$file) {
  34611.     echo "<p>Nelze otev°φt vzdßlen² soubor pro zßpis.\n";
  34612.     exit;
  34613. }
  34614. /* Zapφ╣eme data. */
  34615. fputs ($file, "$HTTP_USER_AGENT\n");
  34616. fclose ($file);
  34617. ?></PRE
  34618. ></TD
  34619. ></TR
  34620. ></TABLE
  34621. ></DIV
  34622. ></TD
  34623. ></TR
  34624. ></TABLE
  34625. >
  34626.   </P
  34627. ><P
  34628. >    <DIV
  34629. CLASS="note"
  34630. ><BLOCKQUOTE
  34631. CLASS="note"
  34632. ><P
  34633. ><B
  34634. >Poznßmka: </B
  34635. >
  34636.     Z v²╣e uvedenΘho p°φkladu by vßs mohlo napadnout vyu╛φt tuto techniku k
  34637.     zßpisu do vzdßlenΘho logu, ale jak u╛ bylo zmφn∞no v²╣e, pomocφ URL fopen()
  34638.     wrapperu m∙╛ete zapisovat pouze do novΘho souboru. Pokud mßte zßjem o
  34639.     distribuovanΘ logovßnφ, podφvejte se na <A
  34640. HREF="#function.syslog"
  34641. ><B
  34642. CLASS="function"
  34643. >syslog()</B
  34644. ></A
  34645. >.
  34646.     </P
  34647. ></BLOCKQUOTE
  34648. ></DIV
  34649. >
  34650.   </P
  34651. ></DIV
  34652. ><DIV
  34653. CLASS="chapter"
  34654. ><HR><H1
  34655. ><A
  34656. NAME="features.connection-handling"
  34657. >Kapitola 20. Obsluha spojenφ</A
  34658. ></H1
  34659. ><DIV
  34660. CLASS="note"
  34661. ><BLOCKQUOTE
  34662. CLASS="note"
  34663. ><P
  34664. ><B
  34665. >Poznßmka: </B
  34666. >Nßsledujφcφ text platφ pro verzi 3.0.7 a vy╣╣φ.</P
  34667. ></BLOCKQUOTE
  34668. ></DIV
  34669. ><P
  34670. >   Stav spojenφ se v PHP intern∞ sleduje. Jsou t°i mo╛nΘ stavy:
  34671.    <P
  34672. ></P
  34673. ><UL
  34674. ><LI
  34675. ><P
  34676. >0 - NORMAL (normßlnφ)</P
  34677. ></LI
  34678. ><LI
  34679. ><P
  34680. >1 - ABORTED (zru╣eno)</P
  34681. ></LI
  34682. ><LI
  34683. ><P
  34684. >2 - TIMEOUT (vypr╣el Φasov² limit)</P
  34685. ></LI
  34686. ></UL
  34687. >
  34688.   </P
  34689. ><P
  34690. >   P°i normßlnφm b∞hu PHP skriptu je aktivnφ stav NORMAL. Pokud se klient
  34691.   odpojφ, nastavφ se p°φznak ABORTED. K odpojenφ vzdßlenΘho klienta typicky
  34692.   dochßzφ, kdy╛ u╛ivatel zmßΦkne tlaΦφtko STOP. Pokud se dosßhne ΦasovΘho
  34693.   limitu (viz <A
  34694. HREF="#function.set-time-limit"
  34695. ><B
  34696. CLASS="function"
  34697. >set_time_limit()</B
  34698. ></A
  34699. >), nastavφ se stavov² p°φznak
  34700.   TIMEOUT.
  34701.   </P
  34702. ><P
  34703. >   M∙╛ete se rozhodnout jestli chcete, aby odpojenφ klienta zp∙sobilo p°edΦasnΘ
  34704.   ukonΦenφ va╣eho skriptu. N∞kdy je u╛iteΦnΘ nechat skripty dob∞hnout do konce,
  34705.   p°esto╛e nenφ vzdßlenΘho browseru, kter² by p°ijφmal v²stup. V²chozφ chovßnφ
  34706.   je nicmΘn∞ takovΘ, ╛e p°i odpojenφ vzdßlenΘho klienta dojde k ukonΦenφ b∞hu
  34707.   skriptu. Toto chovßnφ se dß zm∞nit skrze konfiguraΦnφ direktivu
  34708.   ignore_user_abort v php3.ini, odpovφdajφcφ direktivu php3_ignore_user_abort
  34709.   v .conf souboru Apache, Φi funkci <A
  34710. HREF="#function.ignore-user-abort"
  34711. ><B
  34712. CLASS="function"
  34713. >ignore_user_abort()</B
  34714. ></A
  34715. >.
  34716.   Pokud nedßte PHP pokyn ignorovat odpojenφ u╛ivatele a ten se odpojφ, vß╣
  34717.   skript se ukonΦφ. V²jimkou je, pokud mßte pomocφ
  34718.   <A
  34719. HREF="#function.register-shutdown-function"
  34720. ><B
  34721. CLASS="function"
  34722. >register_shutdown_function()</B
  34723. ></A
  34724. > zaregistrovanou funkci pro
  34725.   provedenφ p°i ukonΦenφ skriptu. V tom p°φpad∞, pokud vzdßlen² u╛ivatel zmßΦkne
  34726.   tlaΦφtko STOP, p°i dal╣φm pokusu tohoto skriptu odeslat v²stup PHP detekuje,
  34727.   ╛e spojenφ bylo zru╣eno, a zavolß se funkce zaregistrovanß pro provedenφ p°i
  34728.   ukonΦenφ skriptu. Tato funkce se zavolß takΘ na konci b∞hu skriptu konΦφcφm
  34729.   normßln∞, tak╛e pokud chcete po zru╣enΘm spojenφ ud∞lat n∞co jinΘho, m∙╛ete
  34730.   pou╛φt <A
  34731. HREF="#function.connection-aborted"
  34732. ><B
  34733. CLASS="function"
  34734. >connection_aborted()</B
  34735. ></A
  34736. >. Tato funkce vrßtφ
  34737.   <TT
  34738. CLASS="constant"
  34739. ><B
  34740. >TRUE</B
  34741. ></TT
  34742. >, pokud bylo spojenφ zru╣eno.
  34743.   </P
  34744. ><P
  34745. >   Vß╣ skript m∙╛e takΘ ukonΦit vestav∞n² ΦφtaΦ Φasu. V²chozφ Φasov² limit je
  34746.   30 sekund. To se dß zm∞nit max_execution_time direktivou v php╣.ini nebo
  34747.   odpovφdajφcφ php3_max_execution_time direktivou v .conf souboru Apahe, Φi
  34748.   volßnφm funkce <A
  34749. HREF="#function.set-time-limit"
  34750. ><B
  34751. CLASS="function"
  34752. >set_time_limit()</B
  34753. ></A
  34754. >. Kdy╛ ΦφtaΦ Φasu dob∞hne,
  34755.   skript se ukonΦφ, a jako ve v²╣e uvedenΘm p°φpad∞ u╛ivatelskΘho odpojenφ,
  34756.   pokud je zaregistrovanß funkce pro provedenφ p°i ukonΦenφ skriptu, tato se
  34757.   zavolß. Uvnit° tΘto funkce m∙╛te zkontrolovat, jestli jejφ zavolßnφ zp∙sobilo
  34758.   dob∞hnutφ ΦφtaΦe Φasu zavolßnφm funkce <A
  34759. HREF="#function.connection-timeout"
  34760. ><B
  34761. CLASS="function"
  34762. >connection_timeout()</B
  34763. ></A
  34764. >.
  34765.   Tato funkce vrßtφ <TT
  34766. CLASS="constant"
  34767. ><B
  34768. >TRUE</B
  34769. ></TT
  34770. >, pokud volßnφ funkce registrovanΘ
  34771.   pro provedenφ p°i ukonΦenφ skriptu zp∙sobilo dob∞hnutφ ΦφtaΦe Φasu.
  34772.   </P
  34773. ><P
  34774. >   SkuteΦnostφ hodnou pov╣imnutφ je, ╛e stavy ABORTED a TIMEOUT mohou b²t
  34775.   aktivnφ souΦasn∞. Mo╛nΘ je to v p°φpad∞, ╛e na°φdφte PHP ignorovat odpojenφ
  34776.   u╛ivatee. PHP i tak bude v∞d∞t, ╛e u╛ivatel p°eru╣il spojenφ, ale skript
  34777.   pob∞╛φ dßl. Pokud potom dosßhne ΦasovΘho limitu, bude ukonΦen, a zavolß se
  34778.   va╣e funkce pro provedenφ p°i ukonΦenφ skriptu, pokud existuje. V tomto
  34779.   okam╛iku zjistφte, ╛e jak <A
  34780. HREF="#function.connection-timeout"
  34781. ><B
  34782. CLASS="function"
  34783. >connection_timeout()</B
  34784. ></A
  34785. >, tak
  34786.   <A
  34787. HREF="#function.connection-aborted"
  34788. ><B
  34789. CLASS="function"
  34790. >connection_aborted()</B
  34791. ></A
  34792. > vracejφ <TT
  34793. CLASS="constant"
  34794. ><B
  34795. >TRUE</B
  34796. ></TT
  34797. >.
  34798.   Oba stavy m∙╛ete zkontrolovat jedin²m volßnφm funkce
  34799.   <A
  34800. HREF="#function.connection-status"
  34801. ><B
  34802. CLASS="function"
  34803. >connection_status()</B
  34804. ></A
  34805. >. Tato funkce vracφ bitovΘ pole
  34806.   aktivnφch stav∙. Tak╛e nap°φklad, pokud jsou aktivnφ oba tyto stavy, vrßtφ
  34807.   3.
  34808.   </P
  34809. ></DIV
  34810. ><DIV
  34811. CLASS="chapter"
  34812. ><HR><H1
  34813. ><A
  34814. NAME="features.persistent-connections"
  34815. >Kapitola 21. Persistentnφ databßzovß spojenφ</A
  34816. ></H1
  34817. ><P
  34818. >   Trvalß spojenφ jsou SQL spojenφ, kterß se nezavφrajφ na konci pr∙b∞hu skriptu.
  34819.   P°i po╛adavku na trvalΘ spojenφ PHP nejd°φve zkontroluje, jestli u╛ neexistuje
  34820.   identickΘ spojenφ (kterΘ z∙stalo otev°eno z d°φv∞j╣ka) - a pokud existuje,
  34821.   pou╛ije ho. Pokud neexistuje, PHP ho otev°e. "IdentickΘ" spojenφ je spojenφ,
  34822.   kterΘ bylo otev°eno se stejn²m serverem, u╛ivatelsk²m jmΘnem a heslem (pokud
  34823.   je zadßte).
  34824.   </P
  34825. ><DIV
  34826. CLASS="note"
  34827. ><BLOCKQUOTE
  34828. CLASS="note"
  34829. ><P
  34830. ><B
  34831. >Poznßmka: </B
  34832. >
  34833.    Existujφ i dal╣φ roz╣φ°enφ, kterß vytvß°φ trvalß spojenφ,
  34834.    nap°φklad
  34835.     <A
  34836. HREF="#ref.imap"
  34837. >Roz╣φ°enφ IMAP</A
  34838. >.
  34839.    </P
  34840. ></BLOCKQUOTE
  34841. ></DIV
  34842. ><P
  34843. >   LidΘ, kte°φ nejsou d∙kladn∞ obeznßmeni se zp∙sobem, jak²m web servery fungujφ
  34844.   a distribuujφ zßt∞╛, mohou poklßdat trvalß spojenφ za n∞co Φφm nejsou. Zvlß╣t∞
  34845.   <SPAN
  34846. CLASS="emphasis"
  34847. ><I
  34848. CLASS="emphasis"
  34849. >neumo╛≥ujφ</I
  34850. ></SPAN
  34851. > otvφrßnφ "u╛ivatelsk²ch sessions" na stejnΘm
  34852.   SQL spojenφ, <SPAN
  34853. CLASS="emphasis"
  34854. ><I
  34855. CLASS="emphasis"
  34856. >neumo╛≥ujφ</I
  34857. ></SPAN
  34858. > efektivnφ tvorbu transakcφ, a
  34859.   neumo╛≥ujφ spoustu dal╣φch v∞cφ. Dokonce, aby o tom bylo opravdu a d∙kladn∞ jasno,
  34860.   vßm trvalß spojenφ nedajφ <SPAN
  34861. CLASS="emphasis"
  34862. ><I
  34863. CLASS="emphasis"
  34864. >╛ßdnou</I
  34865. ></SPAN
  34866. > funkcionalitu,
  34867.   kterß by nebyla mo╛nß s jejich netrval²mi prot∞j╣ky.
  34868.   </P
  34869. ><P
  34870. >    ProΦ?
  34871.   </P
  34872. ><P
  34873. >   To je dßno zp∙sobem, jak²m fungujφ webovΘ servery. Jsou t°i zp∙soby, jak²mi
  34874.   vß╣ web server m∙╛e vyu╛φt PHP ke generovßnφ webov²ch strßnek.
  34875.   </P
  34876. ><P
  34877. >   Prvnφ metodou je pou╛φt PHP jako CGI "obal". V tomto re╛imu se vytvß°φ
  34878.   a niΦφ jedna instance PHP interpretru pro ka╛d² po╛adavek (na PHP strnßnku)
  34879.   na va╣em web serveru. Proto╛e je zniΦena po obslou╛enφ po╛adavku, v╣echny
  34880.   zdroje, kterΘ zφskß (jako t°eba spojenφ s databßzov²m serverem) jsou p°i
  34881.   jejφm zniΦenφ zav°eny. V tomto p°φpad∞ pokusem o pou╛itφ trval²ch spojenφ nic
  34882.   nezφskßte - prost∞ nevydr╛φ.
  34883.   </P
  34884. ><P
  34885. >   Druhou, a nejpopulßrn∞j╣φ, metodou, je provozovat PHP jako modul v
  34886.   multiprocesnφm web serveru, co╛ je mno╛ina, kterß v souΦasnosti obsahuje
  34887.   pouze Apache. Multiprocesnφ web server mß typicky jeden proces (rodiΦe),
  34888.   kter² °φdφ skupinu proces∙ (sv²ch d∞tφ), kterΘ d∞lajφ vlastnφ prßci -
  34889.   servφrujφ strßnky. Ka╛d² po╛adavek, kter² p°ijde od klienta, je obslou╛en
  34890.   jednφm z d∞tφ, kterΘ prßv∞ neobsluhuje jinΘho klienta. To znamenß, ╛e kdy╛
  34891.   stejn² klient vznese dal╣φ po╛adavek na stejn² server, tento m∙╛e b²t
  34892.   obslou╛en jin²m d∞tsk²m procesem ne╛ ten prvnφ. Trvalß spojenφ zaji╣╗ujφ, aby
  34893.   se ka╛d² d∞tsk² proces musel na vß╣ SQL server p°ihlßsit pouze p°i prvnφm
  34894.   odeslßnφ strßnky, kterß takovΘ spojenφ vyu╛φvß. Kdy╛ spojenφ s SQL serverem
  34895.   vy╛aduje dal╣φ strßnka, m∙╛e pou╛φt spojenφ, kterΘ toto dφt∞ otev°elo u╛
  34896.   d°φve.
  34897.   </P
  34898. ><P
  34899. >   Poslednφ metodou je pou╛φt PHP jako plug-in v multivlßknovΘm web serveru. Aktußln∞ PHP 4 mß tuto podporu pro ISAPI, WSAPI a NSAPI
  34900.   (na Windows), co╛ umo╛nuje pou╛φvat PHP jako plug-in v multivlßknov²ch serverech
  34901.   jako Netscape FastTrack (iPlanet), Microsoft Internet Information Server (IIS),
  34902.   a O'Reilly's WebSite Pro. Chovßnφ je stejnΘ
  34903.   jako u multiprocesnφm modelu popsanΘm d°φve. Podpora pro SAPI nenφ dostupnß v PHP 3.
  34904.   </P
  34905. ><P
  34906. >   Pokud trvalß spojenφ neposkytujφ ╛ßdnou p°idanou funkcionalitu, k Φemu jsou
  34907.   dobrß?
  34908.   </P
  34909. ><P
  34910. >   Odpov∞∩ na tuto otßzku je velmi jednoduchß - efektivita. Trvalß spojenφ jsou
  34911.   dobrß, pokud mß tvorba spojenφ s va╣φm SQL serverem vysokou re╛ii. Reßlnß
  34912.   v²╣e tΘto re╛ie zßle╛φ na mnoha faktorech. Nap°φklad jak² je to typ databßze,
  34913.   jestli sφdlφ na stejnΘm poΦφtaΦi jako vß╣ webserver, jak zatφ╛en² je stroj,
  34914.   na kterΘm vß╣ SQL server b∞╛φ a tak dßle. Pointa je, ╛e pokud je spojovacφ
  34915.   re╛ie vysokß, trvalß spojenφ vßm znateln∞ pomohou. Umo╛nφ d∞tskΘmu procesu
  34916.   p°ipojit se pouze jednou za cel² jeho ╛ivotnφ cyklus mφsto ka╛dΘho zpracovßnφ
  34917.   strßnky, kterß vy╛aduje spojenφ s SQL serverem. To znamenß, ╛e ka╛dΘ dφt∞,
  34918.   kterΘ otev°elo trvalΘ spojenφ, bude mφt otev°enΘ vlastnφ trvalΘ spojenφ se
  34919.   serverem. Pokud nap°φklad mßte 20 d∞tsk²ch proces∙, kterΘ spustily skript,
  34920.   kter² otev°el trvalΘ spojenφ s va╣φm SQL serverem, mßte 20 nezßvisl²ch spojenφ
  34921.   s SQL serverem, po jednom z ka╛dΘho dφt∞te.
  34922.   </P
  34923. ><P
  34924. >   V╣imn∞te si nicmΘn∞, ╛e to m∙╛e mφt nev²hody, pokud pou╛φvate databßzi s
  34925.   omezen²m poΦtem p°ipojenφ, kter² trvalß spojenφ d∞tφ p°ekroΦφ. Pokud mß va╣e
  34926.   databßze limit 16 souΦasn²ch p°ipojenφ, a v ru╣nΘm okam╛iku se pokusφ p°ipojit
  34927.   17 d∞tsk²ch proces∙, jednomu se to nepoda°φ. Pokud mßte ve sv²ch skriptech
  34928.   chyby, kterΘ brßnφ zavφrßnφ spojenφ (nap°. nekoneΦnΘ smyΦky), databßze s
  34929.   pouh²mi 32 spojenφmi bude brzy zaplavena. Vyhledejte si v dokumentaci va╣φ
  34930.   databßze informace o obsluze opu╣t∞n²ch nebo neΦinn²ch spojenφ.
  34931.   </P
  34932. ><DIV
  34933. CLASS="warning"
  34934. ><P
  34935. ></P
  34936. ><TABLE
  34937. CLASS="warning"
  34938. BORDER="1"
  34939. WIDTH="100%"
  34940. ><TR
  34941. ><TD
  34942. ALIGN="CENTER"
  34943. ><B
  34944. >Varovßnφ</B
  34945. ></TD
  34946. ></TR
  34947. ><TR
  34948. ><TD
  34949. ALIGN="LEFT"
  34950. ><P
  34951. >    Zde je n∞kolik dodateΦn²ch nßmitek, kterΘ se usadily v mysli b∞hem
  34952.    pou╛φvßnφ trval²ch spojenφ. Jedna z nich je, kdy╛ pou╛φvßte zamknutΘ
  34953.    tabulky p°i trvalΘm spojenφ a skript z jakΘhokoli d∙vodu nem∙╛e 
  34954.    uvolnit zßmek, pak nßsledujφcφ skript, kter² pou╛φvß stejnΘ spojenφ, 
  34955.    bude nejspφ╣e na trvalo zablokovßn a mo╛nß bude nutnΘ, abyste
  34956.    poka╛dΘ restartovali http server nebo databßzov² server. 
  34957.    Dßle pak v p°φpad∞ pou╛itφ transakcφ se transakΦnφ blok p°enese i do
  34958.    dal╣φho skriptu pou╛φvajφcφho stejnΘ spojenφ, pokud jeho vykonßnφ
  34959.    konΦφ d°φve ne╛ transakΦnφ blok. V ka╛dΘm p°φpad∞ m∙╛ete pou╛φt
  34960.    <A
  34961. HREF="#function.register-shutdown-function"
  34962. ><B
  34963. CLASS="function"
  34964. >register_shutdown_function()</B
  34965. ></A
  34966. > k registraci a
  34967.    jednoduchΘmu vyΦi╣t∞nφ funkce pro odemknutφ tabulek nebo zru╣enφ
  34968.    b∞╛φcφ transakce (roll back). NejlΘpe se problΘmu vyvarujete ·pln∞
  34969.    nepou╛φvßnφm trval²ch spojenφ ve skriptech, ve kter²ch se zamykajφ
  34970.    tabulky nebo pou╛φvajφ transakce (m∙╛ete je stßle pou╛φvat na
  34971.    mnoh²ch dal╣φch mφstech).
  34972.    </P
  34973. ></TD
  34974. ></TR
  34975. ></TABLE
  34976. ></DIV
  34977. ><P
  34978. >   D∙le╛it² souhrn. Trvalß spojenφ byla navr╛ena tak, aby odpovφdala jedna k
  34979.   jednΘ normßlnφm spojenφm. To znamenß, ╛e byste <SPAN
  34980. CLASS="emphasis"
  34981. ><I
  34982. CLASS="emphasis"
  34983. >v╛dy</I
  34984. ></SPAN
  34985. > m∞li
  34986.   b²t schopni nahradit trvalß spojenφ netrval²mi beze zm∞ny fungovßnφ va╣eho
  34987.   skriptu. <SPAN
  34988. CLASS="emphasis"
  34989. ><I
  34990. CLASS="emphasis"
  34991. >M∙╛e</I
  34992. ></SPAN
  34993. > to (a pravd∞podobn∞ bude) mφt vliv na
  34994.   efektivitu tohoto skriptu, ale ne jeho chovßnφ!
  34995.   </P
  34996. ><P
  34997. >    Dßle takΘ:
  34998.     <A
  34999. HREF="#function.fbsql-pconnect"
  35000. ><B
  35001. CLASS="function"
  35002. >fbsql_pconnect()</B
  35003. ></A
  35004. >,
  35005.    <A
  35006. HREF="#function.ibase-pconnect"
  35007. ><B
  35008. CLASS="function"
  35009. >ibase_pconnect()</B
  35010. ></A
  35011. >,  <A
  35012. HREF="#function.ifx-pconnect"
  35013. ><B
  35014. CLASS="function"
  35015. >ifx_pconnect()</B
  35016. ></A
  35017. >,
  35018.    <B
  35019. CLASS="function"
  35020. >imap_popen()</B
  35021. >, <A
  35022. HREF="#function.ingres-pconnect"
  35023. ><B
  35024. CLASS="function"
  35025. >ingres_pconnect()</B
  35026. ></A
  35027. >,
  35028.    <A
  35029. HREF="#function.msql-pconnect"
  35030. ><B
  35031. CLASS="function"
  35032. >msql_pconnect()</B
  35033. ></A
  35034. >, <A
  35035. HREF="#function.mssql-pconnect"
  35036. ><B
  35037. CLASS="function"
  35038. >mssql_pconnect()</B
  35039. ></A
  35040. >,
  35041.    <A
  35042. HREF="#function.mysql-pconnect"
  35043. ><B
  35044. CLASS="function"
  35045. >mysql_pconnect()</B
  35046. ></A
  35047. >, <A
  35048. HREF="#function.ociplogon"
  35049. ><B
  35050. CLASS="function"
  35051. >OCIPLogon()</B
  35052. ></A
  35053. >,
  35054.    <A
  35055. HREF="#function.odbc-pconnect"
  35056. ><B
  35057. CLASS="function"
  35058. >odbc_pconnect()</B
  35059. ></A
  35060. >, <A
  35061. HREF="#function.ora-plogon"
  35062. ><B
  35063. CLASS="function"
  35064. >Ora_pLogon()</B
  35065. ></A
  35066. >,
  35067.    <A
  35068. HREF="#function.pfsockopen"
  35069. ><B
  35070. CLASS="function"
  35071. >pfsockopen()</B
  35072. ></A
  35073. >, <A
  35074. HREF="#function.pg-pconnect"
  35075. ><B
  35076. CLASS="function"
  35077. >pg_pconnect()</B
  35078. ></A
  35079. > a
  35080.    <A
  35081. HREF="#function.sybase-pconnect"
  35082. ><B
  35083. CLASS="function"
  35084. >sybase_pconnect()</B
  35085. ></A
  35086. >.
  35087.   </P
  35088. ></DIV
  35089. ><DIV
  35090. CLASS="chapter"
  35091. ><HR><H1
  35092. ><A
  35093. NAME="features.safe-mode"
  35094. >Kapitola 22. BezpeΦn² re╛im</A
  35095. ></H1
  35096. ><P
  35097. >    BezpeΦn² re╛im PHP je pokus o °e╣enφ bezpeΦnosti sdφlen²ch server∙.
  35098.    Je architekturßln∞ nekorektnφ pokou╣et se °e╣it tento problΘm na
  35099.    ·rovni PHP, ale proto╛e °e╣enφ na ·rovni webovskΘho serveru a operaΦnφho
  35100.    systΘmu nejsou p°φli╣ realistickß, mnoho lidφ, zvla╣t∞ ISP, pou╛φvß
  35101.    nynφ bezpeΦn² re╛im.    
  35102.   </P
  35103. ><P
  35104. >    KonfiguraΦnφ direktivy, kterΘ ovlßdajφ bezpeΦn² re╛im: 
  35105.    <TABLE
  35106. BORDER="0"
  35107. BGCOLOR="#E0E0E0"
  35108. CELLPADDING="5"
  35109. ><TR
  35110. ><TD
  35111. ><PRE
  35112. CLASS="ini"
  35113. >safe_mode = Off 
  35114. open_basedir = 
  35115. safe_mode_exec_dir = 
  35116. safe_mode_allowed_env_vars = PHP_ 
  35117. safe_mode_protected_env_vars = LD_LIBRARY_PATH 
  35118. disable_functions =</PRE
  35119. ></TD
  35120. ></TR
  35121. ></TABLE
  35122. >
  35123.   </P
  35124. ><P
  35125. >    Pokud je <A
  35126. HREF="#ini.safe-mode"
  35127. >safe_mode</A
  35128. > zapnut², PHP
  35129.    kontroluje, je-li vlastnφk b∞╛φcφho skriptu vlastnφkem souboru, s nφm╛
  35130.    se mß manipulovat. Nap°φklad: 
  35131.    <TABLE
  35132. BORDER="0"
  35133. BGCOLOR="#E0E0E0"
  35134. CELLPADDING="5"
  35135. ><TR
  35136. ><TD
  35137. ><PRE
  35138. CLASS="ls"
  35139. >-rw-rw-r--    1 rasmus   rasmus       33 Jul  1 19:20 script.php 
  35140. -rw-r--r--    1 root     root       1116 May 26 18:01 /etc/passwd</PRE
  35141. ></TD
  35142. ></TR
  35143. ></TABLE
  35144. >
  35145.    Spu╣t∞nφ skriptu script.php 
  35146.    <TABLE
  35147. BORDER="0"
  35148. BGCOLOR="#E0E0E0"
  35149. CELLPADDING="5"
  35150. ><TR
  35151. ><TD
  35152. ><PRE
  35153. CLASS="php"
  35154. ><?php
  35155.  readfile('/etc/passwd'); 
  35156. ?></PRE
  35157. ></TD
  35158. ></TR
  35159. ></TABLE
  35160. >
  35161.    bude mφt v bezpeΦnΘm re╛imu za v²sledek tuto chybu: 
  35162.    <TABLE
  35163. BORDER="0"
  35164. BGCOLOR="#E0E0E0"
  35165. CELLPADDING="5"
  35166. ><TR
  35167. ><TD
  35168. ><PRE
  35169. CLASS="screen"
  35170. >Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not 
  35171. allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2</PRE
  35172. ></TD
  35173. ></TR
  35174. ></TABLE
  35175. >
  35176.   </P
  35177. ><P
  35178. >    Pokud namφsto <A
  35179. HREF="#ini.safe-mode"
  35180. >safe_mode</A
  35181. > nastavφte 
  35182.    adresß° <A
  35183. HREF="#ini.open-basedir"
  35184. >open_basedir</A
  35185. >, potom
  35186.    v╣echny operace se soubory budou omezeny pod specifikovan² adresß°.
  35187.    Nap°φklad (p°φklad Apache httpd.conf): 
  35188.    <TABLE
  35189. BORDER="0"
  35190. BGCOLOR="#E0E0E0"
  35191. CELLPADDING="5"
  35192. ><TR
  35193. ><TD
  35194. ><PRE
  35195. CLASS="ini"
  35196. ><Directory /docroot>
  35197.   php_admin_value open_basedir /docroot 
  35198. </Directory></PRE
  35199. ></TD
  35200. ></TR
  35201. ></TABLE
  35202. >
  35203.    Kdy╛ spustφte tent²╛ soubor script.php s timto nastavenφm
  35204.    <A
  35205. HREF="#ini.open-basedir"
  35206. >open_basedir</A
  35207. >, dostanete tento
  35208.    v²sledek:
  35209.    <TABLE
  35210. BORDER="0"
  35211. BGCOLOR="#E0E0E0"
  35212. CELLPADDING="5"
  35213. ><TR
  35214. ><TD
  35215. ><PRE
  35216. CLASS="screen"
  35217. >Warning: open_basedir restriction in effect. File is in wrong directory in 
  35218. /docroot/script.php on line 2</PRE
  35219. ></TD
  35220. ></TR
  35221. ></TABLE
  35222. >
  35223.   </P
  35224. ><P
  35225. >    M∙╛ete takΘ vypnout jednotlivΘ funkce. Pokud p°idßme toto do souboru
  35226.    php.ini:    
  35227.    <TABLE
  35228. BORDER="0"
  35229. BGCOLOR="#E0E0E0"
  35230. CELLPADDING="5"
  35231. ><TR
  35232. ><TD
  35233. ><PRE
  35234. CLASS="ini"
  35235. >disable_functions readfile,system</PRE
  35236. ></TD
  35237. ></TR
  35238. ></TABLE
  35239. >
  35240.    zφskßme takov²to v²stup: 
  35241.    <TABLE
  35242. BORDER="0"
  35243. BGCOLOR="#E0E0E0"
  35244. CELLPADDING="5"
  35245. ><TR
  35246. ><TD
  35247. ><PRE
  35248. CLASS="screen"
  35249. >Warning: readfile() has been disabled for security reasons in 
  35250. /docroot/script.php on line 2</PRE
  35251. ></TD
  35252. ></TR
  35253. ></TABLE
  35254. >
  35255.   </P
  35256. ><DIV
  35257. CLASS="sect1"
  35258. ><HR><H2
  35259. CLASS="sect1"
  35260. ><A
  35261. NAME="features.safe-mode.functions"
  35262. ></A
  35263. >Funkce omezenΘ/deaktivovanΘ v bezpeΦnΘm re╛imu</H2
  35264. ><P
  35265. >     Toto je pravd∞podobn∞ ne·pln² a mo╛nß nesprßvn² p°ehled funkcφ
  35266.     omezen²ch v 
  35267.     <A
  35268. HREF="#features.safe-mode"
  35269. >bezpeΦnΘm re╛imu</A
  35270. >.
  35271.     
  35272.     <DIV
  35273. CLASS="table"
  35274. ><A
  35275. NAME="AEN6357"
  35276. ></A
  35277. ><P
  35278. ><B
  35279. >Tabulka 22-1. Funkce omezenΘ v bezpeΦnΘm re╛imu</B
  35280. ></P
  35281. ><TABLE
  35282. BORDER="1"
  35283. CLASS="CALSTABLE"
  35284. ><THEAD
  35285. ><TR
  35286. ><TH
  35287. ALIGN="LEFT"
  35288. VALIGN="MIDDLE"
  35289. >Funkce</TH
  35290. ><TH
  35291. ALIGN="LEFT"
  35292. VALIGN="MIDDLE"
  35293. >Omezenφ</TH
  35294. ></TR
  35295. ></THEAD
  35296. ><TBODY
  35297. ><TR
  35298. ><TD
  35299. ALIGN="LEFT"
  35300. VALIGN="MIDDLE"
  35301. ><A
  35302. HREF="#function.dbmopen"
  35303. ><B
  35304. CLASS="function"
  35305. >dbmopen()</B
  35306. ></A
  35307. ></TD
  35308. ><TD
  35309. ALIGN="LEFT"
  35310. VALIGN="MIDDLE"
  35311. >Kontroluje, zda soubory/adresß°e,
  35312. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript.</TD
  35313. ></TR
  35314. ><TR
  35315. ><TD
  35316. ALIGN="LEFT"
  35317. VALIGN="MIDDLE"
  35318. ><A
  35319. HREF="#function.dbase-open"
  35320. ><B
  35321. CLASS="function"
  35322. >dbase_open()</B
  35323. ></A
  35324. ></TD
  35325. ><TD
  35326. ALIGN="LEFT"
  35327. VALIGN="MIDDLE"
  35328. >Kontroluje, zda soubory/adresß°e,
  35329. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript.</TD
  35330. ></TR
  35331. ><TR
  35332. ><TD
  35333. ALIGN="LEFT"
  35334. VALIGN="MIDDLE"
  35335. ><A
  35336. HREF="#function.filepro"
  35337. ><B
  35338. CLASS="function"
  35339. >filepro()</B
  35340. ></A
  35341. ></TD
  35342. ><TD
  35343. ALIGN="LEFT"
  35344. VALIGN="MIDDLE"
  35345. >Kontroluje, zda soubory/adresß°e,
  35346. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript.</TD
  35347. ></TR
  35348. ><TR
  35349. ><TD
  35350. ALIGN="LEFT"
  35351. VALIGN="MIDDLE"
  35352. ><A
  35353. HREF="#function.filepro-rowcount"
  35354. ><B
  35355. CLASS="function"
  35356. >filepro_rowcount()</B
  35357. ></A
  35358. ></TD
  35359. ><TD
  35360. ALIGN="LEFT"
  35361. VALIGN="MIDDLE"
  35362. >Kontroluje, zda soubory/adresß°e,
  35363. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript.</TD
  35364. ></TR
  35365. ><TR
  35366. ><TD
  35367. ALIGN="LEFT"
  35368. VALIGN="MIDDLE"
  35369. ><A
  35370. HREF="#function.filepro-retrieve"
  35371. ><B
  35372. CLASS="function"
  35373. >filepro_retrieve()</B
  35374. ></A
  35375. ></TD
  35376. ><TD
  35377. ALIGN="LEFT"
  35378. VALIGN="MIDDLE"
  35379. >Kontroluje, zda soubory/adresß°e,
  35380. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript.</TD
  35381. ></TR
  35382. ><TR
  35383. ><TD
  35384. ALIGN="LEFT"
  35385. VALIGN="MIDDLE"
  35386. ><B
  35387. CLASS="function"
  35388. >ifx_*()</B
  35389. ></TD
  35390. ><TD
  35391. ALIGN="LEFT"
  35392. VALIGN="MIDDLE"
  35393. >sql_safe_mode restrictions, (!= safe mode)</TD
  35394. ></TR
  35395. ><TR
  35396. ><TD
  35397. ALIGN="LEFT"
  35398. VALIGN="MIDDLE"
  35399. ><B
  35400. CLASS="function"
  35401. >ingres_*()</B
  35402. ></TD
  35403. ><TD
  35404. ALIGN="LEFT"
  35405. VALIGN="MIDDLE"
  35406. >sql_safe_mode restrictions, (!= safe mode)</TD
  35407. ></TR
  35408. ><TR
  35409. ><TD
  35410. ALIGN="LEFT"
  35411. VALIGN="MIDDLE"
  35412. ><B
  35413. CLASS="function"
  35414. >mysql_*()</B
  35415. ></TD
  35416. ><TD
  35417. ALIGN="LEFT"
  35418. VALIGN="MIDDLE"
  35419. >sql_safe_mode restrictions, (!= safe mode)</TD
  35420. ></TR
  35421. ><TR
  35422. ><TD
  35423. ALIGN="LEFT"
  35424. VALIGN="MIDDLE"
  35425. ><B
  35426. CLASS="function"
  35427. >pg_loimport()</B
  35428. ></TD
  35429. ><TD
  35430. ALIGN="LEFT"
  35431. VALIGN="MIDDLE"
  35432. >Kontroluje, zda soubory/adresß°e,
  35433. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript.</TD
  35434. ></TR
  35435. ><TR
  35436. ><TD
  35437. ALIGN="LEFT"
  35438. VALIGN="MIDDLE"
  35439. ><A
  35440. HREF="#function.posix-mkfifo"
  35441. ><B
  35442. CLASS="function"
  35443. >posix_mkfifo()</B
  35444. ></A
  35445. ></TD
  35446. ><TD
  35447. ALIGN="LEFT"
  35448. VALIGN="MIDDLE"
  35449. >Kontroluje, zda adresß°,
  35450. ve kterΘm pracujete, mß stejnΘ UID jako spu╣t∞n² skript.</TD
  35451. ></TR
  35452. ><TR
  35453. ><TD
  35454. ALIGN="LEFT"
  35455. VALIGN="MIDDLE"
  35456. ><A
  35457. HREF="#function.putenv"
  35458. ><B
  35459. CLASS="function"
  35460. >putenv()</B
  35461. ></A
  35462. ></TD
  35463. ><TD
  35464. ALIGN="LEFT"
  35465. VALIGN="MIDDLE"
  35466. >Obeys the safe_mode_protected_env_vars and 
  35467.         safe_mode_allowed_env_vars ini-directives. Viz takΘ dokumentaci
  35468.     <A
  35469. HREF="#function.putenv"
  35470. ><B
  35471. CLASS="function"
  35472. >putenv()</B
  35473. ></A
  35474. ></TD
  35475. ></TR
  35476. ><TR
  35477. ><TD
  35478. ALIGN="LEFT"
  35479. VALIGN="MIDDLE"
  35480. ><A
  35481. HREF="#function.move-uploaded-file"
  35482. ><B
  35483. CLASS="function"
  35484. >move_uploaded_file()</B
  35485. ></A
  35486. ></TD
  35487. ><TD
  35488. ALIGN="LEFT"
  35489. VALIGN="MIDDLE"
  35490. >Kontroluje, zda soubory/adresß°e,
  35491. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript. </TD
  35492. ></TR
  35493. ><TR
  35494. ><TD
  35495. ALIGN="LEFT"
  35496. VALIGN="MIDDLE"
  35497. ><A
  35498. HREF="#function.chdir"
  35499. ><B
  35500. CLASS="function"
  35501. >chdir()</B
  35502. ></A
  35503. ></TD
  35504. ><TD
  35505. ALIGN="LEFT"
  35506. VALIGN="MIDDLE"
  35507. >Kontroluje, zda adresß°,
  35508. ve kterΘm pracujete, mß stejnΘ UID jako spu╣t∞n² skript.</TD
  35509. ></TR
  35510. ><TR
  35511. ><TD
  35512. ALIGN="LEFT"
  35513. VALIGN="MIDDLE"
  35514. ><A
  35515. HREF="#function.dl"
  35516. ><B
  35517. CLASS="function"
  35518. >dl()</B
  35519. ></A
  35520. ></TD
  35521. ><TD
  35522. ALIGN="LEFT"
  35523. VALIGN="MIDDLE"
  35524. >Tyto funkce jsou v bezpeΦnΘm re╛imu (<A
  35525. HREF="#features.safe-mode"
  35526. >safe-mode</A
  35527. >) deaktivovßny.</TD
  35528. ></TR
  35529. ><TR
  35530. ><TD
  35531. ALIGN="LEFT"
  35532. VALIGN="MIDDLE"
  35533. ><A
  35534. HREF="#language.operators.execution"
  35535. >backtick operßtor</A
  35536. ></TD
  35537. ><TD
  35538. ALIGN="LEFT"
  35539. VALIGN="MIDDLE"
  35540. >Tyto funkce jsou v bezpeΦnΘm re╛imu (<A
  35541. HREF="#features.safe-mode"
  35542. >safe-mode</A
  35543. >) deaktivovßny.</TD
  35544. ></TR
  35545. ><TR
  35546. ><TD
  35547. ALIGN="LEFT"
  35548. VALIGN="MIDDLE"
  35549. ><A
  35550. HREF="#function.shell-exec"
  35551. ><B
  35552. CLASS="function"
  35553. >shell_exec()</B
  35554. ></A
  35555. > (funkΦnφ ekvivalent backticks)</TD
  35556. ><TD
  35557. ALIGN="LEFT"
  35558. VALIGN="MIDDLE"
  35559. >Tyto funkce jsou v bezpeΦnΘm re╛imu (<A
  35560. HREF="#features.safe-mode"
  35561. >safe-mode</A
  35562. >) deaktivovßny.</TD
  35563. ></TR
  35564. ><TR
  35565. ><TD
  35566. ALIGN="LEFT"
  35567. VALIGN="MIDDLE"
  35568. ><A
  35569. HREF="#function.exec"
  35570. ><B
  35571. CLASS="function"
  35572. >exec()</B
  35573. ></A
  35574. ></TD
  35575. ><TD
  35576. ALIGN="LEFT"
  35577. VALIGN="MIDDLE"
  35578. >M∙╛ete spou╣t∞t programy pouze uvnit° adresß°e <A
  35579. HREF="#ini.safe-mode-exec-dir"
  35580. >safe_mode_exec_dir</A
  35581. >.
  35582.         Z praktick²ch d∙vod∙ nenφ momentßln∞ mo╛nΘ mφt v cest∞ k souboru
  35583.     s programem komponenty <TT
  35584. CLASS="literal"
  35585. >..</TT
  35586. >.</TD
  35587. ></TR
  35588. ><TR
  35589. ><TD
  35590. ALIGN="LEFT"
  35591. VALIGN="MIDDLE"
  35592. ><A
  35593. HREF="#function.system"
  35594. ><B
  35595. CLASS="function"
  35596. >system()</B
  35597. ></A
  35598. ></TD
  35599. ><TD
  35600. ALIGN="LEFT"
  35601. VALIGN="MIDDLE"
  35602. >M∙╛ete spou╣t∞t programy pouze uvnit° adresß°e <A
  35603. HREF="#ini.safe-mode-exec-dir"
  35604. >safe_mode_exec_dir</A
  35605. >.
  35606.         Z praktick²ch d∙vod∙ nenφ momentßln∞ mo╛nΘ mφt v cest∞ k souboru
  35607.     s programem komponenty <TT
  35608. CLASS="literal"
  35609. >..</TT
  35610. >.</TD
  35611. ></TR
  35612. ><TR
  35613. ><TD
  35614. ALIGN="LEFT"
  35615. VALIGN="MIDDLE"
  35616. ><A
  35617. HREF="#function.passthru"
  35618. ><B
  35619. CLASS="function"
  35620. >passthru()</B
  35621. ></A
  35622. ></TD
  35623. ><TD
  35624. ALIGN="LEFT"
  35625. VALIGN="MIDDLE"
  35626. >M∙╛ete spou╣t∞t programy pouze uvnit° adresß°e <A
  35627. HREF="#ini.safe-mode-exec-dir"
  35628. >safe_mode_exec_dir</A
  35629. >.
  35630.         Z praktick²ch d∙vod∙ nenφ momentßln∞ mo╛nΘ mφt v cest∞ k souboru
  35631.     s programem komponenty <TT
  35632. CLASS="literal"
  35633. >..</TT
  35634. >.</TD
  35635. ></TR
  35636. ><TR
  35637. ><TD
  35638. ALIGN="LEFT"
  35639. VALIGN="MIDDLE"
  35640. ><A
  35641. HREF="#function.popen"
  35642. ><B
  35643. CLASS="function"
  35644. >popen()</B
  35645. ></A
  35646. ></TD
  35647. ><TD
  35648. ALIGN="LEFT"
  35649. VALIGN="MIDDLE"
  35650. >M∙╛ete spou╣t∞t programy pouze uvnit° adresß°e <A
  35651. HREF="#ini.safe-mode-exec-dir"
  35652. >safe_mode_exec_dir</A
  35653. >.
  35654.         Z praktick²ch d∙vod∙ nenφ momentßln∞ mo╛nΘ mφt v cest∞ k souboru
  35655.     s programem komponenty <TT
  35656. CLASS="literal"
  35657. >..</TT
  35658. >.</TD
  35659. ></TR
  35660. ><TR
  35661. ><TD
  35662. ALIGN="LEFT"
  35663. VALIGN="MIDDLE"
  35664. ><A
  35665. HREF="#function.mkdir"
  35666. ><B
  35667. CLASS="function"
  35668. >mkdir()</B
  35669. ></A
  35670. ></TD
  35671. ><TD
  35672. ALIGN="LEFT"
  35673. VALIGN="MIDDLE"
  35674. >Kontroluje, zda adresß°,
  35675. ve kterΘm pracujete, mß stejnΘ UID jako spu╣t∞n² skript.</TD
  35676. ></TR
  35677. ><TR
  35678. ><TD
  35679. ALIGN="LEFT"
  35680. VALIGN="MIDDLE"
  35681. ><A
  35682. HREF="#function.rmdir"
  35683. ><B
  35684. CLASS="function"
  35685. >rmdir()</B
  35686. ></A
  35687. ></TD
  35688. ><TD
  35689. ALIGN="LEFT"
  35690. VALIGN="MIDDLE"
  35691. >Kontroluje, zda soubory/adresß°e,
  35692. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript.</TD
  35693. ></TR
  35694. ><TR
  35695. ><TD
  35696. ALIGN="LEFT"
  35697. VALIGN="MIDDLE"
  35698. ><A
  35699. HREF="#function.rename"
  35700. ><B
  35701. CLASS="function"
  35702. >rename()</B
  35703. ></A
  35704. ></TD
  35705. ><TD
  35706. ALIGN="LEFT"
  35707. VALIGN="MIDDLE"
  35708. >Kontroluje, zda soubory/adresß°e,
  35709. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript. Kontroluje, zda adresß°,
  35710. ve kterΘm pracujete, mß stejnΘ UID jako spu╣t∞n² skript.</TD
  35711. ></TR
  35712. ><TR
  35713. ><TD
  35714. ALIGN="LEFT"
  35715. VALIGN="MIDDLE"
  35716. ><A
  35717. HREF="#function.unlink"
  35718. ><B
  35719. CLASS="function"
  35720. >unlink()</B
  35721. ></A
  35722. ></TD
  35723. ><TD
  35724. ALIGN="LEFT"
  35725. VALIGN="MIDDLE"
  35726. >Kontroluje, zda soubory/adresß°e,
  35727. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript. Kontroluje, zda adresß°,
  35728. ve kterΘm pracujete, mß stejnΘ UID jako spu╣t∞n² skript.</TD
  35729. ></TR
  35730. ><TR
  35731. ><TD
  35732. ALIGN="LEFT"
  35733. VALIGN="MIDDLE"
  35734. ><A
  35735. HREF="#function.copy"
  35736. ><B
  35737. CLASS="function"
  35738. >copy()</B
  35739. ></A
  35740. ></TD
  35741. ><TD
  35742. ALIGN="LEFT"
  35743. VALIGN="MIDDLE"
  35744. >Kontroluje, zda soubory/adresß°e,
  35745. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript. Kontroluje, zda adresß°,
  35746. ve kterΘm pracujete, mß stejnΘ UID jako spu╣t∞n² skript. (pro 
  35747.         <TT
  35748. CLASS="parameter"
  35749. ><I
  35750. >source</I
  35751. ></TT
  35752. > a 
  35753.         <TT
  35754. CLASS="parameter"
  35755. ><I
  35756. >target</I
  35757. ></TT
  35758. >) </TD
  35759. ></TR
  35760. ><TR
  35761. ><TD
  35762. ALIGN="LEFT"
  35763. VALIGN="MIDDLE"
  35764. ><A
  35765. HREF="#function.chgrp"
  35766. ><B
  35767. CLASS="function"
  35768. >chgrp()</B
  35769. ></A
  35770. ></TD
  35771. ><TD
  35772. ALIGN="LEFT"
  35773. VALIGN="MIDDLE"
  35774. >Kontroluje, zda soubory/adresß°e,
  35775. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript.</TD
  35776. ></TR
  35777. ><TR
  35778. ><TD
  35779. ALIGN="LEFT"
  35780. VALIGN="MIDDLE"
  35781. ><A
  35782. HREF="#function.chown"
  35783. ><B
  35784. CLASS="function"
  35785. >chown()</B
  35786. ></A
  35787. ></TD
  35788. ><TD
  35789. ALIGN="LEFT"
  35790. VALIGN="MIDDLE"
  35791. >Kontroluje, zda soubory/adresß°e,
  35792. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript.</TD
  35793. ></TR
  35794. ><TR
  35795. ><TD
  35796. ALIGN="LEFT"
  35797. VALIGN="MIDDLE"
  35798. ><A
  35799. HREF="#function.chmod"
  35800. ><B
  35801. CLASS="function"
  35802. >chmod()</B
  35803. ></A
  35804. ></TD
  35805. ><TD
  35806. ALIGN="LEFT"
  35807. VALIGN="MIDDLE"
  35808. >Kontroluje, zda soubory/adresß°e,
  35809. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript. Navφc nem∙╛ete nastavovat  
  35810.         SUID, SGID a sticky bit</TD
  35811. ></TR
  35812. ><TR
  35813. ><TD
  35814. ALIGN="LEFT"
  35815. VALIGN="MIDDLE"
  35816. ><A
  35817. HREF="#function.touch"
  35818. ><B
  35819. CLASS="function"
  35820. >touch()</B
  35821. ></A
  35822. ></TD
  35823. ><TD
  35824. ALIGN="LEFT"
  35825. VALIGN="MIDDLE"
  35826. >Kontroluje, zda soubory/adresß°e,
  35827. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript. Kontroluje, zda adresß°,
  35828. ve kterΘm pracujete, mß stejnΘ UID jako spu╣t∞n² skript.</TD
  35829. ></TR
  35830. ><TR
  35831. ><TD
  35832. ALIGN="LEFT"
  35833. VALIGN="MIDDLE"
  35834. ><A
  35835. HREF="#function.symlink"
  35836. ><B
  35837. CLASS="function"
  35838. >symlink()</B
  35839. ></A
  35840. ></TD
  35841. ><TD
  35842. ALIGN="LEFT"
  35843. VALIGN="MIDDLE"
  35844. >Kontroluje, zda soubory/adresß°e,
  35845. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript. Kontroluje, zda adresß°,
  35846. ve kterΘm pracujete, mß stejnΘ UID jako spu╣t∞n² skript. (pozn.: testovßn je pouze
  35847.     cφl)</TD
  35848. ></TR
  35849. ><TR
  35850. ><TD
  35851. ALIGN="LEFT"
  35852. VALIGN="MIDDLE"
  35853. ><A
  35854. HREF="#function.link"
  35855. ><B
  35856. CLASS="function"
  35857. >link()</B
  35858. ></A
  35859. ></TD
  35860. ><TD
  35861. ALIGN="LEFT"
  35862. VALIGN="MIDDLE"
  35863. >Kontroluje, zda soubory/adresß°e,
  35864. se kter²mi pracujete, majφ stejnΘ UID jako spu╣t∞n² skript. Kontroluje, zda adresß°,
  35865. ve kterΘm pracujete, mß stejnΘ UID jako spu╣t∞n² skript. (pozn.: testovßn je pouze
  35866.     cφl)</TD
  35867. ></TR
  35868. ><TR
  35869. ><TD
  35870. ALIGN="LEFT"
  35871. VALIGN="MIDDLE"
  35872. ><A
  35873. HREF="#function.getallheaders"
  35874. ><B
  35875. CLASS="function"
  35876. >getallheaders()</B
  35877. ></A
  35878. ></TD
  35879. ><TD
  35880. ALIGN="LEFT"
  35881. VALIGN="MIDDLE"
  35882. >V bezpeΦnΘm re╛imu nebudou hlaviΦky zaΦφnajφcφ 'authorization'
  35883.     (bez ohledu na velikost pφsmen) vraceny. Varovßnφ: toto nefunguje
  35884.     s aol-server implementacφ <A
  35885. HREF="#function.getallheaders"
  35886. ><B
  35887. CLASS="function"
  35888. >getallheaders()</B
  35889. ></A
  35890. >!</TD
  35891. ></TR
  35892. ><TR
  35893. ><TD
  35894. ALIGN="LEFT"
  35895. VALIGN="MIDDLE"
  35896. >JakΘkoli funkce kterΘ pou╛φvajφ 
  35897.          <TT
  35898. CLASS="filename"
  35899. >php4/main/fopen_wrappers.c</TT
  35900. >
  35901.         </TD
  35902. ><TD
  35903. ALIGN="LEFT"
  35904. VALIGN="MIDDLE"
  35905. >??</TD
  35906. ></TR
  35907. ></TBODY
  35908. ></TABLE
  35909. ></DIV
  35910. >
  35911.    </P
  35912. ></DIV
  35913. ></DIV
  35914. ><DIV
  35915. CLASS="chapter"
  35916. ><HR><H1
  35917. ><A
  35918. NAME="features.commandline"
  35919. >Kapitola 23. Pou╛itφ PHP z p°φkazovΘ °ßdky</A
  35920. ></H1
  35921. ><P
  35922. >   Mo╛nosti PHP p°i spou╣t∞nφ z p°φkazovΘ °ßdky p°inß╣ejφ mnoho u╛itku,
  35923.   pokud chcete ladit nebo testovat va╣e nastavenφ PHP, hodφ se v╣ak
  35924.   i pro p°φpady, kdy byste rßdi pou╛ili PHP pro jinΘ ·Φely ne╛ WWW
  35925.   skriptovßnφ.  
  35926.  </P
  35927. ><P
  35928. >   Uv∞domte si, ╛e m∙╛ete v╛dy sm∞rovat v²stup programu PHP do vn∞j╣φho
  35929.   souboru pomocφ znaku >, tak╛e <TT
  35930. CLASS="literal"
  35931. >php -q test.php >
  35932.   test.html</TT
  35933. > vytiskne v²stup <TT
  35934. CLASS="filename"
  35935. >test.php</TT
  35936. >
  35937.   bez HTTP hlaviΦek do <TT
  35938. CLASS="filename"
  35939. >test.html</TT
  35940. > ve stejnΘm adresß°i.  
  35941.  </P
  35942. ><P
  35943. >   Mo╛nosti p°φkazovΘ °ßdky m∙╛ete vyu╛φvat pouze tehdy, mßte-li (spustiteln²)
  35944.   program PHP. Pokud jste zkompilovali pouze modul do serveru a nemßte na
  35945.   poΦφtaΦi ╛ßdnou CGI verzi, nem∙╛ete p°φkazovou °ßdku pou╛φvat.
  35946.   Pro u╛ivatele Windows je v binßrnφm balφΦku jak serverov² modul, tak
  35947.   spustiteln² soubor nazvan² <TT
  35948. CLASS="filename"
  35949. >php.exe</TT
  35950. >.
  35951.  </P
  35952. ><P
  35953. >   Tento seznem voleb pro p°φkazovou °ßdku je konzistentnφ s PHP 4.0.6.
  35954.   Aktußlnφ seznam vΦetn∞ jedno°ßdkov²ch popis∙ m∙╛ete zφskat pomocφ parametru
  35955.   <TT
  35956. CLASS="literal"
  35957. >-h</TT
  35958. >. V²stup <TT
  35959. CLASS="literal"
  35960. >php -h</TT
  35961. > by m∞l vypadat
  35962.   p°ibli╛n∞ takto:  
  35963.   <TABLE
  35964. BORDER="0"
  35965. BGCOLOR="#E0E0E0"
  35966. CELLPADDING="5"
  35967. ><TR
  35968. ><TD
  35969. ><PRE
  35970. CLASS="screen"
  35971. >Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>] |  {<file> [args...]}
  35972.   -q             Quiet-mode.  Suppress HTTP Header output.
  35973.   -s             Display colour syntax highlighted source.
  35974.   -f <file>      Parse <file>.  Implies `-q'
  35975.   -v             Version number
  35976.   -C             Do not chdir to the script's directory
  35977.   -c <path>      Look for php.ini file in this directory
  35978.   -d foo[=bar]   Define INI entry foo with value 'bar'
  35979.   -e             Generate extended information for debugger/profiler
  35980.   -z <file>      Load Zend extension <file>.
  35981.   -l             Syntax check only (lint)
  35982.   -m             Show compiled in modules
  35983.   -i             PHP information
  35984.   -h             This help</PRE
  35985. ></TD
  35986. ></TR
  35987. ></TABLE
  35988. >
  35989.  </P
  35990. ><P
  35991. >   Zde uvßdφme n∞kterΘ z nejd∙le╛it∞j╣φch voleb s detailnφm vysv∞tlenφm.  
  35992.  </P
  35993. ><P
  35994. >   <DIV
  35995. CLASS="table"
  35996. ><A
  35997. NAME="AEN6527"
  35998. ></A
  35999. ><P
  36000. ><B
  36001. >Tabulka 23-1. Volby pro p°φkazovou °ßdku</B
  36002. ></P
  36003. ><TABLE
  36004. BORDER="1"
  36005. CLASS="CALSTABLE"
  36006. ><THEAD
  36007. ><TR
  36008. ><TH
  36009. ALIGN="LEFT"
  36010. VALIGN="MIDDLE"
  36011. >Volba</TH
  36012. ><TH
  36013. ALIGN="LEFT"
  36014. VALIGN="MIDDLE"
  36015. >Popis</TH
  36016. ></TR
  36017. ></THEAD
  36018. ><TBODY
  36019. ><TR
  36020. ><TD
  36021. ALIGN="LEFT"
  36022. VALIGN="MIDDLE"
  36023. >-q</TD
  36024. ><TD
  36025. ALIGN="LEFT"
  36026. VALIGN="MIDDLE"
  36027. >        PotlaΦφ v²stup HTTP hlaviΦek. Normßln∞ PHP tiskne HTTP hlaviΦky
  36028.        pro volajφcφ program (typicky WWW server) k p°edßnφ prohlφ╛eΦi.
  36029.        P°i pou╛itφ pro aplikace spou╣t∞nΘ z p°φkazovΘ °ßdky nemajφ hlaviΦky
  36030.        smysl.
  36031.       </TD
  36032. ></TR
  36033. ><TR
  36034. ><TD
  36035. ALIGN="LEFT"
  36036. VALIGN="MIDDLE"
  36037. >-s</TD
  36038. ><TD
  36039. ALIGN="LEFT"
  36040. VALIGN="MIDDLE"
  36041. >        Zobrazφ barevn∞ vysvφcen² zdrojov² soubor s dan²m nßzvem.
  36042.        Je to totΘ╛, jako kdy╛ se zdroj vytiskne pomocφ funkce
  36043.        <A
  36044. HREF="#function.highlight-file"
  36045. ><B
  36046. CLASS="function"
  36047. >highlight_file()</B
  36048. ></A
  36049. > v PHP skriptu.
  36050.       </TD
  36051. ></TR
  36052. ><TR
  36053. ><TD
  36054. ALIGN="LEFT"
  36055. VALIGN="MIDDLE"
  36056. >-f</TD
  36057. ><TD
  36058. ALIGN="LEFT"
  36059. VALIGN="MIDDLE"
  36060. >        Parsuje dan² soubor a hledß syntaktickΘ a fatßlnφ chyby.
  36061.        Tato volba implikuje -q. Pou╛ijte pro ladicφ ·Φely
  36062.        (debugging).       
  36063.       </TD
  36064. ></TR
  36065. ><TR
  36066. ><TD
  36067. ALIGN="LEFT"
  36068. VALIGN="MIDDLE"
  36069. >-v</TD
  36070. ><TD
  36071. ALIGN="LEFT"
  36072. VALIGN="MIDDLE"
  36073. >        Zavolßnφm PHP s tφmto p°epφnaΦem si m∙╛ete vypsat Φφslo verze,
  36074.        nap°. 4.0.6.        
  36075.       </TD
  36076. ></TR
  36077. ><TR
  36078. ><TD
  36079. ALIGN="LEFT"
  36080. VALIGN="MIDDLE"
  36081. >-C</TD
  36082. ><TD
  36083. ALIGN="LEFT"
  36084. VALIGN="MIDDLE"
  36085. >        Za normßlnφch okolnostφ PHP m∞nφ pracovnφ adresß° na ten, kde se
  36086.        nachßzφ spou╣t∞n² skript. To nap°φklad umo╛≥uje otvφrat soubory
  36087.        ve stejnΘm adresß°i urΦenφm pouhΘho nßzvu souboru (bez cesty).
  36088.        Pokud byste toto cht∞li potlaΦit, pou╛ijte tuto volbu.       
  36089.       </TD
  36090. ></TR
  36091. ><TR
  36092. ><TD
  36093. ALIGN="LEFT"
  36094. VALIGN="MIDDLE"
  36095. >-c</TD
  36096. ><TD
  36097. ALIGN="LEFT"
  36098. VALIGN="MIDDLE"
  36099. >        Pou╛itφm tohoto argumentu m∙╛ete specifikovat alternativnφ
  36100.        umφst∞nφ souboru <TT
  36101. CLASS="filename"
  36102. >php.ini</TT
  36103. >, tak╛e PHP bude
  36104.        hledat konfiguraΦnφ soubor zde namφsto implicitnφho umφst∞nφ.       
  36105.       </TD
  36106. ></TR
  36107. ><TR
  36108. ><TD
  36109. ALIGN="LEFT"
  36110. VALIGN="MIDDLE"
  36111. >-d</TD
  36112. ><TD
  36113. ALIGN="LEFT"
  36114. VALIGN="MIDDLE"
  36115. >        Touto volbou m∙╛ete provΘst individußlnφ nastavenφ        
  36116.        <TT
  36117. CLASS="filename"
  36118. >php.ini</TT
  36119. > b∞hem provßd∞nφ skriptu.
  36120.       </TD
  36121. ></TR
  36122. ><TR
  36123. ><TD
  36124. ALIGN="LEFT"
  36125. VALIGN="MIDDLE"
  36126. >-l</TD
  36127. ><TD
  36128. ALIGN="LEFT"
  36129. VALIGN="MIDDLE"
  36130. >        Otestuje dan² soubor na syntaktickΘ chyby. Tato volba implikuje
  36131.        -q. Pou╛ijte ji pro ·Φely lad∞nφ. Nebudou se hledat fatßlnφ chyby
  36132.        (jako jsou nedefinovanΘ funkce). Pokud chcete hledat i fatßlnφ
  36133.        chyby, pou╛ijte -f.       
  36134.       </TD
  36135. ></TR
  36136. ><TR
  36137. ><TD
  36138. ALIGN="LEFT"
  36139. VALIGN="MIDDLE"
  36140. >-m</TD
  36141. ><TD
  36142. ALIGN="LEFT"
  36143. VALIGN="MIDDLE"
  36144. >        Pou╛itφm tΘto volby PHP vypφ╣e zabudovanΘ (a naΦtenΘ) PHP a Zend
  36145.        moduly, Φφsla verzφ PHP a Zend, a takΘ krßtkou informaci o
  36146.        autorsk²ch prßvech k jßdru Zend.       
  36147.       </TD
  36148. ></TR
  36149. ><TR
  36150. ><TD
  36151. ALIGN="LEFT"
  36152. VALIGN="MIDDLE"
  36153. >-i</TD
  36154. ><TD
  36155. ALIGN="LEFT"
  36156. VALIGN="MIDDLE"
  36157. >        Tento p°epφnaΦ zavolß funkci <A
  36158. HREF="#function.phpinfo"
  36159. ><B
  36160. CLASS="function"
  36161. >phpinfo()</B
  36162. ></A
  36163. > a vypφ╣e
  36164.        jejφ v²sledek. Pokud PHP nepracuje sprßvn∞, je dobrΘ spustit
  36165.        <TT
  36166. CLASS="literal"
  36167. >php -i</TT
  36168. > a podφvat se, zda se nevypsala n∞jakß
  36169.        chybovß hlß╣enφ p°ed nebo uvnit° informaΦnφch tabulek.
  36170.       </TD
  36171. ></TR
  36172. ><TR
  36173. ><TD
  36174. ALIGN="LEFT"
  36175. VALIGN="MIDDLE"
  36176. >-h</TD
  36177. ><TD
  36178. ALIGN="LEFT"
  36179. VALIGN="MIDDLE"
  36180. >        Touto volbou zφskßte informace o aktußlnφch volbßch p°φkazovΘ °ßdky
  36181.        a jedno°ßdkovΘ popisy o tom, co d∞lajφ.       
  36182.       </TD
  36183. ></TR
  36184. ></TBODY
  36185. ></TABLE
  36186. ></DIV
  36187. >
  36188.  </P
  36189. ><P
  36190. >   Spustitelnß verze PHP m∙╛e b²t pou╛ita pro spou╣t∞nφ skript∙ absolutn∞
  36191.   nezßvisle na webovskΘm serveru. Pokud jste na unixovΘm systΘmu, m∙╛ete
  36192.   do PHP skriptu p°idat specißlnφ prvnφ °ßdek a ud∞lat z n∞j spustiteln²
  36193.   program - systΘm bude v∞d∞t, jak² program by m∞l skript zpracovßvat.
  36194.   Na Windows m∙╛ete asociovat <TT
  36195. CLASS="literal"
  36196. >php.exe -q</TT
  36197. > se souborovou
  36198.   p°φponou <TT
  36199. CLASS="literal"
  36200. >.php</TT
  36201. > (pro spou╣t∞nφ dvojklikem), nebo m∙╛ete
  36202.   vytvo°it dßvkov² soubor pro spu╣t∞nφ skriptu p°es PHP. Prvnφ °ßdek skriptu
  36203.   pro prßci v Unixu nebude ve Windows vadit, tak╛e tφmto zp∙sobem m∙╛ete
  36204.   psßt programy pro vφce platforem. Jednoduch² p°φklad psanφ PHP programu
  36205.   pro p°φkazovou °ßdku je uveden nφ╛e.    
  36206.  </P
  36207. ><TABLE
  36208. WIDTH="100%"
  36209. BORDER="0"
  36210. CELLPADDING="0"
  36211. CELLSPACING="0"
  36212. CLASS="EXAMPLE"
  36213. ><TR
  36214. ><TD
  36215. ><DIV
  36216. CLASS="example"
  36217. ><A
  36218. NAME="AEN6576"
  36219. ></A
  36220. ><P
  36221. ><B
  36222. >P°φklad 23-1. Skript urΦen² ke spou╣t∞nφ z p°φkazovΘ °ßdky (script.php)</B
  36223. ></P
  36224. ><TABLE
  36225. BORDER="0"
  36226. BGCOLOR="#E0E0E0"
  36227. CELLPADDING="5"
  36228. ><TR
  36229. ><TD
  36230. ><PRE
  36231. CLASS="php"
  36232. >#!/usr/bin/php -q
  36233. <?php
  36234.  
  36235. if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
  36236. ?>
  36237.  
  36238. This is a command line PHP script with one option.
  36239.  
  36240.   Usage:
  36241.   <?php echo $argv[0]; ?> <option>
  36242.  
  36243.   <option> can be some word you would like
  36244.   to print out. With the --help, -help, -h,
  36245.   or -? options, you can get this help.
  36246.  
  36247. <?php
  36248. } else {
  36249.     echo $argv[1];
  36250. }
  36251. ?></PRE
  36252. ></TD
  36253. ></TR
  36254. ></TABLE
  36255. ></DIV
  36256. ></TD
  36257. ></TR
  36258. ></TABLE
  36259. ><P
  36260. >   Ve v²╣e uvedenΘm skriptu jsme pou╛ili specißlnφ prvnφ °ßdek k indikaci,
  36261.   ╛e by tento soubor m∞l b²t spou╣t∞n pomocφ PHP a nem∞l by vypisovat
  36262.   HTTP hlaviΦky. Jsou zde dv∞ prom∞nnΘ, kterΘ m∙╛ete pou╛φt p°i psanφ
  36263.   aplikacφ pro PHP spou╣t∞n²ch z p°φkazovΘ °ßdky:
  36264.   <TT
  36265. CLASS="varname"
  36266. >$argc</TT
  36267. > a
  36268.   <TT
  36269. CLASS="varname"
  36270. >$argv</TT
  36271. >. Prvnφ z nich je poΦet argument∙ + 1 (nßzev
  36272.   b∞╛φcφho skriptu). Druhß je pole obsahujφcφ argumenty, poΦφnaje nßzvem
  36273.   skriptu jako Φφslo 0 (<TT
  36274. CLASS="varname"
  36275. >$argv[0]</TT
  36276. >).
  36277.  </P
  36278. ><P
  36279. >   V ukßzkovΘm programu se testuje, zda je argument∙ vφce Φi mΘn∞ ne╛ jeden.
  36280.   Pokud by argument byl <TT
  36281. CLASS="literal"
  36282. >--help</TT
  36283. >,
  36284.   <TT
  36285. CLASS="literal"
  36286. >-help</TT
  36287. >, <TT
  36288. CLASS="literal"
  36289. >-h</TT
  36290. > nebo <TT
  36291. CLASS="literal"
  36292. >-?</TT
  36293. >,
  36294.   vytiskne se nßpov∞da k programu vΦetn∞ skuteΦnΘho nßzvu skriptu.
  36295.   Pokud by byly p°idßny n∞jakΘ dal╣φ argumenty, vytisknou se na v²stup.  
  36296.  </P
  36297. ><P
  36298. >   Pokud byste cht∞li spou╣t∞t uveden² skript pod Unixem, musφte ho ud∞lat
  36299.   spustiteln²m (nastavit prßva pro spou╣t∞nφ), a pak jednodu╣e napsat
  36300.   <TT
  36301. CLASS="literal"
  36302. >script.php vypis_tohle</TT
  36303. > nebo
  36304.   <TT
  36305. CLASS="literal"
  36306. >script.php -h</TT
  36307. >. Na Windows musφte pro tento ·kol vytvo°it
  36308.   dßvkov² soubor:  
  36309.  </P
  36310. ><TABLE
  36311. WIDTH="100%"
  36312. BORDER="0"
  36313. CELLPADDING="0"
  36314. CELLSPACING="0"
  36315. CLASS="EXAMPLE"
  36316. ><TR
  36317. ><TD
  36318. ><DIV
  36319. CLASS="example"
  36320. ><A
  36321. NAME="AEN6591"
  36322. ></A
  36323. ><P
  36324. ><B
  36325. >P°φklad 23-2. Dßvkov² soubor pro spou╣t∞nφ PHP skriptu z p°φkazovΘ °ßdky (script.bat)</B
  36326. ></P
  36327. ><TABLE
  36328. BORDER="0"
  36329. BGCOLOR="#E0E0E0"
  36330. CELLPADDING="5"
  36331. ><TR
  36332. ><TD
  36333. ><PRE
  36334. CLASS="winbat"
  36335. >@c:\php\php.exe -q script.php %1 %2 %3 %4</PRE
  36336. ></TD
  36337. ></TR
  36338. ></TABLE
  36339. ></DIV
  36340. ></TD
  36341. ></TR
  36342. ></TABLE
  36343. ><P
  36344. >   Za p°edpokladu, ╛e jste v²╣e uveden² program nazvali
  36345.   <TT
  36346. CLASS="filename"
  36347. >script.php</TT
  36348. > a soubor
  36349.   <TT
  36350. CLASS="filename"
  36351. >php.exe</TT
  36352. > mßte ulo╛en² jako
  36353.   <TT
  36354. CLASS="filename"
  36355. >c:\php\php.exe</TT
  36356. >, m∙╛ete tento dßvkov² soubor spou╣t∞t
  36357.   takto:  
  36358.   <TT
  36359. CLASS="literal"
  36360. >script.bat echothis</TT
  36361. > nebo
  36362.   <TT
  36363. CLASS="literal"
  36364. >script.bat -h</TT
  36365. >.
  36366.  </P
  36367. ><P
  36368. >   Viz takΘ dokumentaci roz╣φ°enφ <A
  36369. HREF="#ref.readline"
  36370. >Readline</A
  36371. >,
  36372.   kde najdete vφce funkcφ pro pou╛itφ k aplikacφm PHP spou╣t∞n²ch z
  36373.   p°φkazovΘ °ßdky.  
  36374.  </P
  36375. ></DIV
  36376. ></DIV
  36377. ><DIV
  36378. CLASS="PART"
  36379. ><A
  36380. NAME="funcref"
  36381. ></A
  36382. ><DIV
  36383. CLASS="TITLEPAGE"
  36384. ><H1
  36385. CLASS="title"
  36386. >V. Reference funkcφ</H1
  36387. ><DIV
  36388. CLASS="TOC"
  36389. ><DL
  36390. ><DT
  36391. ><B
  36392. >Obsah</B
  36393. ></DT
  36394. ><DT
  36395. >I. <A
  36396. HREF="#ref.apache"
  36397. >Funkce specifickΘ pro Apache</A
  36398. ></DT
  36399. ><DT
  36400. >II. <A
  36401. HREF="#ref.array"
  36402. >Funkce pro prßci s poli</A
  36403. ></DT
  36404. ><DT
  36405. >III. <A
  36406. HREF="#ref.aspell"
  36407. >Aspell funkce [zastaralΘ]</A
  36408. ></DT
  36409. ><DT
  36410. >IV. <A
  36411. HREF="#ref.bc"
  36412. >BCMath funkce pro v²poΦty s libovolnou p°esnostφ</A
  36413. ></DT
  36414. ><DT
  36415. >V. <A
  36416. HREF="#ref.bzip2"
  36417. >Kompresnφ funkce bzip2</A
  36418. ></DT
  36419. ><DT
  36420. >VI. <A
  36421. HREF="#ref.calendar"
  36422. >Kalendß°ovΘ funkce</A
  36423. ></DT
  36424. ><DT
  36425. >VII. <A
  36426. HREF="#ref.ccvs"
  36427. >CCVS API Functions</A
  36428. ></DT
  36429. ><DT
  36430. >VIII. <A
  36431. HREF="#ref.com"
  36432. >Funkce na podporu COM ve Windows</A
  36433. ></DT
  36434. ><DT
  36435. >IX. <A
  36436. HREF="#ref.classobj"
  36437. >Funkce pro prßci s t°φdami/objekty</A
  36438. ></DT
  36439. ><DT
  36440. >X. <A
  36441. HREF="#ref.cpdf"
  36442. >ClibPDF functions</A
  36443. ></DT
  36444. ><DT
  36445. >XI. <A
  36446. HREF="#ref.crack"
  36447. >Crack functions</A
  36448. ></DT
  36449. ><DT
  36450. >XII. <A
  36451. HREF="#ref.curl"
  36452. >Funkce pro prßci s CURL, Client URL Library</A
  36453. ></DT
  36454. ><DT
  36455. >XIII. <A
  36456. HREF="#ref.cybercash"
  36457. >Cybercash platebnφ funkce</A
  36458. ></DT
  36459. ><DT
  36460. >XIV. <A
  36461. HREF="#ref.cyrus"
  36462. >Cyrus IMAP administration functions</A
  36463. ></DT
  36464. ><DT
  36465. >XV. <A
  36466. HREF="#ref.ctype"
  36467. >Character type functions</A
  36468. ></DT
  36469. ><DT
  36470. >XVI. <A
  36471. HREF="#ref.dba"
  36472. >Database (dbm-style) abstraction layer functions</A
  36473. ></DT
  36474. ><DT
  36475. >XVII. <A
  36476. HREF="#ref.datetime"
  36477. >Funkce pro datum a Φas</A
  36478. ></DT
  36479. ><DT
  36480. >XVIII. <A
  36481. HREF="#ref.dbase"
  36482. >dBase functions</A
  36483. ></DT
  36484. ><DT
  36485. >XIX. <A
  36486. HREF="#ref.dbm"
  36487. >DBM Funkce [zastaralΘ]</A
  36488. ></DT
  36489. ><DT
  36490. >XX. <A
  36491. HREF="#ref.dbx"
  36492. >dbx functions</A
  36493. ></DT
  36494. ><DT
  36495. >XXI. <A
  36496. HREF="#ref.dbplus"
  36497. >DB++ Functions</A
  36498. ></DT
  36499. ><DT
  36500. >XXII. <A
  36501. HREF="#ref.dio"
  36502. >Direct IO functions</A
  36503. ></DT
  36504. ><DT
  36505. >XXIII. <A
  36506. HREF="#ref.dir"
  36507. >Adresß°ovΘ funkce</A
  36508. ></DT
  36509. ><DT
  36510. >XXIV. <A
  36511. HREF="#ref.domxml"
  36512. >DOM XML functions</A
  36513. ></DT
  36514. ><DT
  36515. >XXV. <A
  36516. HREF="#ref.dotnet"
  36517. >.NET functions</A
  36518. ></DT
  36519. ><DT
  36520. >XXVI. <A
  36521. HREF="#ref.errorfunc"
  36522. >Error Handling and Logging Functions</A
  36523. ></DT
  36524. ><DT
  36525. >XXVII. <A
  36526. HREF="#ref.fam"
  36527. >File alteration monitor functions</A
  36528. ></DT
  36529. ><DT
  36530. >XXVIII. <A
  36531. HREF="#ref.fbsql"
  36532. >FrontBase Functions</A
  36533. ></DT
  36534. ><DT
  36535. >XXIX. <A
  36536. HREF="#ref.filepro"
  36537. >filePro funkce</A
  36538. ></DT
  36539. ><DT
  36540. >XXX. <A
  36541. HREF="#ref.filesystem"
  36542. >Funkce filesystΘmu</A
  36543. ></DT
  36544. ><DT
  36545. >XXXI. <A
  36546. HREF="#ref.fdf"
  36547. >Forms Data Format functions</A
  36548. ></DT
  36549. ><DT
  36550. >XXXII. <A
  36551. HREF="#ref.fribidi"
  36552. >FriBiDi functions</A
  36553. ></DT
  36554. ><DT
  36555. >XXXIII. <A
  36556. HREF="#ref.ftp"
  36557. >FTP functions</A
  36558. ></DT
  36559. ><DT
  36560. >XXXIV. <A
  36561. HREF="#ref.funchand"
  36562. >Funkce pro prßci s funkcemi</A
  36563. ></DT
  36564. ><DT
  36565. >XXXV. <A
  36566. HREF="#ref.gettext"
  36567. >Gettext</A
  36568. ></DT
  36569. ><DT
  36570. >XXXVI. <A
  36571. HREF="#ref.gmp"
  36572. >GMP functions</A
  36573. ></DT
  36574. ><DT
  36575. >XXXVII. <A
  36576. HREF="#ref.http"
  36577. >HTTP funkce</A
  36578. ></DT
  36579. ><DT
  36580. >XXXVIII. <A
  36581. HREF="#ref.hyperwave"
  36582. >Hyperwave functions</A
  36583. ></DT
  36584. ><DT
  36585. >XXXIX. <A
  36586. HREF="#ref.hwapi"
  36587. >Hyperwave API functions</A
  36588. ></DT
  36589. ><DT
  36590. >XL. <A
  36591. HREF="#ref.iconv"
  36592. >iconv functions</A
  36593. ></DT
  36594. ><DT
  36595. >XLI. <A
  36596. HREF="#ref.image"
  36597. >Image functions</A
  36598. ></DT
  36599. ><DT
  36600. >XLII. <A
  36601. HREF="#ref.imap"
  36602. >IMAP, POP3 and NNTP functions</A
  36603. ></DT
  36604. ><DT
  36605. >XLIII. <A
  36606. HREF="#ref.ifx"
  36607. >Informix functions</A
  36608. ></DT
  36609. ><DT
  36610. >XLIV. <A
  36611. HREF="#ref.ibase"
  36612. >InterBase functions</A
  36613. ></DT
  36614. ><DT
  36615. >XLV. <A
  36616. HREF="#ref.ingres"
  36617. >Ingres II functions</A
  36618. ></DT
  36619. ><DT
  36620. >XLVI. <A
  36621. HREF="#ref.ircg"
  36622. >IRC Gateway Functions</A
  36623. ></DT
  36624. ><DT
  36625. >XLVII. <A
  36626. HREF="#ref.java"
  36627. >PHP / Java Integration</A
  36628. ></DT
  36629. ><DT
  36630. >XLVIII. <A
  36631. HREF="#ref.ldap"
  36632. >LDAP functions</A
  36633. ></DT
  36634. ><DT
  36635. >XLIX. <A
  36636. HREF="#ref.mail"
  36637. >MailovΘ funkce</A
  36638. ></DT
  36639. ><DT
  36640. >L. <A
  36641. HREF="#ref.mailparse"
  36642. >mailparse functions</A
  36643. ></DT
  36644. ><DT
  36645. >LI. <A
  36646. HREF="#ref.math"
  36647. >MatematickΘ funkce</A
  36648. ></DT
  36649. ><DT
  36650. >LII. <A
  36651. HREF="#ref.mbstring"
  36652. >Multi-Byte String Functions</A
  36653. ></DT
  36654. ><DT
  36655. >LIII. <A
  36656. HREF="#ref.mcal"
  36657. >MCAL functions</A
  36658. ></DT
  36659. ><DT
  36660. >LIV. <A
  36661. HREF="#ref.mcrypt"
  36662. >Mcrypt Encryption Functions</A
  36663. ></DT
  36664. ><DT
  36665. >LV. <A
  36666. HREF="#ref.mcve"
  36667. >MCVE Payment Functions</A
  36668. ></DT
  36669. ><DT
  36670. >LVI. <A
  36671. HREF="#ref.mhash"
  36672. >Mhash funkce</A
  36673. ></DT
  36674. ><DT
  36675. >LVII. <A
  36676. HREF="#ref.mime-magic"
  36677. >Mimetype Functions</A
  36678. ></DT
  36679. ><DT
  36680. >LVIII. <A
  36681. HREF="#ref.mssql"
  36682. >Microsoft SQL Server functions</A
  36683. ></DT
  36684. ><DT
  36685. >LIX. <A
  36686. HREF="#ref.ming"
  36687. >Ming functions for Flash</A
  36688. ></DT
  36689. ><DT
  36690. >LX. <A
  36691. HREF="#ref.misc"
  36692. >R∙znΘ funkce</A
  36693. ></DT
  36694. ><DT
  36695. >LXI. <A
  36696. HREF="#ref.mnogo"
  36697. >mnoGoSearch Functions</A
  36698. ></DT
  36699. ><DT
  36700. >LXII. <A
  36701. HREF="#ref.msql"
  36702. >mSQL functions</A
  36703. ></DT
  36704. ><DT
  36705. >LXIII. <A
  36706. HREF="#ref.mysql"
  36707. >MySQL funkce</A
  36708. ></DT
  36709. ><DT
  36710. >LXIV. <A
  36711. HREF="#ref.mysqli"
  36712. >Improved MySQL Extension</A
  36713. ></DT
  36714. ><DT
  36715. >LXV. <A
  36716. HREF="#ref.msession"
  36717. >Mohawk Software session handler functions</A
  36718. ></DT
  36719. ><DT
  36720. >LXVI. <A
  36721. HREF="#ref.muscat"
  36722. >muscat functions</A
  36723. ></DT
  36724. ><DT
  36725. >LXVII. <A
  36726. HREF="#ref.network"
  36727. >Sφ╗ovΘ funkce</A
  36728. ></DT
  36729. ><DT
  36730. >LXVIII. <A
  36731. HREF="#ref.ncurses"
  36732. >Ncurses terminal screen control functions</A
  36733. ></DT
  36734. ><DT
  36735. >LXIX. <A
  36736. HREF="#ref.notes"
  36737. >Lotus Notes functions</A
  36738. ></DT
  36739. ><DT
  36740. >LXX. <A
  36741. HREF="#ref.nsapi"
  36742. >NSAPI-specific Functions</A
  36743. ></DT
  36744. ><DT
  36745. >LXXI. <A
  36746. HREF="#ref.odbc"
  36747. >Unified ODBC functions</A
  36748. ></DT
  36749. ><DT
  36750. >LXXII. <A
  36751. HREF="#ref.objaggregation"
  36752. >Object Aggregation/Composition Functions</A
  36753. ></DT
  36754. ><DT
  36755. >LXXIII. <A
  36756. HREF="#ref.oci8"
  36757. >Oracle 8 functions</A
  36758. ></DT
  36759. ><DT
  36760. >LXXIV. <A
  36761. HREF="#ref.openssl"
  36762. >OpenSSL funkce</A
  36763. ></DT
  36764. ><DT
  36765. >LXXV. <A
  36766. HREF="#ref.oracle"
  36767. >Oracle functions</A
  36768. ></DT
  36769. ><DT
  36770. >LXXVI. <A
  36771. HREF="#ref.ovrimos"
  36772. >Ovrimos SQL functions</A
  36773. ></DT
  36774. ><DT
  36775. >LXXVII. <A
  36776. HREF="#ref.outcontrol"
  36777. >Funkce pro °φzenφ v²stupu</A
  36778. ></DT
  36779. ><DT
  36780. >LXXVIII. <A
  36781. HREF="#ref.overload"
  36782. >Object property and method call overloading</A
  36783. ></DT
  36784. ><DT
  36785. >LXXIX. <A
  36786. HREF="#ref.pdf"
  36787. >PDF funkce</A
  36788. ></DT
  36789. ><DT
  36790. >LXXX. <A
  36791. HREF="#ref.pfpro"
  36792. >Funkce pro prßci s Verisign Payflow Pro</A
  36793. ></DT
  36794. ><DT
  36795. >LXXXI. <A
  36796. HREF="#ref.info"
  36797. >PHP volby a informace</A
  36798. ></DT
  36799. ><DT
  36800. >LXXXII. <A
  36801. HREF="#ref.posix"
  36802. >POSIX functions</A
  36803. ></DT
  36804. ><DT
  36805. >LXXXIII. <A
  36806. HREF="#ref.pgsql"
  36807. >PostgreSQL functions</A
  36808. ></DT
  36809. ><DT
  36810. >LXXXIV. <A
  36811. HREF="#ref.pcntl"
  36812. >Process Control Functions</A
  36813. ></DT
  36814. ><DT
  36815. >LXXXV. <A
  36816. HREF="#ref.exec"
  36817. >Funkce spou╣t∞nφ program∙</A
  36818. ></DT
  36819. ><DT
  36820. >LXXXVI. <A
  36821. HREF="#ref.printer"
  36822. >Printer functions</A
  36823. ></DT
  36824. ><DT
  36825. >LXXXVII. <A
  36826. HREF="#ref.pspell"
  36827. >Pspell Functions</A
  36828. ></DT
  36829. ><DT
  36830. >LXXXVIII. <A
  36831. HREF="#ref.readline"
  36832. >GNU Readline</A
  36833. ></DT
  36834. ><DT
  36835. >LXXXIX. <A
  36836. HREF="#ref.recode"
  36837. >GNU Recode funkce</A
  36838. ></DT
  36839. ><DT
  36840. >XC. <A
  36841. HREF="#ref.pcre"
  36842. >Regular Expression Functions (Perl-Compatible)</A
  36843. ></DT
  36844. ><DT
  36845. >XCI. <A
  36846. HREF="#ref.qtdom"
  36847. >qtdom functions</A
  36848. ></DT
  36849. ><DT
  36850. >XCII. <A
  36851. HREF="#ref.regex"
  36852. >Regular Expression Functions (POSIX Extended)</A
  36853. ></DT
  36854. ><DT
  36855. >XCIII. <A
  36856. HREF="#ref.sem"
  36857. >Semaphore, Shared Memory and IPC Functions</A
  36858. ></DT
  36859. ><DT
  36860. >XCIV. <A
  36861. HREF="#ref.sesam"
  36862. >SESAM database functions</A
  36863. ></DT
  36864. ><DT
  36865. >XCV. <A
  36866. HREF="#ref.session"
  36867. >Session handling functions</A
  36868. ></DT
  36869. ><DT
  36870. >XCVI. <A
  36871. HREF="#ref.shmop"
  36872. >Funkce pro prßci se sdφlenou pam∞tφ</A
  36873. ></DT
  36874. ><DT
  36875. >XCVII. <A
  36876. HREF="#ref.sqlite"
  36877. >SQLite</A
  36878. ></DT
  36879. ><DT
  36880. >XCVIII. <A
  36881. HREF="#ref.swf"
  36882. >Shockwave Flash functions</A
  36883. ></DT
  36884. ><DT
  36885. >XCIX. <A
  36886. HREF="#ref.snmp"
  36887. >SNMP functions</A
  36888. ></DT
  36889. ><DT
  36890. >C. <A
  36891. HREF="#ref.sockets"
  36892. >Socket functions</A
  36893. ></DT
  36894. ><DT
  36895. >CI. <A
  36896. HREF="#ref.stream"
  36897. >Stream functions</A
  36898. ></DT
  36899. ><DT
  36900. >CII. <A
  36901. HREF="#ref.strings"
  36902. >Funkce pro prßci s °et∞zci</A
  36903. ></DT
  36904. ><DT
  36905. >CIII. <A
  36906. HREF="#ref.sybase"
  36907. >Sybase functions</A
  36908. ></DT
  36909. ><DT
  36910. >CIV. <A
  36911. HREF="#ref.tidy"
  36912. >tidy Functions</A
  36913. ></DT
  36914. ><DT
  36915. >CV. <A
  36916. HREF="#ref.tokenizer"
  36917. >Tokenizer functions</A
  36918. ></DT
  36919. ><DT
  36920. >CVI. <A
  36921. HREF="#ref.url"
  36922. >URL funkce</A
  36923. ></DT
  36924. ><DT
  36925. >CVII. <A
  36926. HREF="#ref.variables"
  36927. >Variable Functions</A
  36928. ></DT
  36929. ><DT
  36930. >CVIII. <A
  36931. HREF="#ref.vpopmail"
  36932. >vpopmail functions</A
  36933. ></DT
  36934. ><DT
  36935. >CIX. <A
  36936. HREF="#ref.w32api"
  36937. >W32api functions</A
  36938. ></DT
  36939. ><DT
  36940. >CX. <A
  36941. HREF="#ref.wddx"
  36942. >WDDX funkce</A
  36943. ></DT
  36944. ><DT
  36945. >CXI. <A
  36946. HREF="#ref.xml"
  36947. >XML parser functions</A
  36948. ></DT
  36949. ><DT
  36950. >CXII. <A
  36951. HREF="#ref.xmlrpc"
  36952. >XML-RPC functions</A
  36953. ></DT
  36954. ><DT
  36955. >CXIII. <A
  36956. HREF="#ref.xslt"
  36957. >XSLT funkce</A
  36958. ></DT
  36959. ><DT
  36960. >CXIV. <A
  36961. HREF="#ref.yaz"
  36962. >YAZ functions</A
  36963. ></DT
  36964. ><DT
  36965. >CXV. <A
  36966. HREF="#ref.nis"
  36967. >Funkce pro prßci s YP/NIS</A
  36968. ></DT
  36969. ><DT
  36970. >CXVI. <A
  36971. HREF="#ref.zip"
  36972. >Zip File Functions (Read Only Access)</A
  36973. ></DT
  36974. ><DT
  36975. >CXVII. <A
  36976. HREF="#ref.zlib"
  36977. >Zlib Compression Functions</A
  36978. ></DT
  36979. ></DL
  36980. ></DIV
  36981. ></DIV
  36982. ><DIV
  36983. CLASS="reference"
  36984. ><A
  36985. NAME="ref.apache"
  36986. ></A
  36987. ><DIV
  36988. CLASS="TITLEPAGE"
  36989. ><H1
  36990. CLASS="title"
  36991. >I. Funkce specifickΘ pro Apache</H1
  36992. ><DIV
  36993. CLASS="PARTINTRO"
  36994. ><A
  36995. NAME="AEN6607"
  36996. ></A
  36997. ><DIV
  36998. CLASS="section"
  36999. ><H1
  37000. CLASS="section"
  37001. ><A
  37002. NAME="apache.intro"
  37003. ></A
  37004. >┌vod</H1
  37005. ><P
  37006. >      Tyto funkce jsou k dispozici pouze pokud PHP b∞╛φ jako modul Apache 1.x.
  37007.     </P
  37008. ></DIV
  37009. ><DIV
  37010. CLASS="section"
  37011. ><HR><H1
  37012. CLASS="section"
  37013. ><A
  37014. NAME="apache.installation"
  37015. ></A
  37016. >Instalace</H1
  37017. ><P
  37018. >      Instalaci PHP v Apache 1.x viz
  37019.      <A
  37020. HREF="#install.apache"
  37021. >Φßst Apache</A
  37022. > kapitoly
  37023.      o instalaci.
  37024.     </P
  37025. ></DIV
  37026. ><DIV
  37027. CLASS="section"
  37028. ><HR><H1
  37029. CLASS="section"
  37030. ><A
  37031. NAME="apache.configuration"
  37032. ></A
  37033. >Konfigurace b∞hu</H1
  37034. ><P
  37035. >   The behaviour of the Apache PHP module is affected by settings in <TT
  37036. CLASS="filename"
  37037. >php.ini</TT
  37038. >.
  37039.   Configuration settings from <TT
  37040. CLASS="filename"
  37041. >php.ini</TT
  37042. > may be overridden by php_flag settings
  37043.   in the server configuration file or local <TT
  37044. CLASS="filename"
  37045. >.htaccess</TT
  37046. > files.
  37047.  </P
  37048. ><TABLE
  37049. WIDTH="100%"
  37050. BORDER="0"
  37051. CELLPADDING="0"
  37052. CELLSPACING="0"
  37053. CLASS="EXAMPLE"
  37054. ><TR
  37055. ><TD
  37056. ><DIV
  37057. CLASS="example"
  37058. ><A
  37059. NAME="AEN6621"
  37060. ></A
  37061. ><P
  37062. ><B
  37063. >P°φklad 1. Turning off PHP parsing for a directory using <TT
  37064. CLASS="filename"
  37065. >.htaccess</TT
  37066. ></B
  37067. ></P
  37068. ><TABLE
  37069. BORDER="0"
  37070. BGCOLOR="#E0E0E0"
  37071. CELLPADDING="5"
  37072. ><TR
  37073. ><TD
  37074. ><PRE
  37075. CLASS="programlisting"
  37076. >php_flag engine off</PRE
  37077. ></TD
  37078. ></TR
  37079. ></TABLE
  37080. ></DIV
  37081. ></TD
  37082. ></TR
  37083. ></TABLE
  37084. ><P
  37085. >   <DIV
  37086. CLASS="table"
  37087. ><A
  37088. NAME="AEN6626"
  37089. ></A
  37090. ><P
  37091. ><B
  37092. >Tabulka 1. Apache configuration options</B
  37093. ></P
  37094. ><TABLE
  37095. BORDER="1"
  37096. CLASS="CALSTABLE"
  37097. ><THEAD
  37098. ><TR
  37099. ><TH
  37100. ALIGN="LEFT"
  37101. VALIGN="MIDDLE"
  37102. >Name</TH
  37103. ><TH
  37104. ALIGN="LEFT"
  37105. VALIGN="MIDDLE"
  37106. >Default</TH
  37107. ><TH
  37108. ALIGN="LEFT"
  37109. VALIGN="MIDDLE"
  37110. >Changeable</TH
  37111. ><TH
  37112. ALIGN="LEFT"
  37113. VALIGN="MIDDLE"
  37114. >Function</TH
  37115. ></TR
  37116. ></THEAD
  37117. ><TBODY
  37118. ><TR
  37119. ><TD
  37120. ALIGN="LEFT"
  37121. VALIGN="MIDDLE"
  37122. >engine</TD
  37123. ><TD
  37124. ALIGN="LEFT"
  37125. VALIGN="MIDDLE"
  37126. >On</TD
  37127. ><TD
  37128. ALIGN="LEFT"
  37129. VALIGN="MIDDLE"
  37130. >PHP_INI_ALL</TD
  37131. ><TD
  37132. ALIGN="LEFT"
  37133. VALIGN="MIDDLE"
  37134. >turns PHP parsing on or off</TD
  37135. ></TR
  37136. ><TR
  37137. ><TD
  37138. ALIGN="LEFT"
  37139. VALIGN="MIDDLE"
  37140. >child_terminate</TD
  37141. ><TD
  37142. ALIGN="LEFT"
  37143. VALIGN="MIDDLE"
  37144. >Off</TD
  37145. ><TD
  37146. ALIGN="LEFT"
  37147. VALIGN="MIDDLE"
  37148. >PHP_INI_ALL</TD
  37149. ><TD
  37150. ALIGN="LEFT"
  37151. VALIGN="MIDDLE"
  37152. >        specify whether PHP scripts may request child process termination on end of request, 
  37153.        see also <A
  37154. HREF="#function.apache-child-terminate"
  37155. ><B
  37156. CLASS="function"
  37157. >apache_child_terminate()</B
  37158. ></A
  37159. >
  37160.       </TD
  37161. ></TR
  37162. ><TR
  37163. ><TD
  37164. ALIGN="LEFT"
  37165. VALIGN="MIDDLE"
  37166. >last_modified</TD
  37167. ><TD
  37168. ALIGN="LEFT"
  37169. VALIGN="MIDDLE"
  37170. >Off</TD
  37171. ><TD
  37172. ALIGN="LEFT"
  37173. VALIGN="MIDDLE"
  37174. >PHP_INI_ALL</TD
  37175. ><TD
  37176. ALIGN="LEFT"
  37177. VALIGN="MIDDLE"
  37178. >send PHP scripts modification date as Last-Modified: header for this request</TD
  37179. ></TR
  37180. ><TR
  37181. ><TD
  37182. ALIGN="LEFT"
  37183. VALIGN="MIDDLE"
  37184. >xbithack</TD
  37185. ><TD
  37186. ALIGN="LEFT"
  37187. VALIGN="MIDDLE"
  37188. >Off</TD
  37189. ><TD
  37190. ALIGN="LEFT"
  37191. VALIGN="MIDDLE"
  37192. >PHP_INI_ALL</TD
  37193. ><TD
  37194. ALIGN="LEFT"
  37195. VALIGN="MIDDLE"
  37196. >parse files with executable bit set as PHP regardless of their file ending</TD
  37197. ></TR
  37198. ></TBODY
  37199. ></TABLE
  37200. ></DIV
  37201. >
  37202.  </P
  37203. ><P
  37204. >Zde je struΦnΘ vysv∞tlenφ
  37205. konfiguraΦnφch direktiv.</P
  37206. ><P
  37207. >  <P
  37208. ></P
  37209. ><DIV
  37210. CLASS="variablelist"
  37211. ><DL
  37212. ><DT
  37213. ><A
  37214. NAME="ini.engine"
  37215. ></A
  37216. ><TT
  37217. CLASS="parameter"
  37218. ><I
  37219. >engine</I
  37220. ></TT
  37221. >
  37222.    <A
  37223. HREF="#language.types.boolean"
  37224. ><B
  37225. CLASS="type"
  37226. >boolean</B
  37227. ></A
  37228. ></DT
  37229. ><DD
  37230. ><P
  37231. >      This directive is really only useful in the Apache module
  37232.      version of PHP. It is used by sites that would like to turn
  37233.      PHP parsing on and off on a per-directory or per-virtual
  37234.      server basis. By putting <TT
  37235. CLASS="userinput"
  37236. ><B
  37237. >engine off</B
  37238. ></TT
  37239. >
  37240.      in the appropriate places in the <TT
  37241. CLASS="filename"
  37242. >httpd.conf</TT
  37243. > file, PHP can
  37244.      be enabled or disabled.
  37245.     </P
  37246. ></DD
  37247. ></DL
  37248. ></DIV
  37249. >
  37250.  </P
  37251. ></DIV
  37252. ><DIV
  37253. CLASS="section"
  37254. ><HR><H1
  37255. CLASS="section"
  37256. ><A
  37257. NAME="apache.resources"
  37258. ></A
  37259. >Typy prost°edk∙</H1
  37260. ><P
  37261. >Toto roz╣φ°enφ nemß definovßn ╛ßdn² typ prost°edku
  37262. (resource).</P
  37263. ></DIV
  37264. ><DIV
  37265. CLASS="section"
  37266. ><HR><H1
  37267. CLASS="section"
  37268. ><A
  37269. NAME="apache.constants"
  37270. ></A
  37271. >P°eddefinovanΘ konstanty</H1
  37272. ><P
  37273. >Toto roz╣φ°enφ nemß definovßny ╛ßdnΘ
  37274. konstanty.</P
  37275. ></DIV
  37276. ></DIV
  37277. ><DIV
  37278. CLASS="TOC"
  37279. ><DL
  37280. ><DT
  37281. ><B
  37282. >Obsah</B
  37283. ></DT
  37284. ><DT
  37285. ><A
  37286. HREF="#function.apache-child-terminate"
  37287. >apache_child_terminate</A
  37288. > -- Terminate apache process after this request</DT
  37289. ><DT
  37290. ><A
  37291. HREF="#function.apache-get-version"
  37292. >apache_get_version</A
  37293. > -- 
  37294.      Fetch Apache version
  37295.     </DT
  37296. ><DT
  37297. ><A
  37298. HREF="#function.apache-lookup-uri"
  37299. >apache_lookup_uri</A
  37300. > -- 
  37301.      Provßdφ ΦßsteΦn² po╛adavek na zadanou URI a vracφ v╣echno info o nφ
  37302.     </DT
  37303. ><DT
  37304. ><A
  37305. HREF="#function.apache-note"
  37306. >apache_note</A
  37307. > -- Zφskßvß a nastavuje poznßmky po╛adavku u Apache.</DT
  37308. ><DT
  37309. ><A
  37310. HREF="#function.apache-request-headers"
  37311. >apache_request_headers</A
  37312. > -- Fetch all HTTP request headers</DT
  37313. ><DT
  37314. ><A
  37315. HREF="#function.apache-response-headers"
  37316. >apache_response_headers</A
  37317. > -- 
  37318.      Fetch all HTTP response headers
  37319.     </DT
  37320. ><DT
  37321. ><A
  37322. HREF="#function.apache-setenv"
  37323. >apache_setenv</A
  37324. > -- Set an Apache subprocess_env variable</DT
  37325. ><DT
  37326. ><A
  37327. HREF="#function.ascii2ebcdic"
  37328. >ascii2ebcdic</A
  37329. > -- P°eklßdß °et∞zec z ASCII do EBCDIC</DT
  37330. ><DT
  37331. ><A
  37332. HREF="#function.ebcdic2ascii"
  37333. >ebcdic2ascii</A
  37334. > -- P°eklßdß °et∞zec z EBCDIC do ASCII</DT
  37335. ><DT
  37336. ><A
  37337. HREF="#function.getallheaders"
  37338. >getallheaders</A
  37339. > -- Zφskßvß v╣echny hlaviΦky HTTP po╛adavku</DT
  37340. ><DT
  37341. ><A
  37342. HREF="#function.virtual"
  37343. >virtual</A
  37344. > -- Provßdφ sub-po╛adavek Apache</DT
  37345. ></DL
  37346. ></DIV
  37347. ></DIV
  37348. ><H1
  37349. ><A
  37350. NAME="function.apache-child-terminate"
  37351. ></A
  37352. >apache_child_terminate</H1
  37353. ><DIV
  37354. CLASS="refnamediv"
  37355. ><A
  37356. NAME="AEN6675"
  37357. ></A
  37358. ><P
  37359. >    (PHP 4 >= 4.0.5)</P
  37360. >apache_child_terminate -- Terminate apache process after this request</DIV
  37361. ><DIV
  37362. CLASS="refsect1"
  37363. ><A
  37364. NAME="AEN6678"
  37365. ></A
  37366. ><H2
  37367. >Description</H2
  37368. >bool <B
  37369. CLASS="methodname"
  37370. >apache_child_terminate</B
  37371. > ( void )<BR
  37372. ></BR
  37373. ><P
  37374. >      <B
  37375. CLASS="function"
  37376. >apache_child_terminate()</B
  37377. > will register the
  37378.      Apache process executing the current PHP request for termination
  37379.      once execution of PHP code it is completed. It may be used to
  37380.      terminate a process after a script with high memory consumption has
  37381.      been run as memory will usually only be freed internally but not
  37382.      given back to the operating system. 
  37383.     </P
  37384. ><DIV
  37385. CLASS="note"
  37386. ><BLOCKQUOTE
  37387. CLASS="note"
  37388. ><P
  37389. ><B
  37390. >Poznßmka: </B
  37391. >
  37392.       The availability of this feature is controlled by the <TT
  37393. CLASS="filename"
  37394. >php.ini</TT
  37395. > directive
  37396.       <TT
  37397. CLASS="option"
  37398. >child_terminate</TT
  37399. >, which is set to <TT
  37400. CLASS="literal"
  37401. >off</TT
  37402. >
  37403.       by default.
  37404.      </P
  37405. ><P
  37406. >       This feature is also not available on multithreaded versions of apache 
  37407.       like the win32 version.
  37408.      </P
  37409. ></BLOCKQUOTE
  37410. ></DIV
  37411. ><P
  37412. >      See also <A
  37413. HREF="#function.exit"
  37414. ><B
  37415. CLASS="function"
  37416. >exit()</B
  37417. ></A
  37418. >.
  37419.     </P
  37420. ></DIV
  37421. ><H1
  37422. ><A
  37423. NAME="function.apache-get-version"
  37424. ></A
  37425. >apache_get_version</H1
  37426. ><DIV
  37427. CLASS="refnamediv"
  37428. ><A
  37429. NAME="AEN6695"
  37430. ></A
  37431. ><P
  37432. >    (PHP 4 >= 4.3.2)</P
  37433. >apache_get_version -- 
  37434.      Fetch Apache version
  37435.     </DIV
  37436. ><DIV
  37437. CLASS="refsect1"
  37438. ><A
  37439. NAME="AEN6698"
  37440. ></A
  37441. ><H2
  37442. >Description</H2
  37443. >string <B
  37444. CLASS="methodname"
  37445. >apache_get_version</B
  37446. > ( void )<BR
  37447. ></BR
  37448. ><P
  37449. >      <B
  37450. CLASS="function"
  37451. >apache_get_version()</B
  37452. > returns the version of Apache as
  37453.      string, or <TT
  37454. CLASS="constant"
  37455. ><B
  37456. >FALSE</B
  37457. ></TT
  37458. > on failure.
  37459.     </P
  37460. ><TABLE
  37461. WIDTH="100%"
  37462. BORDER="0"
  37463. CELLPADDING="0"
  37464. CELLSPACING="0"
  37465. CLASS="EXAMPLE"
  37466. ><TR
  37467. ><TD
  37468. ><DIV
  37469. CLASS="example"
  37470. ><A
  37471. NAME="AEN6707"
  37472. ></A
  37473. ><P
  37474. ><B
  37475. >P°φklad 1. <B
  37476. CLASS="function"
  37477. >apache_get_version()</B
  37478. > example</B
  37479. ></P
  37480. ><TABLE
  37481. BORDER="0"
  37482. BGCOLOR="#E0E0E0"
  37483. CELLPADDING="5"
  37484. ><TR
  37485. ><TD
  37486. ><PRE
  37487. CLASS="php"
  37488. ><?php
  37489. $version = apache_get_version();
  37490. echo "$version \n <br \>";
  37491. ?></PRE
  37492. ></TD
  37493. ></TR
  37494. ></TABLE
  37495. ><P
  37496. >       The printout of the above program will look similar to:
  37497.      </P
  37498. ><TABLE
  37499. BORDER="0"
  37500. BGCOLOR="#E0E0E0"
  37501. CELLPADDING="5"
  37502. ><TR
  37503. ><TD
  37504. ><PRE
  37505. CLASS="screen"
  37506. >Apache/1.3.29 (Unix) PHP/4.3.4</PRE
  37507. ></TD
  37508. ></TR
  37509. ></TABLE
  37510. ></DIV
  37511. ></TD
  37512. ></TR
  37513. ></TABLE
  37514. ><P
  37515. >      See also <A
  37516. HREF="#function.phpinfo"
  37517. ><B
  37518. CLASS="function"
  37519. >phpinfo()</B
  37520. ></A
  37521. >.
  37522.     </P
  37523. ></DIV
  37524. ><H1
  37525. ><A
  37526. NAME="function.apache-lookup-uri"
  37527. ></A
  37528. >apache_lookup_uri</H1
  37529. ><DIV
  37530. CLASS="refnamediv"
  37531. ><A
  37532. NAME="AEN6716"
  37533. ></A
  37534. ><P
  37535. >    (PHP 3>= 3.0.4, PHP 4 )</P
  37536. >apache_lookup_uri -- 
  37537.      Provßdφ ΦßsteΦn² po╛adavek na zadanou URI a vracφ v╣echno info o nφ
  37538.     </DIV
  37539. ><DIV
  37540. CLASS="refsect1"
  37541. ><A
  37542. NAME="AEN6719"
  37543. ></A
  37544. ><H2
  37545. >Popis</H2
  37546. >class <B
  37547. CLASS="methodname"
  37548. >apache_lookup_uri</B
  37549. > ( string filename)<BR
  37550. ></BR
  37551. ><P
  37552. >      Tato funkce provßdφ ΦßsteΦn² po╛adavek na URI. Jde jen tak daleko, aby
  37553.      zφskala v╣echny d∙le╛itΘ informace o danΘm zdroji a vracφ tyto informace
  37554.      ve t°φd∞. Vlastnosti tΘto t°φdy jsou:
  37555.      <P
  37556. ></P
  37557. ><TABLE
  37558. BORDER="0"
  37559. ><TBODY
  37560. ><TR
  37561. ><TD
  37562. >status</TD
  37563. ></TR
  37564. ><TR
  37565. ><TD
  37566. >the_request</TD
  37567. ></TR
  37568. ><TR
  37569. ><TD
  37570. >status_line</TD
  37571. ></TR
  37572. ><TR
  37573. ><TD
  37574. >method</TD
  37575. ></TR
  37576. ><TR
  37577. ><TD
  37578. >content_type</TD
  37579. ></TR
  37580. ><TR
  37581. ><TD
  37582. >handler</TD
  37583. ></TR
  37584. ><TR
  37585. ><TD
  37586. >uri</TD
  37587. ></TR
  37588. ><TR
  37589. ><TD
  37590. >filename</TD
  37591. ></TR
  37592. ><TR
  37593. ><TD
  37594. >path_info</TD
  37595. ></TR
  37596. ><TR
  37597. ><TD
  37598. >args</TD
  37599. ></TR
  37600. ><TR
  37601. ><TD
  37602. >boundary</TD
  37603. ></TR
  37604. ><TR
  37605. ><TD
  37606. >no_cache</TD
  37607. ></TR
  37608. ><TR
  37609. ><TD
  37610. >no_local_copy</TD
  37611. ></TR
  37612. ><TR
  37613. ><TD
  37614. >allowed</TD
  37615. ></TR
  37616. ><TR
  37617. ><TD
  37618. >send_bodyct</TD
  37619. ></TR
  37620. ><TR
  37621. ><TD
  37622. >bytes_sent</TD
  37623. ></TR
  37624. ><TR
  37625. ><TD
  37626. >byterange</TD
  37627. ></TR
  37628. ><TR
  37629. ><TD
  37630. >clength</TD
  37631. ></TR
  37632. ><TR
  37633. ><TD
  37634. >unparsed_uri</TD
  37635. ></TR
  37636. ><TR
  37637. ><TD
  37638. >mtime</TD
  37639. ></TR
  37640. ><TR
  37641. ><TD
  37642. >request_time</TD
  37643. ></TR
  37644. ></TBODY
  37645. ></TABLE
  37646. ><P
  37647. ></P
  37648. >
  37649.     </P
  37650. ><DIV
  37651. CLASS="note"
  37652. ><BLOCKQUOTE
  37653. CLASS="note"
  37654. ><P
  37655. ><B
  37656. >Poznßmka: </B
  37657. >
  37658.       <B
  37659. CLASS="function"
  37660. >apache_lookup_uri()</B
  37661. > pouze, pokud je PHP nainstalovßno
  37662.       jako modul Apache.
  37663.      </P
  37664. ></BLOCKQUOTE
  37665. ></DIV
  37666. ></DIV
  37667. ><H1
  37668. ><A
  37669. NAME="function.apache-note"
  37670. ></A
  37671. >apache_note</H1
  37672. ><DIV
  37673. CLASS="refnamediv"
  37674. ><A
  37675. NAME="AEN6754"
  37676. ></A
  37677. ><P
  37678. >    (PHP 3>= 3.0.2, PHP 4 )</P
  37679. >apache_note -- Zφskßvß a nastavuje poznßmky po╛adavku u Apache.</DIV
  37680. ><DIV
  37681. CLASS="refsect1"
  37682. ><A
  37683. NAME="AEN6757"
  37684. ></A
  37685. ><H2
  37686. >Popis</H2
  37687. >string <B
  37688. CLASS="methodname"
  37689. >apache_note</B
  37690. > ( string note_name [, string note_value])<BR
  37691. ></BR
  37692. ><P
  37693. >      <B
  37694. CLASS="function"
  37695. >apache_note()</B
  37696. > je funkce specifickß pro Apache, kterß
  37697.      zφskßvß a nastavuje hodnoty v tabulce <TT
  37698. CLASS="literal"
  37699. >poznßmek</TT
  37700. >
  37701.      po╛adavku. P°i volßnφ s jednφm argumentem vracφ souΦasnou hodnotu poznßmky
  37702.      <TT
  37703. CLASS="literal"
  37704. >note_name</TT
  37705. >. P°i volßnφ se dv∞ma argumenty nastavuje
  37706.      hodnotu poznßmky <TT
  37707. CLASS="literal"
  37708. >note_name</TT
  37709. > na
  37710.      <TT
  37711. CLASS="literal"
  37712. >note_value</TT
  37713. >, a vracφ p°edchozφ hodnotu poznßmky
  37714.      <TT
  37715. CLASS="literal"
  37716. >note_name</TT
  37717. >.
  37718.     </P
  37719. ></DIV
  37720. ><H1
  37721. ><A
  37722. NAME="function.apache-request-headers"
  37723. ></A
  37724. >apache_request_headers</H1
  37725. ><DIV
  37726. CLASS="refnamediv"
  37727. ><A
  37728. NAME="AEN6776"
  37729. ></A
  37730. ><P
  37731. >    (PHP 4 >= 4.3.0)</P
  37732. >apache_request_headers -- Fetch all HTTP request headers</DIV
  37733. ><DIV
  37734. CLASS="refsect1"
  37735. ><A
  37736. NAME="AEN6779"
  37737. ></A
  37738. ><H2
  37739. >Description</H2
  37740. >array <B
  37741. CLASS="methodname"
  37742. >apache_request_headers</B
  37743. > ( void )<BR
  37744. ></BR
  37745. ><P
  37746. >      <B
  37747. CLASS="function"
  37748. >apache_request_headers()</B
  37749. > returns an associative
  37750.      array of all the HTTP headers in the current request.  This is only
  37751.      supported when PHP runs as an <SPAN
  37752. CLASS="productname"
  37753. >Apache</SPAN
  37754. >
  37755.      module.
  37756.     </P
  37757. ><P
  37758. >      <TABLE
  37759. WIDTH="100%"
  37760. BORDER="0"
  37761. CELLPADDING="0"
  37762. CELLSPACING="0"
  37763. CLASS="EXAMPLE"
  37764. ><TR
  37765. ><TD
  37766. ><DIV
  37767. CLASS="example"
  37768. ><A
  37769. NAME="AEN6789"
  37770. ></A
  37771. ><P
  37772. ><B
  37773. >P°φklad 1. <B
  37774. CLASS="function"
  37775. >apache_request_headers()</B
  37776. > example</B
  37777. ></P
  37778. ><TABLE
  37779. BORDER="0"
  37780. BGCOLOR="#E0E0E0"
  37781. CELLPADDING="5"
  37782. ><TR
  37783. ><TD
  37784. ><PRE
  37785. CLASS="php"
  37786. ><?php
  37787. $headers = apache_request_headers();
  37788.  
  37789. foreach ($headers as $header => $value) {
  37790.     echo "$header: $value <br />\n";
  37791. }
  37792. ?></PRE
  37793. ></TD
  37794. ></TR
  37795. ></TABLE
  37796. ></DIV
  37797. ></TD
  37798. ></TR
  37799. ></TABLE
  37800. >
  37801.     </P
  37802. ><DIV
  37803. CLASS="note"
  37804. ><BLOCKQUOTE
  37805. CLASS="note"
  37806. ><P
  37807. ><B
  37808. >Poznßmka: </B
  37809. >
  37810.       Prior to PHP 4.3.0, <B
  37811. CLASS="function"
  37812. >apache_request_headers()</B
  37813. > was
  37814.       called <A
  37815. HREF="#function.getallheaders"
  37816. ><B
  37817. CLASS="function"
  37818. >getallheaders()</B
  37819. ></A
  37820. >.  After PHP 4.3.0,
  37821.       <A
  37822. HREF="#function.getallheaders"
  37823. ><B
  37824. CLASS="function"
  37825. >getallheaders()</B
  37826. ></A
  37827. > is an alias for
  37828.       <B
  37829. CLASS="function"
  37830. >apache_request_headers()</B
  37831. >.
  37832.      </P
  37833. ></BLOCKQUOTE
  37834. ></DIV
  37835. ><DIV
  37836. CLASS="note"
  37837. ><BLOCKQUOTE
  37838. CLASS="note"
  37839. ><P
  37840. ><B
  37841. >Poznßmka: </B
  37842. >
  37843.       You can also get at the value of the common CGI variables by
  37844.       reading them from the environment, which works whether or not
  37845.       you are using PHP as an <SPAN
  37846. CLASS="productname"
  37847. >Apache</SPAN
  37848. > module. Use
  37849.       <A
  37850. HREF="#function.phpinfo"
  37851. ><B
  37852. CLASS="function"
  37853. >phpinfo()</B
  37854. ></A
  37855. > to see a list of all of the available
  37856.       <A
  37857. HREF="#language.variables.predefined"
  37858. >environment variables</A
  37859. >.
  37860.      </P
  37861. ></BLOCKQUOTE
  37862. ></DIV
  37863. ><DIV
  37864. CLASS="note"
  37865. ><BLOCKQUOTE
  37866. CLASS="note"
  37867. ><P
  37868. ><B
  37869. >Poznßmka: </B
  37870. >
  37871.   From PHP 4.3.3 on you can use this function with the
  37872.   <A
  37873. HREF="#ref.nsapi"
  37874. >NSAPI server module</A
  37875. > in Netscape/iPlanet/SunONE
  37876.    webservers, too.
  37877.   </P
  37878. ></BLOCKQUOTE
  37879. ></DIV
  37880. ><P
  37881. >      See also <A
  37882. HREF="#function.apache-response-headers"
  37883. ><B
  37884. CLASS="function"
  37885. >apache_response_headers()</B
  37886. ></A
  37887. >.
  37888.     </P
  37889. ></DIV
  37890. ><H1
  37891. ><A
  37892. NAME="function.apache-response-headers"
  37893. ></A
  37894. >apache_response_headers</H1
  37895. ><DIV
  37896. CLASS="refnamediv"
  37897. ><A
  37898. NAME="AEN6810"
  37899. ></A
  37900. ><P
  37901. >    (PHP 4 >= 4.3.0)</P
  37902. >apache_response_headers -- 
  37903.      Fetch all HTTP response headers
  37904.     </DIV
  37905. ><DIV
  37906. CLASS="refsect1"
  37907. ><A
  37908. NAME="AEN6813"
  37909. ></A
  37910. ><H2
  37911. >Description</H2
  37912. >array <B
  37913. CLASS="methodname"
  37914. >apache_response_headers</B
  37915. > ( void )<BR
  37916. ></BR
  37917. ><P
  37918. >      Returns an array of all Apache response headers.  This functionality
  37919.      is only available in PHP version 4.3.0 and greater.
  37920.     </P
  37921. ><DIV
  37922. CLASS="note"
  37923. ><BLOCKQUOTE
  37924. CLASS="note"
  37925. ><P
  37926. ><B
  37927. >Poznßmka: </B
  37928. >
  37929.   From PHP 4.3.3 on you can use this function with the
  37930.   <A
  37931. HREF="#ref.nsapi"
  37932. >NSAPI server module</A
  37933. > in Netscape/iPlanet/SunONE
  37934.    webservers, too.
  37935.   </P
  37936. ></BLOCKQUOTE
  37937. ></DIV
  37938. ><P
  37939. >      See also <A
  37940. HREF="#function.apache-request-headers"
  37941. ><B
  37942. CLASS="function"
  37943. >apache_request_headers()</B
  37944. ></A
  37945. >, and
  37946.      <A
  37947. HREF="#function.headers-sent"
  37948. ><B
  37949. CLASS="function"
  37950. >headers_sent()</B
  37951. ></A
  37952. >.
  37953.     </P
  37954. ></DIV
  37955. ><H1
  37956. ><A
  37957. NAME="function.apache-setenv"
  37958. ></A
  37959. >apache_setenv</H1
  37960. ><DIV
  37961. CLASS="refnamediv"
  37962. ><A
  37963. NAME="AEN6827"
  37964. ></A
  37965. ><P
  37966. >    (PHP 4 >= 4.2.0)</P
  37967. >apache_setenv -- Set an Apache subprocess_env variable</DIV
  37968. ><DIV
  37969. CLASS="refsect1"
  37970. ><A
  37971. NAME="AEN6830"
  37972. ></A
  37973. ><H2
  37974. >Description</H2
  37975. >int <B
  37976. CLASS="methodname"
  37977. >apache_setenv</B
  37978. > ( string variable, string value [, bool walk_to_top])<BR
  37979. ></BR
  37980. ><P
  37981. >      <DIV
  37982. CLASS="warning"
  37983. ><P
  37984. ></P
  37985. ><TABLE
  37986. CLASS="warning"
  37987. BORDER="1"
  37988. WIDTH="100%"
  37989. ><TR
  37990. ><TD
  37991. ALIGN="CENTER"
  37992. ><B
  37993. >Varovßnφ</B
  37994. ></TD
  37995. ></TR
  37996. ><TR
  37997. ><TD
  37998. ALIGN="LEFT"
  37999. ><P
  38000. >Tato funkce je╣t∞ nenφ
  38001. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  38002. ></TD
  38003. ></TR
  38004. ></TABLE
  38005. ></DIV
  38006. >
  38007.     </P
  38008. ></DIV
  38009. ><H1
  38010. ><A
  38011. NAME="function.ascii2ebcdic"
  38012. ></A
  38013. >ascii2ebcdic</H1
  38014. ><DIV
  38015. CLASS="refnamediv"
  38016. ><A
  38017. NAME="AEN6848"
  38018. ></A
  38019. ><P
  38020. >    (PHP 3>= 3.0.17)</P
  38021. >ascii2ebcdic -- P°eklßdß °et∞zec z ASCII do EBCDIC</DIV
  38022. ><DIV
  38023. CLASS="refsect1"
  38024. ><A
  38025. NAME="AEN6851"
  38026. ></A
  38027. ><H2
  38028. >Popis</H2
  38029. >int <B
  38030. CLASS="methodname"
  38031. >ascii2ebcdic</B
  38032. > ( string ascii_str)<BR
  38033. ></BR
  38034. ><P
  38035. >      <B
  38036. CLASS="function"
  38037. >ascii2ebcdic()</B
  38038. > je funkce specifickß pro Apache dostupnß
  38039.      pouze na operaΦnφch systΘmech zalo╛en²ch na EBCDIC (OS/390, BS2000).
  38040.      P°eklßdß (binßrn∞ bezpeΦn∞) °e╛∞zec v ASCII k≤dovßnφ
  38041.      <TT
  38042. CLASS="parameter"
  38043. ><I
  38044. >ascii_str</I
  38045. ></TT
  38046. > na jeho ekvivalentnφ EBCDIC reprezentaci,
  38047.      a vracφ v²sledek.
  38048.     </P
  38049. ><P
  38050. >      Viz takΘ opaΦnou funkci <A
  38051. HREF="#function.ebcdic2ascii"
  38052. ><B
  38053. CLASS="function"
  38054. >ebcdic2ascii()</B
  38055. ></A
  38056. >
  38057.     </P
  38058. ></DIV
  38059. ><H1
  38060. ><A
  38061. NAME="function.ebcdic2ascii"
  38062. ></A
  38063. >ebcdic2ascii</H1
  38064. ><DIV
  38065. CLASS="refnamediv"
  38066. ><A
  38067. NAME="AEN6865"
  38068. ></A
  38069. ><P
  38070. >    (PHP 3>= 3.0.17)</P
  38071. >ebcdic2ascii -- P°eklßdß °et∞zec z EBCDIC do ASCII</DIV
  38072. ><DIV
  38073. CLASS="refsect1"
  38074. ><A
  38075. NAME="AEN6868"
  38076. ></A
  38077. ><H2
  38078. >Popis</H2
  38079. >int <B
  38080. CLASS="methodname"
  38081. >ebcdic2ascii</B
  38082. > ( string ebcdic_str)<BR
  38083. ></BR
  38084. ><P
  38085. >      <B
  38086. CLASS="function"
  38087. >ebcdic2ascii()</B
  38088. > je funkce specifickß pro Apache dostupnß
  38089.      pouze na operaΦnφch systΘmech zalo╛en²ch na EBCDIC (OS/390, BS2000).
  38090.      P°eklßdß (binßrn∞ bezpeΦn∞) °e╛∞zec v k≤dovßnφ EBCDIC
  38091.      <TT
  38092. CLASS="parameter"
  38093. ><I
  38094. >ascii_str</I
  38095. ></TT
  38096. > na jeho ekvivalentnφ ASCII reprezentaci,
  38097.      a vracφ v²sledek.
  38098.     </P
  38099. ><P
  38100. >      Viz takΘ opaΦnou funkci <A
  38101. HREF="#function.ascii2ebcdic"
  38102. ><B
  38103. CLASS="function"
  38104. >ascii2ebcdic()</B
  38105. ></A
  38106. >
  38107.     </P
  38108. ></DIV
  38109. ><H1
  38110. ><A
  38111. NAME="function.getallheaders"
  38112. ></A
  38113. >getallheaders</H1
  38114. ><DIV
  38115. CLASS="refnamediv"
  38116. ><A
  38117. NAME="AEN6882"
  38118. ></A
  38119. ><P
  38120. >    (PHP 3, PHP 4 )</P
  38121. >getallheaders -- Zφskßvß v╣echny hlaviΦky HTTP po╛adavku</DIV
  38122. ><DIV
  38123. CLASS="refsect1"
  38124. ><A
  38125. NAME="AEN6885"
  38126. ></A
  38127. ><H2
  38128. >Popis</H2
  38129. >array <B
  38130. CLASS="methodname"
  38131. >getallheaders</B
  38132. > ( void )<BR
  38133. ></BR
  38134. ><P
  38135. >      Tato funkce vracφ asociativnφ pole v╣ech HTTP hlaviΦek v souΦasnΘm
  38136.      po╛adavku.
  38137.     </P
  38138. ><P
  38139. >      <DIV
  38140. CLASS="note"
  38141. ><BLOCKQUOTE
  38142. CLASS="note"
  38143. ><P
  38144. ><B
  38145. >Poznßmka: </B
  38146. >
  38147.        Hodnotu b∞╛n²ch CGI prom∞nn²ch m∙╛ete takΘ zφskat tφm, ╛e je p°eΦtete
  38148.        z prost°edφ, co╛ funguje, a╗ pou╛φvßte PHP jako modu Apache nebo ne.
  38149.        Pokud chcete vid∞t seznam v╣ech systΘmov²ch prom∞nn²ch definovan²ch tφmto
  38150.        zp∙sobem, pou╛ijte <A
  38151. HREF="#function.phpinfo"
  38152. ><B
  38153. CLASS="function"
  38154. >phpinfo()</B
  38155. ></A
  38156. >.
  38157.       </P
  38158. ></BLOCKQUOTE
  38159. ></DIV
  38160. >
  38161.     </P
  38162. ><P
  38163. >      <TABLE
  38164. WIDTH="100%"
  38165. BORDER="0"
  38166. CELLPADDING="0"
  38167. CELLSPACING="0"
  38168. CLASS="EXAMPLE"
  38169. ><TR
  38170. ><TD
  38171. ><DIV
  38172. CLASS="example"
  38173. ><A
  38174. NAME="AEN6899"
  38175. ></A
  38176. ><P
  38177. ><B
  38178. >P°φklad 1. <B
  38179. CLASS="function"
  38180. >getallheaders()</B
  38181. > Example</B
  38182. ></P
  38183. ><TABLE
  38184. BORDER="0"
  38185. BGCOLOR="#E0E0E0"
  38186. CELLPADDING="5"
  38187. ><TR
  38188. ><TD
  38189. ><PRE
  38190. CLASS="php"
  38191. >$headers = getallheaders();
  38192. while (list ($header, $value) = each ($headers)) {
  38193.     echo "$header: $value<br>\n";
  38194. }</PRE
  38195. ></TD
  38196. ></TR
  38197. ></TABLE
  38198. ></DIV
  38199. ></TD
  38200. ></TR
  38201. ></TABLE
  38202. >
  38203.     </P
  38204. ><P
  38205. >      Tento p°φklad zobrazφ v╣echny hlaviΦky souΦasnΘho po╛adavku.
  38206.      <DIV
  38207. CLASS="note"
  38208. ><BLOCKQUOTE
  38209. CLASS="note"
  38210. ><P
  38211. ><B
  38212. >Poznßmka: </B
  38213. >
  38214.        <B
  38215. CLASS="function"
  38216. >getallheaders()</B
  38217. > je v souΦasnosti podporovßna jen kdy╛
  38218.        PHP b∞╛φ jako modul <SPAN
  38219. CLASS="productname"
  38220. >Apache</SPAN
  38221. >.
  38222.       </P
  38223. ></BLOCKQUOTE
  38224. ></DIV
  38225. >
  38226.     </P
  38227. ></DIV
  38228. ><H1
  38229. ><A
  38230. NAME="function.virtual"
  38231. ></A
  38232. >virtual</H1
  38233. ><DIV
  38234. CLASS="refnamediv"
  38235. ><A
  38236. NAME="AEN6909"
  38237. ></A
  38238. ><P
  38239. >    (PHP 3, PHP 4 )</P
  38240. >virtual -- Provßdφ sub-po╛adavek Apache</DIV
  38241. ><DIV
  38242. CLASS="refsect1"
  38243. ><A
  38244. NAME="AEN6912"
  38245. ></A
  38246. ><H2
  38247. >Popis</H2
  38248. >int <B
  38249. CLASS="methodname"
  38250. >virtual</B
  38251. > ( string filename)<BR
  38252. ></BR
  38253. ><P
  38254. >      <B
  38255. CLASS="function"
  38256. >virtual()</B
  38257. > je funkce specifickß pro Apache ekvivalentnφ
  38258.      s <!--#include virtual...--> v mod_include.
  38259.      Provßdφ sub-po╛adavek Apache. Je u╛iteΦnß pro vklßdßnφ CGI skript∙ nebo
  38260.      .shtml soubor∙, nebo Φehokoliv jinΘho, co mß Apache parsovat. CGI skripty
  38261.      musφ generovat platnΘ CGI hlaviΦky. To znamenß, ╛e musφ p°inejmen╣φm
  38262.      generovat Content-type hlaviΦku. Pro PHP soubory musφte pou╛φt
  38263.      <A
  38264. HREF="#function.include"
  38265. ><B
  38266. CLASS="function"
  38267. >include()</B
  38268. ></A
  38269. > nebo <A
  38270. HREF="#function.require"
  38271. ><B
  38272. CLASS="function"
  38273. >require()</B
  38274. ></A
  38275. >;
  38276.      <B
  38277. CLASS="function"
  38278. >virtual()</B
  38279. > se nedß pou╛φt k vlo╛enφ dokumentu, kter² je
  38280.      sßm PHP skriptem.
  38281.     </P
  38282. ></DIV
  38283. ></DIV
  38284. ><DIV
  38285. CLASS="reference"
  38286. ><A
  38287. NAME="ref.array"
  38288. ></A
  38289. ><DIV
  38290. CLASS="TITLEPAGE"
  38291. ><H1
  38292. CLASS="title"
  38293. >II. Funkce pro prßci s poli</H1
  38294. ><DIV
  38295. CLASS="PARTINTRO"
  38296. ><A
  38297. NAME="AEN6928"
  38298. ></A
  38299. ><DIV
  38300. CLASS="section"
  38301. ><H1
  38302. CLASS="section"
  38303. ><A
  38304. NAME="array.intro"
  38305. ></A
  38306. >┌vod</H1
  38307. ><P
  38308. >      Tyto funkce vßm umo╛≥ujφ manipulovat a interagovat r∙zn²mi zp∙soby s poli.
  38309.      Pole jsou nezbytnß pro uklßdßnφ a prßci se sadami prom∞nn²ch.
  38310.     </P
  38311. ><P
  38312. >      Podporovßna jsou jednoduchß a vφcerozm∞rnß pole; vytvß°et se dajφ u╛ivatelsky
  38313.      i jako v²stup funkce. Existujφ databßzovΘ funkce na pln∞nφ polφ v²sledky
  38314.      databßzov²ch dotaz∙, a n∞kolik dal╣φch funkcφ vracφ pole.
  38315.     </P
  38316. ><P
  38317. >      Viz takΘ Φßst manußlu <A
  38318. HREF="#language.types.array"
  38319. >pole</A
  38320. >
  38321.      pro detailnφ popis toho, jak jsou pole
  38322.      v PHP implementovßny a jak se pou╛φvajφ.
  38323.     </P
  38324. ></DIV
  38325. ><DIV
  38326. CLASS="section"
  38327. ><HR><H1
  38328. CLASS="section"
  38329. ><A
  38330. NAME="array.requirements"
  38331. ></A
  38332. >Po╛adavky</H1
  38333. ><P
  38334. >Tyto funkce jsou k dispozici jako souΦßst
  38335. standardnφho modulu, kter² je v╛dy dostupn².</P
  38336. ></DIV
  38337. ><DIV
  38338. CLASS="section"
  38339. ><HR><H1
  38340. CLASS="section"
  38341. ><A
  38342. NAME="array.installation"
  38343. ></A
  38344. >Instalace</H1
  38345. ><P
  38346. >K pou╛φvßnφ t∞chto funkcφ nenφ t°eba ╛ßdnß
  38347. instalace, jsou souΦßstφ jßdra PHP.</P
  38348. ></DIV
  38349. ><DIV
  38350. CLASS="section"
  38351. ><HR><H1
  38352. CLASS="section"
  38353. ><A
  38354. NAME="array.configuration"
  38355. ></A
  38356. >Konfigurace b∞hu</H1
  38357. ><P
  38358. >Toto roz╣φ°enφ nemß definovßno ╛ßdnΘ konfiguraΦnφ
  38359. direktivy.</P
  38360. ></DIV
  38361. ><DIV
  38362. CLASS="section"
  38363. ><HR><H1
  38364. CLASS="section"
  38365. ><A
  38366. NAME="array.resources"
  38367. ></A
  38368. >Typy prost°edk∙</H1
  38369. ><P
  38370. >Toto roz╣φ°enφ nemß definovßn ╛ßdn² typ prost°edku
  38371. (resource).</P
  38372. ></DIV
  38373. ><DIV
  38374. CLASS="section"
  38375. ><HR><H1
  38376. CLASS="section"
  38377. ><A
  38378. NAME="array.constants"
  38379. ></A
  38380. >P°eddefinovanΘ konstanty</H1
  38381. ><P
  38382. > Konstanty z tohoto seznamu jsou v╛dy dostupnΘ jako souΦßst jßdra PHP.
  38383. </P
  38384. ><P
  38385. >  <P
  38386. ></P
  38387. ><DIV
  38388. CLASS="variablelist"
  38389. ><DL
  38390. ><DT
  38391. ><TT
  38392. CLASS="constant"
  38393. ><B
  38394. >CASE_LOWER</B
  38395. ></TT
  38396. >
  38397.     (<A
  38398. HREF="#language.types.integer"
  38399. ><B
  38400. CLASS="type"
  38401. >integer</B
  38402. ></A
  38403. >)</DT
  38404. ><DD
  38405. ><P
  38406. >      <TT
  38407. CLASS="constant"
  38408. ><B
  38409. >CASE_LOWER</B
  38410. ></TT
  38411. > is used with
  38412.      <A
  38413. HREF="#function.array-change-key-case"
  38414. ><B
  38415. CLASS="function"
  38416. >array_change_key_case()</B
  38417. ></A
  38418. > and is used to convert array
  38419.      keys to lower case. This is also the default case for
  38420.      <A
  38421. HREF="#function.array-change-key-case"
  38422. ><B
  38423. CLASS="function"
  38424. >array_change_key_case()</B
  38425. ></A
  38426. >.
  38427.     </P
  38428. ></DD
  38429. ><DT
  38430. ><TT
  38431. CLASS="constant"
  38432. ><B
  38433. >CASE_UPPER</B
  38434. ></TT
  38435. >
  38436.     (<A
  38437. HREF="#language.types.integer"
  38438. ><B
  38439. CLASS="type"
  38440. >integer</B
  38441. ></A
  38442. >)</DT
  38443. ><DD
  38444. ><P
  38445. >      <TT
  38446. CLASS="constant"
  38447. ><B
  38448. >CASE_UPPER</B
  38449. ></TT
  38450. > is used with
  38451.      <A
  38452. HREF="#function.array-change-key-case"
  38453. ><B
  38454. CLASS="function"
  38455. >array_change_key_case()</B
  38456. ></A
  38457. > and is used to convert array
  38458.      keys to upper case.
  38459.     </P
  38460. ></DD
  38461. ></DL
  38462. ></DIV
  38463. >
  38464.  </P
  38465. ><P
  38466. > Sorting order flags:
  38467.  <P
  38468. ></P
  38469. ><DIV
  38470. CLASS="variablelist"
  38471. ><DL
  38472. ><DT
  38473. ><TT
  38474. CLASS="constant"
  38475. ><B
  38476. >SORT_ASC</B
  38477. ></TT
  38478.     (<A
  38479. HREF="#language.types.integer"
  38480. ><B
  38481. CLASS="type"
  38482. >integer</B
  38483. ></A
  38484. >)</DT
  38485. ><DD
  38486. ><P
  38487. >      <TT
  38488. CLASS="constant"
  38489. ><B
  38490. >SORT_ASC</B
  38491. ></TT
  38492. > is used with
  38493.      <A
  38494. HREF="#function.array-multisort"
  38495. ><B
  38496. CLASS="function"
  38497. >array_multisort()</B
  38498. ></A
  38499. > to sort in ascending order.
  38500.     </P
  38501. ></DD
  38502. ><DT
  38503. ><TT
  38504. CLASS="constant"
  38505. ><B
  38506. >SORT_DESC</B
  38507. ></TT
  38508.     (<A
  38509. HREF="#language.types.integer"
  38510. ><B
  38511. CLASS="type"
  38512. >integer</B
  38513. ></A
  38514. >)</DT
  38515. ><DD
  38516. ><P
  38517. >      <TT
  38518. CLASS="constant"
  38519. ><B
  38520. >SORT_DESC</B
  38521. ></TT
  38522. > is used with
  38523.      <A
  38524. HREF="#function.array-multisort"
  38525. ><B
  38526. CLASS="function"
  38527. >array_multisort()</B
  38528. ></A
  38529. > to sort in descending order.
  38530.     </P
  38531. ></DD
  38532. ></DL
  38533. ></DIV
  38534. >
  38535.  </P
  38536. ><P
  38537. > Sorting type flags: used by various sort functions
  38538.  <P
  38539. ></P
  38540. ><DIV
  38541. CLASS="variablelist"
  38542. ><DL
  38543. ><DT
  38544. ><TT
  38545. CLASS="constant"
  38546. ><B
  38547. >SORT_REGULAR</B
  38548. ></TT
  38549.     (<A
  38550. HREF="#language.types.integer"
  38551. ><B
  38552. CLASS="type"
  38553. >integer</B
  38554. ></A
  38555. >)</DT
  38556. ><DD
  38557. ><P
  38558. >      <TT
  38559. CLASS="constant"
  38560. ><B
  38561. >SORT_REGULAR</B
  38562. ></TT
  38563. > is used to compare items normally.
  38564.     </P
  38565. ></DD
  38566. ><DT
  38567. ><TT
  38568. CLASS="constant"
  38569. ><B
  38570. >SORT_NUMERIC</B
  38571. ></TT
  38572.     (<A
  38573. HREF="#language.types.integer"
  38574. ><B
  38575. CLASS="type"
  38576. >integer</B
  38577. ></A
  38578. >)</DT
  38579. ><DD
  38580. ><P
  38581. >      <TT
  38582. CLASS="constant"
  38583. ><B
  38584. >SORT_NUMERIC</B
  38585. ></TT
  38586. > is used to compare items numerically.
  38587.     </P
  38588. ></DD
  38589. ><DT
  38590. ><TT
  38591. CLASS="constant"
  38592. ><B
  38593. >SORT_STRING</B
  38594. ></TT
  38595.     (<A
  38596. HREF="#language.types.integer"
  38597. ><B
  38598. CLASS="type"
  38599. >integer</B
  38600. ></A
  38601. >)</DT
  38602. ><DD
  38603. ><P
  38604. >     <TT
  38605. CLASS="constant"
  38606. ><B
  38607. >SORT_STRING</B
  38608. ></TT
  38609. > is used to compare items as strings.
  38610.     </P
  38611. ></DD
  38612. ></DL
  38613. ></DIV
  38614. >
  38615.  </P
  38616. ><P
  38617. ></P
  38618. ><DIV
  38619. CLASS="variablelist"
  38620. ><DL
  38621. ><DT
  38622. ><TT
  38623. CLASS="constant"
  38624. ><B
  38625. >COUNT_NORMAL</B
  38626. ></TT
  38627. >
  38628.      (<A
  38629. HREF="#language.types.integer"
  38630. ><B
  38631. CLASS="type"
  38632. >integer</B
  38633. ></A
  38634. >)</DT
  38635. ><DD
  38636. ><P
  38637. >
  38638.     </P
  38639. ></DD
  38640. ><DT
  38641. ><TT
  38642. CLASS="constant"
  38643. ><B
  38644. >COUNT_RECURSIVE</B
  38645. ></TT
  38646. >
  38647.      (<A
  38648. HREF="#language.types.integer"
  38649. ><B
  38650. CLASS="type"
  38651. >integer</B
  38652. ></A
  38653. >)</DT
  38654. ><DD
  38655. ><P
  38656. >
  38657.     </P
  38658. ></DD
  38659. ><DT
  38660. ><TT
  38661. CLASS="constant"
  38662. ><B
  38663. >EXTR_OVERWRITE</B
  38664. ></TT
  38665. >
  38666.      (<A
  38667. HREF="#language.types.integer"
  38668. ><B
  38669. CLASS="type"
  38670. >integer</B
  38671. ></A
  38672. >)</DT
  38673. ><DD
  38674. ><P
  38675. >
  38676.     </P
  38677. ></DD
  38678. ><DT
  38679. ><TT
  38680. CLASS="constant"
  38681. ><B
  38682. >EXTR_SKIP</B
  38683. ></TT
  38684. >
  38685.      (<A
  38686. HREF="#language.types.integer"
  38687. ><B
  38688. CLASS="type"
  38689. >integer</B
  38690. ></A
  38691. >)</DT
  38692. ><DD
  38693. ><P
  38694. >
  38695.     </P
  38696. ></DD
  38697. ><DT
  38698. ><TT
  38699. CLASS="constant"
  38700. ><B
  38701. >EXTR_PREFIX_SAME</B
  38702. ></TT
  38703. >
  38704.      (<A
  38705. HREF="#language.types.integer"
  38706. ><B
  38707. CLASS="type"
  38708. >integer</B
  38709. ></A
  38710. >)</DT
  38711. ><DD
  38712. ><P
  38713. >
  38714.     </P
  38715. ></DD
  38716. ><DT
  38717. ><TT
  38718. CLASS="constant"
  38719. ><B
  38720. >EXTR_PREFIX_ALL</B
  38721. ></TT
  38722. >
  38723.      (<A
  38724. HREF="#language.types.integer"
  38725. ><B
  38726. CLASS="type"
  38727. >integer</B
  38728. ></A
  38729. >)</DT
  38730. ><DD
  38731. ><P
  38732. >
  38733.     </P
  38734. ></DD
  38735. ><DT
  38736. ><TT
  38737. CLASS="constant"
  38738. ><B
  38739. >EXTR_PREFIX_INVALID</B
  38740. ></TT
  38741. >
  38742.      (<A
  38743. HREF="#language.types.integer"
  38744. ><B
  38745. CLASS="type"
  38746. >integer</B
  38747. ></A
  38748. >)</DT
  38749. ><DD
  38750. ><P
  38751. >
  38752.     </P
  38753. ></DD
  38754. ><DT
  38755. ><TT
  38756. CLASS="constant"
  38757. ><B
  38758. >EXTR_PREFIX_IF_EXISTS</B
  38759. ></TT
  38760. >
  38761.      (<A
  38762. HREF="#language.types.integer"
  38763. ><B
  38764. CLASS="type"
  38765. >integer</B
  38766. ></A
  38767. >)</DT
  38768. ><DD
  38769. ><P
  38770. >
  38771.     </P
  38772. ></DD
  38773. ><DT
  38774. ><TT
  38775. CLASS="constant"
  38776. ><B
  38777. >EXTR_IF_EXISTS</B
  38778. ></TT
  38779. >
  38780.      (<A
  38781. HREF="#language.types.integer"
  38782. ><B
  38783. CLASS="type"
  38784. >integer</B
  38785. ></A
  38786. >)</DT
  38787. ><DD
  38788. ><P
  38789. >
  38790.     </P
  38791. ></DD
  38792. ><DT
  38793. ><TT
  38794. CLASS="constant"
  38795. ><B
  38796. >EXTR_REFS</B
  38797. ></TT
  38798. >
  38799.      (<A
  38800. HREF="#language.types.integer"
  38801. ><B
  38802. CLASS="type"
  38803. >integer</B
  38804. ></A
  38805. >)</DT
  38806. ><DD
  38807. ><P
  38808. >
  38809.     </P
  38810. ></DD
  38811. ></DL
  38812. ></DIV
  38813. ></DIV
  38814. ><DIV
  38815. CLASS="section"
  38816. ><HR><H1
  38817. CLASS="section"
  38818. ><A
  38819. NAME="array.seealso"
  38820. ></A
  38821. >Viz takΘ</H1
  38822. ><P
  38823. >      Viz takΘ <A
  38824. HREF="#function.is-array"
  38825. ><B
  38826. CLASS="function"
  38827. >is_array()</B
  38828. ></A
  38829. >, <A
  38830. HREF="#function.explode"
  38831. ><B
  38832. CLASS="function"
  38833. >explode()</B
  38834. ></A
  38835. >,
  38836.      <A
  38837. HREF="#function.implode"
  38838. ><B
  38839. CLASS="function"
  38840. >implode()</B
  38841. ></A
  38842. >, <A
  38843. HREF="#function.split"
  38844. ><B
  38845. CLASS="function"
  38846. >split()</B
  38847. ></A
  38848. >,
  38849.      <A
  38850. HREF="#function.preg-split"
  38851. ><B
  38852. CLASS="function"
  38853. >preg_split()</B
  38854. ></A
  38855. > a <A
  38856. HREF="#function.unset"
  38857. ><B
  38858. CLASS="function"
  38859. >unset()</B
  38860. ></A
  38861. >.
  38862.     </P
  38863. ></DIV
  38864. ></DIV
  38865. ><DIV
  38866. CLASS="TOC"
  38867. ><DL
  38868. ><DT
  38869. ><B
  38870. >Obsah</B
  38871. ></DT
  38872. ><DT
  38873. ><A
  38874. HREF="#function.array-change-key-case"
  38875. >array_change_key_case</A
  38876. > -- Returns an array with all string keys lowercased or uppercased</DT
  38877. ><DT
  38878. ><A
  38879. HREF="#function.array-chunk"
  38880. >array_chunk</A
  38881. > -- Split an array into chunks</DT
  38882. ><DT
  38883. ><A
  38884. HREF="#function.array-combine"
  38885. >array_combine</A
  38886. > -- 
  38887.      Creates an array by using one array for keys and another for its values
  38888.     </DT
  38889. ><DT
  38890. ><A
  38891. HREF="#function.array-count-values"
  38892. >array_count_values</A
  38893. > -- SpoΦφtat v╣echny hodnoty v poli</DT
  38894. ><DT
  38895. ><A
  38896. HREF="#function.array-diff-assoc"
  38897. >array_diff_assoc</A
  38898. > -- Computes the difference of arrays with additional index check</DT
  38899. ><DT
  38900. ><A
  38901. HREF="#function.array-diff-uassoc"
  38902. >array_diff_uassoc</A
  38903. > -- Computes the difference of arrays with additional index check which is performed by a user supplied callback function.</DT
  38904. ><DT
  38905. ><A
  38906. HREF="#function.array-diff"
  38907. >array_diff</A
  38908. > -- SpoΦφtat rozdφl polφ</DT
  38909. ><DT
  38910. ><A
  38911. HREF="#function.array-fill"
  38912. >array_fill</A
  38913. > -- Fill an array with values</DT
  38914. ><DT
  38915. ><A
  38916. HREF="#function.array-filter"
  38917. >array_filter</A
  38918. > -- 
  38919.      Filters elements of an array using a callback function
  38920.     </DT
  38921. ><DT
  38922. ><A
  38923. HREF="#function.array-flip"
  38924. >array_flip</A
  38925. > -- Prohodit klφΦe a hodnoty pole</DT
  38926. ><DT
  38927. ><A
  38928. HREF="#function.array-intersect-assoc"
  38929. >array_intersect_assoc</A
  38930. > -- Computes the intersection of arrays with additional index check</DT
  38931. ><DT
  38932. ><A
  38933. HREF="#function.array-intersect"
  38934. >array_intersect</A
  38935. > -- SpoΦφtat pr∙nik polφ</DT
  38936. ><DT
  38937. ><A
  38938. HREF="#function.array-key-exists"
  38939. >array_key_exists</A
  38940. > -- Checks if the given key or index exists in the array</DT
  38941. ><DT
  38942. ><A
  38943. HREF="#function.array-keys"
  38944. >array_keys</A
  38945. > -- Vrßtit v╣echny klφΦe pole</DT
  38946. ><DT
  38947. ><A
  38948. HREF="#function.array-map"
  38949. >array_map</A
  38950. > -- 
  38951.      Applies the callback to the elements of the given arrays
  38952.     </DT
  38953. ><DT
  38954. ><A
  38955. HREF="#function.array-merge-recursive"
  38956. >array_merge_recursive</A
  38957. > -- Rekurzivn∞ slouΦit dv∞ nebo vφce polφ</DT
  38958. ><DT
  38959. ><A
  38960. HREF="#function.array-merge"
  38961. >array_merge</A
  38962. > -- SlouΦit dv∞ nebo vφce polφ</DT
  38963. ><DT
  38964. ><A
  38965. HREF="#function.array-multisort"
  38966. >array_multisort</A
  38967. > -- T°φdit vφce polφ, nebo vφcerozm∞rnΘ pole</DT
  38968. ><DT
  38969. ><A
  38970. HREF="#function.array-pad"
  38971. >array_pad</A
  38972. > -- Doplnit pole hodnotou na urΦenou dΘlku</DT
  38973. ><DT
  38974. ><A
  38975. HREF="#function.array-pop"
  38976. >array_pop</A
  38977. > -- Odstranit prvek z konce pole</DT
  38978. ><DT
  38979. ><A
  38980. HREF="#function.array-push"
  38981. >array_push</A
  38982. > -- P°idat jeden nebo vφce prvk∙ na konec pole</DT
  38983. ><DT
  38984. ><A
  38985. HREF="#function.array-rand"
  38986. >array_rand</A
  38987. > -- Vybrat nßhodn∞ jeden nebo vφce prvk∙ pole</DT
  38988. ><DT
  38989. ><A
  38990. HREF="#function.array-reduce"
  38991. >array_reduce</A
  38992. > -- 
  38993.      Iteratively reduce the array to a single value using a callback
  38994.      function
  38995.     </DT
  38996. ><DT
  38997. ><A
  38998. HREF="#function.array-reverse"
  38999. >array_reverse</A
  39000. > -- Vrßtit pole s prvky v opaΦnΘm po°adφ</DT
  39001. ><DT
  39002. ><A
  39003. HREF="#function.array-search"
  39004. >array_search</A
  39005. > -- 
  39006.      Searches the array for a given value and returns the
  39007.      corresponding key if successful
  39008.     </DT
  39009. ><DT
  39010. ><A
  39011. HREF="#function.array-shift"
  39012. >array_shift</A
  39013. > -- Odstranit prvek ze zaΦßtku pole</DT
  39014. ><DT
  39015. ><A
  39016. HREF="#function.array-slice"
  39017. >array_slice</A
  39018. > -- Vytßhnout Φßst pole</DT
  39019. ><DT
  39020. ><A
  39021. HREF="#function.array-splice"
  39022. >array_splice</A
  39023. > -- Odstranit Φßst pole a nahradit ji n∞Φφm jin²m</DT
  39024. ><DT
  39025. ><A
  39026. HREF="#function.array-sum"
  39027. >array_sum</A
  39028. > -- 
  39029.      Calculate the sum of values in an array.
  39030.     </DT
  39031. ><DT
  39032. ><A
  39033. HREF="#function.array-udiff-assoc"
  39034. >array_udiff_assoc</A
  39035. > -- Computes the difference of arrays with additional index check. The data is compared by using a callback function.</DT
  39036. ><DT
  39037. ><A
  39038. HREF="#function.array-udiff-uassoc"
  39039. >array_udiff_uassoc</A
  39040. > -- Computes the difference of arrays with additional index check. The data is compared by using a callback function. The index check is done by a callback function also</DT
  39041. ><DT
  39042. ><A
  39043. HREF="#function.array-udiff"
  39044. >array_udiff</A
  39045. > -- Computes the difference of arrays by using a callback function for data comparison.</DT
  39046. ><DT
  39047. ><A
  39048. HREF="#function.array-unique"
  39049. >array_unique</A
  39050. > -- Odstranit z pole duplicitnφ hodnoty</DT
  39051. ><DT
  39052. ><A
  39053. HREF="#function.array-unshift"
  39054. >array_unshift</A
  39055. > -- P°ipojit jeden nebo vφce prvk∙ na zaΦßtek pole</DT
  39056. ><DT
  39057. ><A
  39058. HREF="#function.array-values"
  39059. >array_values</A
  39060. > -- Vrßtit v╣echny hodnoty v poli</DT
  39061. ><DT
  39062. ><A
  39063. HREF="#function.array-walk"
  39064. >array_walk</A
  39065. > -- Pou╛φt u╛ivatelskou funkci na v╣echny prvky pole</DT
  39066. ><DT
  39067. ><A
  39068. HREF="#function.array"
  39069. >array</A
  39070. > -- 
  39071.      Vytvo°it pole
  39072.     </DT
  39073. ><DT
  39074. ><A
  39075. HREF="#function.arsort"
  39076. >arsort</A
  39077. > -- T°φdit pole sestupn∞ se zachovßnφm klφΦ∙
  39078.     </DT
  39079. ><DT
  39080. ><A
  39081. HREF="#function.asort"
  39082. >asort</A
  39083. > -- T°φdit pole se zachovßnφm index∙</DT
  39084. ><DT
  39085. ><A
  39086. HREF="#function.compact"
  39087. >compact</A
  39088. > -- Vytvo°it pole obsahujφcφ prom∞nnΘ a jejich hodnoty</DT
  39089. ><DT
  39090. ><A
  39091. HREF="#function.count"
  39092. >count</A
  39093. > -- SpoΦφtat prvky v prom∞nnΘ</DT
  39094. ><DT
  39095. ><A
  39096. HREF="#function.current"
  39097. >current</A
  39098. > -- Vrßtit souΦasn² prvek pole</DT
  39099. ><DT
  39100. ><A
  39101. HREF="#function.each"
  39102. >each</A
  39103. > -- 
  39104.      Vracφ dal╣φ klφΦ/hodnota pßr z pole
  39105.     </DT
  39106. ><DT
  39107. ><A
  39108. HREF="#function.end"
  39109. >end</A
  39110. > -- 
  39111.      Nastavit vnit°nφ ukazatel pole na jeho poslednφ prvek
  39112.     </DT
  39113. ><DT
  39114. ><A
  39115. HREF="#function.extract"
  39116. >extract</A
  39117. > -- Importovat prom∞nnΘ z pole do symbolovΘ tabulky</DT
  39118. ><DT
  39119. ><A
  39120. HREF="#function.in-array"
  39121. >in_array</A
  39122. > -- Vrßtit <TT
  39123. CLASS="constant"
  39124. ><B
  39125. >TRUE</B
  39126. ></TT
  39127. >, pokud v poli existuje danß hodnota</DT
  39128. ><DT
  39129. ><A
  39130. HREF="#function.key"
  39131. >key</A
  39132. > -- Fetch a key from an associative array</DT
  39133. ><DT
  39134. ><A
  39135. HREF="#function.krsort"
  39136. >krsort</A
  39137. > -- T°φdit pole sestupn∞ podle klφΦ∙</DT
  39138. ><DT
  39139. ><A
  39140. HREF="#function.ksort"
  39141. >ksort</A
  39142. > -- T°φdit pole podle klφΦ∙</DT
  39143. ><DT
  39144. ><A
  39145. HREF="#function.list"
  39146. >list</A
  39147. > -- P°i°adit hodnoty p°om∞nn²m jako kdyby byly polem</DT
  39148. ><DT
  39149. ><A
  39150. HREF="#function.natcasesort"
  39151. >natcasesort</A
  39152. > -- 
  39153.      T°φdit pole s vyu╛itφm algoritmu "p°irozenΘho t°φd∞nφ" (case-insensitive)
  39154.     </DT
  39155. ><DT
  39156. ><A
  39157. HREF="#function.natsort"
  39158. >natsort</A
  39159. > -- 
  39160.      T°φdit pole s vyu╛itφm algoritmu "p°irozenΘho t°φd∞nφ"
  39161.     </DT
  39162. ><DT
  39163. ><A
  39164. HREF="#function.next"
  39165. >next</A
  39166. > -- Posunout internφ ukazatel pole</DT
  39167. ><DT
  39168. ><A
  39169. HREF="#function.pos"
  39170. >pos</A
  39171. > -- Zφskat souΦasn² prvek pole</DT
  39172. ><DT
  39173. ><A
  39174. HREF="#function.prev"
  39175. >prev</A
  39176. > -- Rewind internφ ukazatel pole</DT
  39177. ><DT
  39178. ><A
  39179. HREF="#function.range"
  39180. >range</A
  39181. > -- Vytvo°it pole obsahujφcφ rozsah integer∙</DT
  39182. ><DT
  39183. ><A
  39184. HREF="#function.reset"
  39185. >reset</A
  39186. > -- Nastavit internφ ukazatel pole na jeho prvnφ prvek</DT
  39187. ><DT
  39188. ><A
  39189. HREF="#function.rsort"
  39190. >rsort</A
  39191. > -- T°φdit pole sestupn∞</DT
  39192. ><DT
  39193. ><A
  39194. HREF="#function.shuffle"
  39195. >shuffle</A
  39196. > -- Zamφchat pole</DT
  39197. ><DT
  39198. ><A
  39199. HREF="#function.sizeof"
  39200. >sizeof</A
  39201. > -- Zjistit poΦet prvk∙ v poli</DT
  39202. ><DT
  39203. ><A
  39204. HREF="#function.sort"
  39205. >sort</A
  39206. > -- T°φdit pole</DT
  39207. ><DT
  39208. ><A
  39209. HREF="#function.uasort"
  39210. >uasort</A
  39211. > -- 
  39212.      T°φdit pole pomocφ u╛ivatelsky definovanΘ porovnßvacφ funkce se zachovßnφm
  39213.      klφΦ∙
  39214.     </DT
  39215. ><DT
  39216. ><A
  39217. HREF="#function.uksort"
  39218. >uksort</A
  39219. > -- 
  39220.      T°φdit pole podle klφΦ∙ pomocφ u╛ivatelsky definovane porovnßvacφ funkce
  39221.     </DT
  39222. ><DT
  39223. ><A
  39224. HREF="#function.usort"
  39225. >usort</A
  39226. > -- 
  39227.      T°φdit pole podle hodnot pomocφ u╛ivatelsky definovanΘ porovnßvacφ funkce
  39228.     </DT
  39229. ></DL
  39230. ></DIV
  39231. ></DIV
  39232. ><H1
  39233. ><A
  39234. NAME="function.array-change-key-case"
  39235. ></A
  39236. >array_change_key_case</H1
  39237. ><DIV
  39238. CLASS="refnamediv"
  39239. ><A
  39240. NAME="AEN7081"
  39241. ></A
  39242. ><P
  39243. >    (PHP 4 >= 4.2.0)</P
  39244. >array_change_key_case -- Returns an array with all string keys lowercased or uppercased</DIV
  39245. ><DIV
  39246. CLASS="refsect1"
  39247. ><A
  39248. NAME="AEN7084"
  39249. ></A
  39250. ><H2
  39251. >Description</H2
  39252. >array <B
  39253. CLASS="methodname"
  39254. >array_change_key_case</B
  39255. > ( array input [, int case])<BR
  39256. ></BR
  39257. ><P
  39258. >      <B
  39259. CLASS="function"
  39260. >array_change_key_case()</B
  39261. > changes the
  39262.      keys in the <TT
  39263. CLASS="parameter"
  39264. ><I
  39265. >input</I
  39266. ></TT
  39267. > array to
  39268.      be all lowercase or uppercase. The change depends
  39269.      on the last optional <TT
  39270. CLASS="parameter"
  39271. ><I
  39272. >case</I
  39273. ></TT
  39274. >
  39275.      parameter. You can pass two constants there,
  39276.      <TT
  39277. CLASS="constant"
  39278. ><B
  39279. >CASE_UPPER</B
  39280. ></TT
  39281. > and
  39282.      <TT
  39283. CLASS="constant"
  39284. ><B
  39285. >CASE_LOWER</B
  39286. ></TT
  39287. >. The default is
  39288.      <TT
  39289. CLASS="constant"
  39290. ><B
  39291. >CASE_LOWER</B
  39292. ></TT
  39293. >. The function will leave
  39294.      number indices as is.
  39295.     </P
  39296. ><TABLE
  39297. WIDTH="100%"
  39298. BORDER="0"
  39299. CELLPADDING="0"
  39300. CELLSPACING="0"
  39301. CLASS="EXAMPLE"
  39302. ><TR
  39303. ><TD
  39304. ><DIV
  39305. CLASS="example"
  39306. ><A
  39307. NAME="AEN7102"
  39308. ></A
  39309. ><P
  39310. ><B
  39311. >P°φklad 1. <B
  39312. CLASS="function"
  39313. >array_change_key_case()</B
  39314. > example</B
  39315. ></P
  39316. ><TABLE
  39317. BORDER="0"
  39318. BGCOLOR="#E0E0E0"
  39319. CELLPADDING="5"
  39320. ><TR
  39321. ><TD
  39322. ><PRE
  39323. CLASS="php"
  39324. ><?php
  39325. $input_array = array("FirSt" => 1, "SecOnd" => 4);
  39326. print_r(array_change_key_case($input_array, CASE_UPPER));
  39327. ?></PRE
  39328. ></TD
  39329. ></TR
  39330. ></TABLE
  39331. ><P
  39332. >       The printout of the above program will be:
  39333.      </P
  39334. ><TABLE
  39335. BORDER="0"
  39336. BGCOLOR="#E0E0E0"
  39337. CELLPADDING="5"
  39338. ><TR
  39339. ><TD
  39340. ><PRE
  39341. CLASS="screen"
  39342. >Array
  39343. (
  39344.     [FIRST] => 1
  39345.     [SECOND] => 4
  39346. )</PRE
  39347. ></TD
  39348. ></TR
  39349. ></TABLE
  39350. ></DIV
  39351. ></TD
  39352. ></TR
  39353. ></TABLE
  39354. ><P
  39355. >      If an array has indices that will be the same once run through this
  39356.      function (e.g. "keY" and "kEY"), the value that is later in the array
  39357.      will override other indices.
  39358.     </P
  39359. ></DIV
  39360. ><H1
  39361. ><A
  39362. NAME="function.array-chunk"
  39363. ></A
  39364. >array_chunk</H1
  39365. ><DIV
  39366. CLASS="refnamediv"
  39367. ><A
  39368. NAME="AEN7110"
  39369. ></A
  39370. ><P
  39371. >    (PHP 4 >= 4.2.0)</P
  39372. >array_chunk -- Split an array into chunks</DIV
  39373. ><DIV
  39374. CLASS="refsect1"
  39375. ><A
  39376. NAME="AEN7113"
  39377. ></A
  39378. ><H2
  39379. >Description</H2
  39380. >array <B
  39381. CLASS="methodname"
  39382. >array_chunk</B
  39383. > ( array input, int size [, bool preserve_keys])<BR
  39384. ></BR
  39385. ><P
  39386. >      <B
  39387. CLASS="function"
  39388. >array_chunk()</B
  39389. > splits the array into
  39390.      several arrays with <TT
  39391. CLASS="parameter"
  39392. ><I
  39393. >size</I
  39394. ></TT
  39395. > values
  39396.      in them. You may also have an array with less values
  39397.      at the end. You get the arrays as members of a
  39398.      multidimensional array indexed with numbers starting
  39399.      from zero.
  39400.     </P
  39401. ><P
  39402. >      By setting the optional <TT
  39403. CLASS="parameter"
  39404. ><I
  39405. >preserve_keys</I
  39406. ></TT
  39407. >
  39408.      parameter to <TT
  39409. CLASS="constant"
  39410. ><B
  39411. >TRUE</B
  39412. ></TT
  39413. >, you can force PHP to preserve the original
  39414.      keys from the input array. If you specify <TT
  39415. CLASS="constant"
  39416. ><B
  39417. >FALSE</B
  39418. ></TT
  39419. > new number
  39420.      indices will be used in each resulting array with
  39421.      indices starting from zero. The default is <TT
  39422. CLASS="constant"
  39423. ><B
  39424. >FALSE</B
  39425. ></TT
  39426. >.
  39427.     </P
  39428. ><TABLE
  39429. WIDTH="100%"
  39430. BORDER="0"
  39431. CELLPADDING="0"
  39432. CELLSPACING="0"
  39433. CLASS="EXAMPLE"
  39434. ><TR
  39435. ><TD
  39436. ><DIV
  39437. CLASS="example"
  39438. ><A
  39439. NAME="AEN7135"
  39440. ></A
  39441. ><P
  39442. ><B
  39443. >P°φklad 1. <B
  39444. CLASS="function"
  39445. >array_chunk()</B
  39446. > example</B
  39447. ></P
  39448. ><TABLE
  39449. BORDER="0"
  39450. BGCOLOR="#E0E0E0"
  39451. CELLPADDING="5"
  39452. ><TR
  39453. ><TD
  39454. ><PRE
  39455. CLASS="php"
  39456. ><?php
  39457. $input_array = array('a', 'b', 'c', 'd', 'e');
  39458. print_r(array_chunk($input_array, 2));
  39459. print_r(array_chunk($input_array, 2, true));
  39460. ?></PRE
  39461. ></TD
  39462. ></TR
  39463. ></TABLE
  39464. ><P
  39465. >       The printout of the above program will be:
  39466.      </P
  39467. ><TABLE
  39468. BORDER="0"
  39469. BGCOLOR="#E0E0E0"
  39470. CELLPADDING="5"
  39471. ><TR
  39472. ><TD
  39473. ><PRE
  39474. CLASS="screen"
  39475. >Array
  39476. (
  39477.     [0] => Array
  39478.         (
  39479.             [0] => a
  39480.             [1] => b
  39481.         )
  39482.  
  39483.     [1] => Array
  39484.         (
  39485.             [0] => c
  39486.             [1] => d
  39487.         )
  39488.  
  39489.     [2] => Array
  39490.         (
  39491.             [0] => e
  39492.         )
  39493.  
  39494. )
  39495. Array
  39496. (
  39497.     [0] => Array
  39498.         (
  39499.             [0] => a
  39500.             [1] => b
  39501.         )
  39502.  
  39503.     [1] => Array
  39504.         (
  39505.             [2] => c
  39506.             [3] => d
  39507.         )
  39508.  
  39509.     [2] => Array
  39510.         (
  39511.             [4] => e
  39512.         )
  39513.  
  39514. )</PRE
  39515. ></TD
  39516. ></TR
  39517. ></TABLE
  39518. ></DIV
  39519. ></TD
  39520. ></TR
  39521. ></TABLE
  39522. ></DIV
  39523. ><H1
  39524. ><A
  39525. NAME="function.array-combine"
  39526. ></A
  39527. >array_combine</H1
  39528. ><DIV
  39529. CLASS="refnamediv"
  39530. ><A
  39531. NAME="AEN7142"
  39532. ></A
  39533. ><P
  39534. >    (PHP 5 CVS only)</P
  39535. >array_combine -- 
  39536.      Creates an array by using one array for keys and another for its values
  39537.     </DIV
  39538. ><DIV
  39539. CLASS="refsect1"
  39540. ><A
  39541. NAME="AEN7145"
  39542. ></A
  39543. ><H2
  39544. >Description</H2
  39545. >array <B
  39546. CLASS="methodname"
  39547. >array_combine</B
  39548. > ( array keys, array values)<BR
  39549. ></BR
  39550. ><P
  39551. >      Returns an <A
  39552. HREF="#language.types.array"
  39553. ><B
  39554. CLASS="type"
  39555. >array</B
  39556. ></A
  39557. > by using the values from the
  39558.      <TT
  39559. CLASS="parameter"
  39560. ><I
  39561. >keys</I
  39562. ></TT
  39563. > array as keys and the values from the
  39564.      <TT
  39565. CLASS="parameter"
  39566. ><I
  39567. >values</I
  39568. ></TT
  39569. > array as the corresponding values.
  39570.     </P
  39571. ><P
  39572. >      Returns <TT
  39573. CLASS="constant"
  39574. ><B
  39575. >FALSE</B
  39576. ></TT
  39577. > if the number of elements for each array isn't equal or
  39578.      if the arrays are empty.
  39579.     </P
  39580. ><P
  39581. >      <TABLE
  39582. WIDTH="100%"
  39583. BORDER="0"
  39584. CELLPADDING="0"
  39585. CELLSPACING="0"
  39586. CLASS="EXAMPLE"
  39587. ><TR
  39588. ><TD
  39589. ><DIV
  39590. CLASS="example"
  39591. ><A
  39592. NAME="AEN7163"
  39593. ></A
  39594. ><P
  39595. ><B
  39596. >P°φklad 1. A simple <B
  39597. CLASS="function"
  39598. >array_combine()</B
  39599. > example</B
  39600. ></P
  39601. ><TABLE
  39602. BORDER="0"
  39603. BGCOLOR="#E0E0E0"
  39604. CELLPADDING="5"
  39605. ><TR
  39606. ><TD
  39607. ><PRE
  39608. CLASS="php"
  39609. ><?php
  39610. $a = array('green', 'red', 'yellow');
  39611. $b = array('avocado', 'apple', 'banana');
  39612. $c = array_combine($a, $b);
  39613.  
  39614. print_r($c);
  39615. ?></PRE
  39616. ></TD
  39617. ></TR
  39618. ></TABLE
  39619. ><P
  39620. >        Outputs:
  39621.       </P
  39622. ><TABLE
  39623. BORDER="0"
  39624. BGCOLOR="#E0E0E0"
  39625. CELLPADDING="5"
  39626. ><TR
  39627. ><TD
  39628. ><PRE
  39629. CLASS="screen"
  39630. >Array
  39631. (
  39632.     [green]  => avocado
  39633.     [red]    => apple
  39634.     [yellow] => banana
  39635. )</PRE
  39636. ></TD
  39637. ></TR
  39638. ></TABLE
  39639. ></DIV
  39640. ></TD
  39641. ></TR
  39642. ></TABLE
  39643. >
  39644.     </P
  39645. ><P
  39646. >      See also <A
  39647. HREF="#function.array-merge"
  39648. ><B
  39649. CLASS="function"
  39650. >array_merge()</B
  39651. ></A
  39652. >,
  39653.      <A
  39654. HREF="#function.array-walk"
  39655. ><B
  39656. CLASS="function"
  39657. >array_walk()</B
  39658. ></A
  39659. >, and
  39660.      <A
  39661. HREF="#function.array-values"
  39662. ><B
  39663. CLASS="function"
  39664. >array_values()</B
  39665. ></A
  39666. >.
  39667.     </P
  39668. ></DIV
  39669. ><H1
  39670. ><A
  39671. NAME="function.array-count-values"
  39672. ></A
  39673. >array_count_values</H1
  39674. ><DIV
  39675. CLASS="refnamediv"
  39676. ><A
  39677. NAME="AEN7174"
  39678. ></A
  39679. ><P
  39680. >    (PHP 4 )</P
  39681. >array_count_values -- SpoΦφtat v╣echny hodnoty v poli</DIV
  39682. ><DIV
  39683. CLASS="refsect1"
  39684. ><A
  39685. NAME="AEN7177"
  39686. ></A
  39687. ><H2
  39688. >Popis</H2
  39689. >array <B
  39690. CLASS="methodname"
  39691. >array_count_values</B
  39692. > ( array input)<BR
  39693. ></BR
  39694. ><P
  39695. >      <B
  39696. CLASS="function"
  39697. >array_count_values()</B
  39698. > vracφ pole pou╛φvajφcφ hodnoty z
  39699.      <TT
  39700. CLASS="parameter"
  39701. ><I
  39702. >input</I
  39703. ></TT
  39704. > jako klφΦe a jejich Φetnosti v
  39705.      <TT
  39706. CLASS="parameter"
  39707. ><I
  39708. >input</I
  39709. ></TT
  39710. > jako hodnoty.
  39711.     </P
  39712. ><P
  39713. >      <TABLE
  39714. WIDTH="100%"
  39715. BORDER="0"
  39716. CELLPADDING="0"
  39717. CELLSPACING="0"
  39718. CLASS="EXAMPLE"
  39719. ><TR
  39720. ><TD
  39721. ><DIV
  39722. CLASS="example"
  39723. ><A
  39724. NAME="AEN7190"
  39725. ></A
  39726. ><P
  39727. ><B
  39728. >P°φklad 1. Ukßzka <B
  39729. CLASS="function"
  39730. >array_count_values()</B
  39731. ></B
  39732. ></P
  39733. ><TABLE
  39734. BORDER="0"
  39735. BGCOLOR="#E0E0E0"
  39736. CELLPADDING="5"
  39737. ><TR
  39738. ><TD
  39739. ><PRE
  39740. CLASS="php"
  39741. >$array = array (1, "hello", 1, "world", "hello");
  39742. array_count_values ($array); // vracφ array(1=>2, "hello"=>2, "world"=>1)</PRE
  39743. ></TD
  39744. ></TR
  39745. ></TABLE
  39746. ></DIV
  39747. ></TD
  39748. ></TR
  39749. ></TABLE
  39750. >
  39751.     </P
  39752. ></DIV
  39753. ><H1
  39754. ><A
  39755. NAME="function.array-diff-assoc"
  39756. ></A
  39757. >array_diff_assoc</H1
  39758. ><DIV
  39759. CLASS="refnamediv"
  39760. ><A
  39761. NAME="AEN7195"
  39762. ></A
  39763. ><P
  39764. >    (PHP 4 >= 4.3.0)</P
  39765. >array_diff_assoc -- Computes the difference of arrays with additional index check</DIV
  39766. ><DIV
  39767. CLASS="refsect1"
  39768. ><A
  39769. NAME="AEN7198"
  39770. ></A
  39771. ><H2
  39772. >Description</H2
  39773. >array <B
  39774. CLASS="methodname"
  39775. >array_diff_assoc</B
  39776. > ( array array1, array array2 [, array ...])<BR
  39777. ></BR
  39778. ><P
  39779. >      <B
  39780. CLASS="function"
  39781. >array_diff_assoc()</B
  39782. > returns an <A
  39783. HREF="#language.types.array"
  39784. ><B
  39785. CLASS="type"
  39786. >array</B
  39787. ></A
  39788. >
  39789.      containing all the values from <TT
  39790. CLASS="parameter"
  39791. ><I
  39792. >array1</I
  39793. ></TT
  39794. >
  39795.      that are not present in any of the other arguments.
  39796.      Note that the keys are used in the comparison unlike
  39797.      <A
  39798. HREF="#function.array-diff"
  39799. ><B
  39800. CLASS="function"
  39801. >array_diff()</B
  39802. ></A
  39803. >.
  39804.     </P
  39805. ><P
  39806. >      <TABLE
  39807. WIDTH="100%"
  39808. BORDER="0"
  39809. CELLPADDING="0"
  39810. CELLSPACING="0"
  39811. CLASS="EXAMPLE"
  39812. ><TR
  39813. ><TD
  39814. ><DIV
  39815. CLASS="example"
  39816. ><A
  39817. NAME="AEN7218"
  39818. ></A
  39819. ><P
  39820. ><B
  39821. >P°φklad 1. <B
  39822. CLASS="function"
  39823. >array_diff_assoc()</B
  39824. > example</B
  39825. ></P
  39826. ><TABLE
  39827. BORDER="0"
  39828. BGCOLOR="#E0E0E0"
  39829. CELLPADDING="5"
  39830. ><TR
  39831. ><TD
  39832. ><PRE
  39833. CLASS="php"
  39834. ><?php
  39835. $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
  39836. $array2 = array("a" => "green", "yellow", "red");
  39837. $result = array_diff_assoc($array1, $array2);
  39838. print_r($result);
  39839. ?></PRE
  39840. ></TD
  39841. ></TR
  39842. ></TABLE
  39843. ><P
  39844. >        The result is:
  39845.       </P
  39846. ><TABLE
  39847. BORDER="0"
  39848. BGCOLOR="#E0E0E0"
  39849. CELLPADDING="5"
  39850. ><TR
  39851. ><TD
  39852. ><PRE
  39853. CLASS="screen"
  39854. >Array
  39855. (
  39856.     [b] => brown
  39857.     [c] => blue
  39858.     [0] => red
  39859. )</PRE
  39860. ></TD
  39861. ></TR
  39862. ></TABLE
  39863. ></DIV
  39864. ></TD
  39865. ></TR
  39866. ></TABLE
  39867. >
  39868.     </P
  39869. ><P
  39870. >      In our example above you see the <TT
  39871. CLASS="literal"
  39872. >"a" => "green"</TT
  39873. >
  39874.      pair is present in both arrays and thus it is not in the ouput from the
  39875.      function. Unlike this, the pair <TT
  39876. CLASS="literal"
  39877. >0 => "red"</TT
  39878.      is in the ouput because in the second argument <TT
  39879. CLASS="literal"
  39880. >"red"</TT
  39881. >
  39882.      has key which is <TT
  39883. CLASS="literal"
  39884. >1</TT
  39885. >. 
  39886.     </P
  39887. ><P
  39888. >      Two values from <SPAN
  39889. CLASS="emphasis"
  39890. ><I
  39891. CLASS="emphasis"
  39892. >key => value</I
  39893. ></SPAN
  39894. > pairs are
  39895.      considered equal only if <TT
  39896. CLASS="literal"
  39897. >(string) $elem1 === (string)
  39898.      $elem2 </TT
  39899. >. In other words a strict check takes place so 
  39900.      the string representations must be the same.
  39901.      
  39902.     </P
  39903. ><DIV
  39904. CLASS="note"
  39905. ><BLOCKQUOTE
  39906. CLASS="note"
  39907. ><P
  39908. ><B
  39909. >Poznßmka: </B
  39910. >
  39911.       Please note that this function only checks one dimension of a n-dimensional
  39912.       array. Of course you can check deeper dimensions by using, for example, 
  39913.       <TT
  39914. CLASS="literal"
  39915. >array_diff_assoc($array1[0], $array2[0]);</TT
  39916. >.
  39917.      </P
  39918. ></BLOCKQUOTE
  39919. ></DIV
  39920. ><P
  39921. >      See also <A
  39922. HREF="#function.array-diff"
  39923. ><B
  39924. CLASS="function"
  39925. >array_diff()</B
  39926. ></A
  39927. >,
  39928.      <A
  39929. HREF="#function.array-intersect"
  39930. ><B
  39931. CLASS="function"
  39932. >array_intersect()</B
  39933. ></A
  39934. >,
  39935.      and <A
  39936. HREF="#function.array-intersect-assoc"
  39937. ><B
  39938. CLASS="function"
  39939. >array_intersect_assoc()</B
  39940. ></A
  39941. >.
  39942.     </P
  39943. ></DIV
  39944. ><H1
  39945. ><A
  39946. NAME="function.array-diff-uassoc"
  39947. ></A
  39948. >array_diff_uassoc</H1
  39949. ><DIV
  39950. CLASS="refnamediv"
  39951. ><A
  39952. NAME="AEN7240"
  39953. ></A
  39954. ><P
  39955. >    (no version information, might be only in CVS)</P
  39956. >array_diff_uassoc -- Computes the difference of arrays with additional index check which is performed by a user supplied callback function.</DIV
  39957. ><DIV
  39958. CLASS="refsect1"
  39959. ><A
  39960. NAME="AEN7243"
  39961. ></A
  39962. ><H2
  39963. >Description</H2
  39964. >array <B
  39965. CLASS="methodname"
  39966. >array_diff_assoc</B
  39967. > ( array array1, array array2 [, array ..., callback key_compare_func])<BR
  39968. ></BR
  39969. ><P
  39970. >      <B
  39971. CLASS="function"
  39972. >array_diff_uassoc()</B
  39973. > returns an <A
  39974. HREF="#language.types.array"
  39975. ><B
  39976. CLASS="type"
  39977. >array</B
  39978. ></A
  39979. >
  39980.      containing all the values from <TT
  39981. CLASS="parameter"
  39982. ><I
  39983. >array1</I
  39984. ></TT
  39985. >
  39986.      that are not present in any of the other arguments.
  39987.      Note that the keys are used in the comparison unlike
  39988.      <A
  39989. HREF="#function.array-diff"
  39990. ><B
  39991. CLASS="function"
  39992. >array_diff()</B
  39993. ></A
  39994. >. This comparison is done by a user supplied callback function.
  39995.      It must return an integer less than, equal
  39996.      to, or greater than zero if the first argument is considered to
  39997.      be respectively less than, equal to, or greater than the
  39998.      second. This is unlike <A
  39999. HREF="#function.array-diff-assoc"
  40000. ><B
  40001. CLASS="function"
  40002. >array_diff_assoc()</B
  40003. ></A
  40004. > where an
  40005.      internal function for comparing the indices is used.
  40006.     </P
  40007. ><P
  40008. >      <TABLE
  40009. WIDTH="100%"
  40010. BORDER="0"
  40011. CELLPADDING="0"
  40012. CELLSPACING="0"
  40013. CLASS="EXAMPLE"
  40014. ><TR
  40015. ><TD
  40016. ><DIV
  40017. CLASS="example"
  40018. ><A
  40019. NAME="AEN7267"
  40020. ></A
  40021. ><P
  40022. ><B
  40023. >P°φklad 1. <B
  40024. CLASS="function"
  40025. >array_diff_uassoc()</B
  40026. > example</B
  40027. ></P
  40028. ><TABLE
  40029. BORDER="0"
  40030. BGCOLOR="#E0E0E0"
  40031. CELLPADDING="5"
  40032. ><TR
  40033. ><TD
  40034. ><PRE
  40035. CLASS="php"
  40036. ><?php
  40037. function key_compare_func($a, $b) {
  40038.     if ($a === $b) return 0;
  40039.     return ($a > $b)? 1:-1;
  40040. }
  40041.  
  40042. $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
  40043. $array2 = array("a" => "green", "yellow", "red");
  40044. $result = array_diff_uassoc($array1, $array2, "key_compare_func");
  40045. ?></PRE
  40046. ></TD
  40047. ></TR
  40048. ></TABLE
  40049. ><P
  40050. >        The result is:
  40051.       </P
  40052. ><TABLE
  40053. BORDER="0"
  40054. BGCOLOR="#E0E0E0"
  40055. CELLPADDING="5"
  40056. ><TR
  40057. ><TD
  40058. ><PRE
  40059. CLASS="screen"
  40060. >Array
  40061. (
  40062.     [b] => brown
  40063.     [c] => blue
  40064.     [0] => red
  40065. )</PRE
  40066. ></TD
  40067. ></TR
  40068. ></TABLE
  40069. ></DIV
  40070. ></TD
  40071. ></TR
  40072. ></TABLE
  40073. >
  40074.     </P
  40075. ><P
  40076. >      In our example above you see the <TT
  40077. CLASS="literal"
  40078. >"a" => "green"</TT
  40079. >
  40080.      pair is present in both arrays and thus it is not in the ouput from the
  40081.      function. Unlike this, the pair <TT
  40082. CLASS="literal"
  40083. >0 => "red"</TT
  40084. >
  40085.      is in the ouput because in the second argument <TT
  40086. CLASS="literal"
  40087. >"red"</TT
  40088. >
  40089.      has key which is <TT
  40090. CLASS="literal"
  40091. >1</TT
  40092. >.
  40093.     </P
  40094. ><P
  40095. >      The equality of 2 indices is checked by the user supplied callback function.
  40096.     </P
  40097. ><DIV
  40098. CLASS="note"
  40099. ><BLOCKQUOTE
  40100. CLASS="note"
  40101. ><P
  40102. ><B
  40103. >Poznßmka: </B
  40104. >
  40105.       Please note that this function only checks one dimension of a n-dimensional
  40106.       array. Of course you can check deeper dimensions by using, for example,
  40107.       <TT
  40108. CLASS="literal"
  40109. >array_diff_uassoc($array1[0], $array2[0], "key_compare_func");</TT
  40110. >.
  40111.      </P
  40112. ></BLOCKQUOTE
  40113. ></DIV
  40114. ><P
  40115. >      See also
  40116.      <A
  40117. HREF="#function.array-diff"
  40118. ><B
  40119. CLASS="function"
  40120. >array_diff()</B
  40121. ></A
  40122. >,
  40123.      <A
  40124. HREF="#function.array-diff-assoc"
  40125. ><B
  40126. CLASS="function"
  40127. >array_diff_assoc()</B
  40128. ></A
  40129. >,
  40130.      <A
  40131. HREF="#function.array-udiff"
  40132. ><B
  40133. CLASS="function"
  40134. >array_udiff()</B
  40135. ></A
  40136. >,
  40137.      <A
  40138. HREF="#function.array-udiff-assoc"
  40139. ><B
  40140. CLASS="function"
  40141. >array_udiff_assoc()</B
  40142. ></A
  40143. >, 
  40144.      <A
  40145. HREF="#function.array-udiff-uassoc"
  40146. ><B
  40147. CLASS="function"
  40148. >array_udiff_uassoc()</B
  40149. ></A
  40150. >, 
  40151.      <A
  40152. HREF="#function.array-intersect"
  40153. ><B
  40154. CLASS="function"
  40155. >array_intersect()</B
  40156. ></A
  40157. >,  
  40158.      <A
  40159. HREF="#function.array-intersect-assoc"
  40160. ><B
  40161. CLASS="function"
  40162. >array_intersect_assoc()</B
  40163. ></A
  40164. >,
  40165.      <B
  40166. CLASS="function"
  40167. >array_uintersect()</B
  40168. >,  
  40169.      <B
  40170. CLASS="function"
  40171. >array_uintersect_assoc()</B
  40172. > and 
  40173.      <B
  40174. CLASS="function"
  40175. >array_uintersect_uassoc()</B
  40176. >.
  40177.     </P
  40178. ></DIV
  40179. ><H1
  40180. ><A
  40181. NAME="function.array-diff"
  40182. ></A
  40183. >array_diff</H1
  40184. ><DIV
  40185. CLASS="refnamediv"
  40186. ><A
  40187. NAME="AEN7294"
  40188. ></A
  40189. ><P
  40190. >    (PHP 4 >= 4.0.1)</P
  40191. >array_diff -- SpoΦφtat rozdφl polφ</DIV
  40192. ><DIV
  40193. CLASS="refsect1"
  40194. ><A
  40195. NAME="AEN7297"
  40196. ></A
  40197. ><H2
  40198. >Popis</H2
  40199. >array <B
  40200. CLASS="methodname"
  40201. >array_diff</B
  40202. > ( array array1, array array2 [, array ...])<BR
  40203. ></BR
  40204. ><P
  40205. >      <B
  40206. CLASS="function"
  40207. >array_diff()</B
  40208. > vracφ pole obsahujφcφ v╣echny hodnoty z
  40209.      <TT
  40210. CLASS="parameter"
  40211. ><I
  40212. >array1</I
  40213. ></TT
  40214. >, kterΘ se nevyskytujφ v ╛ßdnΘm z dal╣φch
  40215.      argument∙. KlφΦe jsou zachovßny.
  40216.     </P
  40217. ><P
  40218. >      <TABLE
  40219. WIDTH="100%"
  40220. BORDER="0"
  40221. CELLPADDING="0"
  40222. CELLSPACING="0"
  40223. CLASS="EXAMPLE"
  40224. ><TR
  40225. ><TD
  40226. ><DIV
  40227. CLASS="example"
  40228. ><A
  40229. NAME="AEN7315"
  40230. ></A
  40231. ><P
  40232. ><B
  40233. >P°φklad 1. Ukßzka <B
  40234. CLASS="function"
  40235. >array_diff()</B
  40236. ></B
  40237. ></P
  40238. ><TABLE
  40239. BORDER="0"
  40240. BGCOLOR="#E0E0E0"
  40241. CELLPADDING="5"
  40242. ><TR
  40243. ><TD
  40244. ><PRE
  40245. CLASS="php"
  40246. >$array1 = array ("a" => "green", "red", "blue");
  40247. $array2 = array ("b" => "green", "yellow", "red");
  40248. $result = array_diff ($array1, $array2);</PRE
  40249. ></TD
  40250. ></TR
  40251. ></TABLE
  40252. ></DIV
  40253. ></TD
  40254. ></TR
  40255. ></TABLE
  40256. >
  40257.     </P
  40258. ><P
  40259. >      <TT
  40260. CLASS="varname"
  40261. >$result</TT
  40262. > obsahuje <TT
  40263. CLASS="literal"
  40264. >array ("blue");</TT
  40265. >
  40266.     </P
  40267. ><P
  40268. >      Viz takΘ: <A
  40269. HREF="#function.array-intersect"
  40270. ><B
  40271. CLASS="function"
  40272. >array_intersect()</B
  40273. ></A
  40274. >.
  40275.     </P
  40276. ></DIV
  40277. ><H1
  40278. ><A
  40279. NAME="function.array-fill"
  40280. ></A
  40281. >array_fill</H1
  40282. ><DIV
  40283. CLASS="refnamediv"
  40284. ><A
  40285. NAME="AEN7325"
  40286. ></A
  40287. ><P
  40288. >    (PHP 4 >= 4.2.0)</P
  40289. >array_fill -- Fill an array with values</DIV
  40290. ><DIV
  40291. CLASS="refsect1"
  40292. ><A
  40293. NAME="AEN7328"
  40294. ></A
  40295. ><H2
  40296. >Description</H2
  40297. >array <B
  40298. CLASS="methodname"
  40299. >array_fill</B
  40300. > ( int start_index, int num, mixed value)<BR
  40301. ></BR
  40302. ><P
  40303. >      <B
  40304. CLASS="function"
  40305. >array_fill()</B
  40306. > fills an array with
  40307.      <TT
  40308. CLASS="parameter"
  40309. ><I
  40310. >num</I
  40311. ></TT
  40312. > entries of the value of the
  40313.      <TT
  40314. CLASS="parameter"
  40315. ><I
  40316. >value</I
  40317. ></TT
  40318. > parameter, keys starting at the
  40319.      <TT
  40320. CLASS="parameter"
  40321. ><I
  40322. >start_index</I
  40323. ></TT
  40324. > parameter.  Note that <TT
  40325. CLASS="parameter"
  40326. ><I
  40327. >      num</I
  40328. ></TT
  40329. > must be a number greater than zero, or PHP will throw
  40330.      a warning.
  40331.     </P
  40332. ><P
  40333. >      <TABLE
  40334. WIDTH="100%"
  40335. BORDER="0"
  40336. CELLPADDING="0"
  40337. CELLSPACING="0"
  40338. CLASS="EXAMPLE"
  40339. ><TR
  40340. ><TD
  40341. ><DIV
  40342. CLASS="example"
  40343. ><A
  40344. NAME="AEN7349"
  40345. ></A
  40346. ><P
  40347. ><B
  40348. >P°φklad 1. <B
  40349. CLASS="function"
  40350. >array_fill()</B
  40351. > example</B
  40352. ></P
  40353. ><TABLE
  40354. BORDER="0"
  40355. BGCOLOR="#E0E0E0"
  40356. CELLPADDING="5"
  40357. ><TR
  40358. ><TD
  40359. ><PRE
  40360. CLASS="php"
  40361. ><?php
  40362. $a = array_fill(5, 6, 'banana');
  40363. print_r($a);
  40364. ?></PRE
  40365. ></TD
  40366. ></TR
  40367. ></TABLE
  40368. ><P
  40369. >        <TT
  40370. CLASS="varname"
  40371. >$a</TT
  40372. > now is:
  40373.       </P
  40374. ><TABLE
  40375. BORDER="0"
  40376. BGCOLOR="#E0E0E0"
  40377. CELLPADDING="5"
  40378. ><TR
  40379. ><TD
  40380. ><PRE
  40381. CLASS="screen"
  40382. >Array
  40383. (
  40384.     [5]  => banana
  40385.     [6]  => banana
  40386.     [7]  => banana
  40387.     [8]  => banana
  40388.     [9]  => banana
  40389.     [10] => banana
  40390. )</PRE
  40391. ></TD
  40392. ></TR
  40393. ></TABLE
  40394. ></DIV
  40395. ></TD
  40396. ></TR
  40397. ></TABLE
  40398. >
  40399.     </P
  40400. ><P
  40401. >      See also <A
  40402. HREF="#function.str-repeat"
  40403. ><B
  40404. CLASS="function"
  40405. >str_repeat()</B
  40406. ></A
  40407. > and
  40408.      <A
  40409. HREF="#function.range"
  40410. ><B
  40411. CLASS="function"
  40412. >range()</B
  40413. ></A
  40414. >.
  40415.     </P
  40416. ></DIV
  40417. ><H1
  40418. ><A
  40419. NAME="function.array-filter"
  40420. ></A
  40421. >array_filter</H1
  40422. ><DIV
  40423. CLASS="refnamediv"
  40424. ><A
  40425. NAME="AEN7360"
  40426. ></A
  40427. ><P
  40428. >    (PHP 4 >= 4.0.6)</P
  40429. >array_filter -- 
  40430.      Filters elements of an array using a callback function
  40431.     </DIV
  40432. ><DIV
  40433. CLASS="refsect1"
  40434. ><A
  40435. NAME="AEN7363"
  40436. ></A
  40437. ><H2
  40438. >Description</H2
  40439. >array <B
  40440. CLASS="methodname"
  40441. >array_filter</B
  40442. > ( array input [, callback callback])<BR
  40443. ></BR
  40444. ><P
  40445. >      <B
  40446. CLASS="function"
  40447. >array_filter()</B
  40448. > iterates over each value in
  40449.      the <TT
  40450. CLASS="parameter"
  40451. ><I
  40452. >input</I
  40453. ></TT
  40454. > array passing them to the
  40455.      <TT
  40456. CLASS="parameter"
  40457. ><I
  40458. >callback</I
  40459. ></TT
  40460. > function.  If the <TT
  40461. CLASS="parameter"
  40462. ><I
  40463. >      callback</I
  40464. ></TT
  40465. > function returns true, the current
  40466.      value from <TT
  40467. CLASS="parameter"
  40468. ><I
  40469. >input</I
  40470. ></TT
  40471. > is returned into the
  40472.      result array.  Array keys are preserved.
  40473.     </P
  40474. ><P
  40475. >      <TABLE
  40476. WIDTH="100%"
  40477. BORDER="0"
  40478. CELLPADDING="0"
  40479. CELLSPACING="0"
  40480. CLASS="EXAMPLE"
  40481. ><TR
  40482. ><TD
  40483. ><DIV
  40484. CLASS="example"
  40485. ><A
  40486. NAME="AEN7381"
  40487. ></A
  40488. ><P
  40489. ><B
  40490. >P°φklad 1. <B
  40491. CLASS="function"
  40492. >array_filter()</B
  40493. > example</B
  40494. ></P
  40495. ><TABLE
  40496. BORDER="0"
  40497. BGCOLOR="#E0E0E0"
  40498. CELLPADDING="5"
  40499. ><TR
  40500. ><TD
  40501. ><PRE
  40502. CLASS="php"
  40503. ><?php
  40504. function odd($var) {
  40505.     return($var % 2 == 1);
  40506. }
  40507.  
  40508. function even($var) {
  40509.     return($var % 2 == 0);
  40510. }
  40511.  
  40512. $array1 = array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5);
  40513. $array2 = array(6, 7, 8, 9, 10, 11, 12);
  40514.  
  40515. echo "Odd :\n";
  40516. print_r(array_filter($array1, "odd"));
  40517. echo "Even:\n";
  40518. print_r(array_filter($array2, "even"));
  40519. ?></PRE
  40520. ></TD
  40521. ></TR
  40522. ></TABLE
  40523. ><P
  40524. >        The printout of the program above will be:
  40525.       </P
  40526. ><TABLE
  40527. BORDER="0"
  40528. BGCOLOR="#E0E0E0"
  40529. CELLPADDING="5"
  40530. ><TR
  40531. ><TD
  40532. ><PRE
  40533. CLASS="php"
  40534. >Odd :
  40535. Array
  40536. (
  40537.     [a] => 1
  40538.     [c] => 3
  40539.     [e] => 5
  40540. )
  40541. Even:
  40542. Array
  40543. (
  40544.     [0] => 6
  40545.     [2] => 8
  40546.     [4] => 10
  40547.     [6] => 12
  40548. )</PRE
  40549. ></TD
  40550. ></TR
  40551. ></TABLE
  40552. ></DIV
  40553. ></TD
  40554. ></TR
  40555. ></TABLE
  40556. >
  40557.     </P
  40558. ><P
  40559. >      Users may not change the array itself from the callback
  40560.      function. e.g. Add/delete an element, unset the array that
  40561.      <B
  40562. CLASS="function"
  40563. >array_filter()</B
  40564. > is applied to. If the array
  40565.      is changed, the behavior of this function is undefined.
  40566.     </P
  40567. ><P
  40568. >      If the <TT
  40569. CLASS="parameter"
  40570. ><I
  40571. >callback</I
  40572. ></TT
  40573. > function is not supplied,
  40574.      <B
  40575. CLASS="function"
  40576. >array_filter()</B
  40577. > will remove all the entries of
  40578.      <TT
  40579. CLASS="parameter"
  40580. ><I
  40581. >input</I
  40582. ></TT
  40583. > that are equal to <TT
  40584. CLASS="constant"
  40585. ><B
  40586. >FALSE</B
  40587. ></TT
  40588. >. See <A
  40589. HREF="#language.types.boolean.casting"
  40590. >converting to boolean</A
  40591.      for more information.
  40592.     </P
  40593. ><P
  40594. >      <TABLE
  40595. WIDTH="100%"
  40596. BORDER="0"
  40597. CELLPADDING="0"
  40598. CELLSPACING="0"
  40599. CLASS="EXAMPLE"
  40600. ><TR
  40601. ><TD
  40602. ><DIV
  40603. CLASS="example"
  40604. ><A
  40605. NAME="AEN7396"
  40606. ></A
  40607. ><P
  40608. ><B
  40609. >P°φklad 2. <B
  40610. CLASS="function"
  40611. >array_filter()</B
  40612. > without
  40613.       <TT
  40614. CLASS="parameter"
  40615. ><I
  40616. >callback</I
  40617. ></TT
  40618. ></B
  40619. ></P
  40620. ><TABLE
  40621. BORDER="0"
  40622. BGCOLOR="#E0E0E0"
  40623. CELLPADDING="5"
  40624. ><TR
  40625. ><TD
  40626. ><PRE
  40627. CLASS="php"
  40628. ><?php
  40629.  
  40630. $entry = array(
  40631.              0 => 'foo',
  40632.              1 => false,
  40633.              2 => -1,
  40634.              3 => null,
  40635.              4 => ''
  40636.           );
  40637.  
  40638. print_r(array_filter($entry));
  40639. ?></PRE
  40640. ></TD
  40641. ></TR
  40642. ></TABLE
  40643. ><P
  40644. >        This will output :
  40645.       </P
  40646. ><TABLE
  40647. BORDER="0"
  40648. BGCOLOR="#E0E0E0"
  40649. CELLPADDING="5"
  40650. ><TR
  40651. ><TD
  40652. ><PRE
  40653. CLASS="screen"
  40654. >Array
  40655. (
  40656.     [0] => foo
  40657.     [2] => -1
  40658. )</PRE
  40659. ></TD
  40660. ></TR
  40661. ></TABLE
  40662. ></DIV
  40663. ></TD
  40664. ></TR
  40665. ></TABLE
  40666. >
  40667.     </P
  40668. ><P
  40669. >      See also <A
  40670. HREF="#function.array-map"
  40671. ><B
  40672. CLASS="function"
  40673. >array_map()</B
  40674. ></A
  40675. >,
  40676.      <A
  40677. HREF="#function.array-reduce"
  40678. ><B
  40679. CLASS="function"
  40680. >array_reduce()</B
  40681. ></A
  40682. >, and <A
  40683. HREF="#function.array-walk"
  40684. ><B
  40685. CLASS="function"
  40686. >array_walk()</B
  40687. ></A
  40688. >.
  40689.     </P
  40690. ></DIV
  40691. ><H1
  40692. ><A
  40693. NAME="function.array-flip"
  40694. ></A
  40695. >array_flip</H1
  40696. ><DIV
  40697. CLASS="refnamediv"
  40698. ><A
  40699. NAME="AEN7408"
  40700. ></A
  40701. ><P
  40702. >    (PHP 4 )</P
  40703. >array_flip -- Prohodit klφΦe a hodnoty pole</DIV
  40704. ><DIV
  40705. CLASS="refsect1"
  40706. ><A
  40707. NAME="AEN7411"
  40708. ></A
  40709. ><H2
  40710. >Popis</H2
  40711. >array <B
  40712. CLASS="methodname"
  40713. >array_flip</B
  40714. > ( array trans)<BR
  40715. ></BR
  40716. ><P
  40717. >      <B
  40718. CLASS="function"
  40719. >array_flip()</B
  40720. > pole s prohozen²mi klφΦi a hodnotami.
  40721.     </P
  40722. ><P
  40723. >      <TABLE
  40724. WIDTH="100%"
  40725. BORDER="0"
  40726. CELLPADDING="0"
  40727. CELLSPACING="0"
  40728. CLASS="EXAMPLE"
  40729. ><TR
  40730. ><TD
  40731. ><DIV
  40732. CLASS="example"
  40733. ><A
  40734. NAME="AEN7422"
  40735. ></A
  40736. ><P
  40737. ><B
  40738. >P°φklad 1. Ukßzka <B
  40739. CLASS="function"
  40740. >array_flip()</B
  40741. ></B
  40742. ></P
  40743. ><TABLE
  40744. BORDER="0"
  40745. BGCOLOR="#E0E0E0"
  40746. CELLPADDING="5"
  40747. ><TR
  40748. ><TD
  40749. ><PRE
  40750. CLASS="php"
  40751. >$trans = array_flip ($trans);
  40752. $original = strtr ($str, $trans);</PRE
  40753. ></TD
  40754. ></TR
  40755. ></TABLE
  40756. ></DIV
  40757. ></TD
  40758. ></TR
  40759. ></TABLE
  40760. >
  40761.     </P
  40762. ></DIV
  40763. ><H1
  40764. ><A
  40765. NAME="function.array-intersect-assoc"
  40766. ></A
  40767. >array_intersect_assoc</H1
  40768. ><DIV
  40769. CLASS="refnamediv"
  40770. ><A
  40771. NAME="AEN7427"
  40772. ></A
  40773. ><P
  40774. >    (PHP 4 >= 4.3.0)</P
  40775. >array_intersect_assoc -- Computes the intersection of arrays with additional index check</DIV
  40776. ><DIV
  40777. CLASS="refsect1"
  40778. ><A
  40779. NAME="AEN7430"
  40780. ></A
  40781. ><H2
  40782. >Description</H2
  40783. >array <B
  40784. CLASS="methodname"
  40785. >array_intersect_assoc</B
  40786. > ( array array1, array array2 [, array ...])<BR
  40787. ></BR
  40788. ><P
  40789. >      <B
  40790. CLASS="function"
  40791. >array_intersect_assoc()</B
  40792. > returns an array
  40793.      containing all the values of <TT
  40794. CLASS="parameter"
  40795. ><I
  40796. >array1</I
  40797. ></TT
  40798. >
  40799.      that are present in all the arguments. Note that the keys are used in
  40800.      the comparison unlike in <A
  40801. HREF="#function.array-intersect"
  40802. ><B
  40803. CLASS="function"
  40804. >array_intersect()</B
  40805. ></A
  40806. >.
  40807.     </P
  40808. ><P
  40809. >      <TABLE
  40810. WIDTH="100%"
  40811. BORDER="0"
  40812. CELLPADDING="0"
  40813. CELLSPACING="0"
  40814. CLASS="EXAMPLE"
  40815. ><TR
  40816. ><TD
  40817. ><DIV
  40818. CLASS="example"
  40819. ><A
  40820. NAME="AEN7449"
  40821. ></A
  40822. ><P
  40823. ><B
  40824. >P°φklad 1. <B
  40825. CLASS="function"
  40826. >array_intersect_assoc()</B
  40827. > example</B
  40828. ></P
  40829. ><TABLE
  40830. BORDER="0"
  40831. BGCOLOR="#E0E0E0"
  40832. CELLPADDING="5"
  40833. ><TR
  40834. ><TD
  40835. ><PRE
  40836. CLASS="php"
  40837. ><?php
  40838. $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
  40839. $array2 = array("a" => "green", "yellow", "red");
  40840. $result_array = array_intersect_assoc($array1, $array2);
  40841. ?></PRE
  40842. ></TD
  40843. ></TR
  40844. ></TABLE
  40845. ><P
  40846. >        $result_array will look like:
  40847.       </P
  40848. ><TABLE
  40849. BORDER="0"
  40850. BGCOLOR="#E0E0E0"
  40851. CELLPADDING="5"
  40852. ><TR
  40853. ><TD
  40854. ><PRE
  40855. CLASS="screen"
  40856. >Array
  40857. (
  40858.     [a] => green
  40859. )</PRE
  40860. ></TD
  40861. ></TR
  40862. ></TABLE
  40863. ></DIV
  40864. ></TD
  40865. ></TR
  40866. ></TABLE
  40867. >
  40868.     </P
  40869. ><P
  40870. >      In our example you see that only the pair <TT
  40871. CLASS="literal"
  40872. >"a" =>
  40873.      "green"</TT
  40874. > is present in both arrays and thus is returned. 
  40875.      The value <TT
  40876. CLASS="literal"
  40877. >"red"</TT
  40878. > is not returned because in 
  40879.      <TT
  40880. CLASS="varname"
  40881. >$array1</TT
  40882. > it's key is <TT
  40883. CLASS="literal"
  40884. >0</TT
  40885. > while
  40886.      the key of "red" in <TT
  40887. CLASS="varname"
  40888. >$array2</TT
  40889. > is 
  40890.      <TT
  40891. CLASS="literal"
  40892. >1</TT
  40893. >.
  40894.     </P
  40895. ><P
  40896. >      The two values from the <TT
  40897. CLASS="literal"
  40898. >key => value</TT
  40899. > pairs are
  40900.      considered equal only if 
  40901.      <TT
  40902. CLASS="literal"
  40903. >(string) $elem1 === (string) $elem2 </TT
  40904. >. In otherwords
  40905.      a strict type check is executed so the string representation must be
  40906.      the same. 
  40907.      
  40908.     </P
  40909. ><P
  40910. >      See also <A
  40911. HREF="#function.array-intersect"
  40912. ><B
  40913. CLASS="function"
  40914. >array_intersect()</B
  40915. ></A
  40916. >,
  40917.      <A
  40918. HREF="#function.array-diff"
  40919. ><B
  40920. CLASS="function"
  40921. >array_diff()</B
  40922. ></A
  40923. > and
  40924.      <A
  40925. HREF="#function.array-diff-assoc"
  40926. ><B
  40927. CLASS="function"
  40928. >array_diff_assoc()</B
  40929. ></A
  40930. >.
  40931.     </P
  40932. ></DIV
  40933. ><H1
  40934. ><A
  40935. NAME="function.array-intersect"
  40936. ></A
  40937. >array_intersect</H1
  40938. ><DIV
  40939. CLASS="refnamediv"
  40940. ><A
  40941. NAME="AEN7470"
  40942. ></A
  40943. ><P
  40944. >    (PHP 4 >= 4.0.1)</P
  40945. >array_intersect -- SpoΦφtat pr∙nik polφ</DIV
  40946. ><DIV
  40947. CLASS="refsect1"
  40948. ><A
  40949. NAME="AEN7473"
  40950. ></A
  40951. ><H2
  40952. >Popis</H2
  40953. >array <B
  40954. CLASS="methodname"
  40955. >array_intersect</B
  40956. > ( array array1, array array2 [, array ...])<BR
  40957. ></BR
  40958. ><P
  40959. >      <B
  40960. CLASS="function"
  40961. >array_intersect()</B
  40962. > vracφ pole obsahujφcφ v╣echny hodnoty
  40963.      z <TT
  40964. CLASS="parameter"
  40965. ><I
  40966. >array1</I
  40967. ></TT
  40968. >, kterΘ se vyskytujφ ve v╣ech argumentech.
  40969.      KlφΦe jsou zachovßny.
  40970.     </P
  40971. ><P
  40972. >      <TABLE
  40973. WIDTH="100%"
  40974. BORDER="0"
  40975. CELLPADDING="0"
  40976. CELLSPACING="0"
  40977. CLASS="EXAMPLE"
  40978. ><TR
  40979. ><TD
  40980. ><DIV
  40981. CLASS="example"
  40982. ><A
  40983. NAME="AEN7491"
  40984. ></A
  40985. ><P
  40986. ><B
  40987. >P°φklad 1. Ukßzka <B
  40988. CLASS="function"
  40989. >array_intersect()</B
  40990. ></B
  40991. ></P
  40992. ><TABLE
  40993. BORDER="0"
  40994. BGCOLOR="#E0E0E0"
  40995. CELLPADDING="5"
  40996. ><TR
  40997. ><TD
  40998. ><PRE
  40999. CLASS="php"
  41000. >$array1 = array ("a" => "green", "red", "blue");
  41001. $array2 = array ("b" => "green", "yellow", "red");
  41002. $result = array_intersect ($array1, $array2);</PRE
  41003. ></TD
  41004. ></TR
  41005. ></TABLE
  41006. ></DIV
  41007. ></TD
  41008. ></TR
  41009. ></TABLE
  41010. >
  41011.     </P
  41012. ><P
  41013. >      <TT
  41014. CLASS="varname"
  41015. >$result</TT
  41016. > obsahuje <TT
  41017. CLASS="literal"
  41018. >array ("a" => "green",
  41019.      "red");</TT
  41020. >
  41021.     </P
  41022. ><P
  41023. >      Viz takΘ: <A
  41024. HREF="#function.array-diff"
  41025. ><B
  41026. CLASS="function"
  41027. >array_diff()</B
  41028. ></A
  41029. >.
  41030.     </P
  41031. ></DIV
  41032. ><H1
  41033. ><A
  41034. NAME="function.array-key-exists"
  41035. ></A
  41036. >array_key_exists</H1
  41037. ><DIV
  41038. CLASS="refnamediv"
  41039. ><A
  41040. NAME="AEN7501"
  41041. ></A
  41042. ><P
  41043. >    (PHP 4 >= 4.1.0)</P
  41044. >array_key_exists -- Checks if the given key or index exists in the array</DIV
  41045. ><DIV
  41046. CLASS="refsect1"
  41047. ><A
  41048. NAME="AEN7504"
  41049. ></A
  41050. ><H2
  41051. >Description</H2
  41052. >bool <B
  41053. CLASS="methodname"
  41054. >array_key_exists</B
  41055. > ( mixed key, array search)<BR
  41056. ></BR
  41057. ><P
  41058. >      <B
  41059. CLASS="function"
  41060. >array_key_exists()</B
  41061. > returns <TT
  41062. CLASS="constant"
  41063. ><B
  41064. >TRUE</B
  41065. ></TT
  41066. > if the
  41067.      given <TT
  41068. CLASS="parameter"
  41069. ><I
  41070. >key</I
  41071. ></TT
  41072. > is set in the array.
  41073.      <TT
  41074. CLASS="parameter"
  41075. ><I
  41076. >key</I
  41077. ></TT
  41078. > can be any value possible
  41079.      for an array index.
  41080.     </P
  41081. ><P
  41082. >      <TABLE
  41083. WIDTH="100%"
  41084. BORDER="0"
  41085. CELLPADDING="0"
  41086. CELLSPACING="0"
  41087. CLASS="EXAMPLE"
  41088. ><TR
  41089. ><TD
  41090. ><DIV
  41091. CLASS="example"
  41092. ><A
  41093. NAME="AEN7521"
  41094. ></A
  41095. ><P
  41096. ><B
  41097. >P°φklad 1. <B
  41098. CLASS="function"
  41099. >array_key_exists()</B
  41100. > example</B
  41101. ></P
  41102. ><TABLE
  41103. BORDER="0"
  41104. BGCOLOR="#E0E0E0"
  41105. CELLPADDING="5"
  41106. ><TR
  41107. ><TD
  41108. ><PRE
  41109. CLASS="php"
  41110. ><?php
  41111. $search_array = array("first" => 1, "second" => 4);
  41112. if (array_key_exists("first", $search_array)) {
  41113.     echo "The 'first' element is in the array";
  41114. }
  41115. ?></PRE
  41116. ></TD
  41117. ></TR
  41118. ></TABLE
  41119. ></DIV
  41120. ></TD
  41121. ></TR
  41122. ></TABLE
  41123. >
  41124.     </P
  41125. ><DIV
  41126. CLASS="note"
  41127. ><BLOCKQUOTE
  41128. CLASS="note"
  41129. ><P
  41130. ><B
  41131. >Poznßmka: </B
  41132. >
  41133.       The name of this function is <B
  41134. CLASS="function"
  41135. >key_exists()</B
  41136. >
  41137.       in PHP version 4.0.6.
  41138.      </P
  41139. ></BLOCKQUOTE
  41140. ></DIV
  41141. ><P
  41142. >      See also <A
  41143. HREF="#function.isset"
  41144. ><B
  41145. CLASS="function"
  41146. >isset()</B
  41147. ></A
  41148. >, 
  41149.      <A
  41150. HREF="#function.array-keys"
  41151. ><B
  41152. CLASS="function"
  41153. >array_keys()</B
  41154. ></A
  41155. >, and
  41156.      <A
  41157. HREF="#function.in-array"
  41158. ><B
  41159. CLASS="function"
  41160. >in_array()</B
  41161. ></A
  41162. >.
  41163.     </P
  41164. ></DIV
  41165. ><H1
  41166. ><A
  41167. NAME="function.array-keys"
  41168. ></A
  41169. >array_keys</H1
  41170. ><DIV
  41171. CLASS="refnamediv"
  41172. ><A
  41173. NAME="AEN7533"
  41174. ></A
  41175. ><P
  41176. >    (PHP 4 )</P
  41177. >array_keys -- Vrßtit v╣echny klφΦe pole</DIV
  41178. ><DIV
  41179. CLASS="refsect1"
  41180. ><A
  41181. NAME="AEN7536"
  41182. ></A
  41183. ><H2
  41184. >Popis</H2
  41185. >array <B
  41186. CLASS="methodname"
  41187. >array_keys</B
  41188. > ( array input [, mixed search_value])<BR
  41189. ></BR
  41190. ><P
  41191. >      <B
  41192. CLASS="function"
  41193. >array_keys()</B
  41194. > vracφ klφΦe, numerickΘ i textovΘ, z pole
  41195.      <TT
  41196. CLASS="parameter"
  41197. ><I
  41198. >input</I
  41199. ></TT
  41200. >.
  41201.     </P
  41202. ><P
  41203. >      Pokud je p°φtomen voliteln² argument <TT
  41204. CLASS="parameter"
  41205. ><I
  41206. >search_value</I
  41207. ></TT
  41208. >,
  41209.      vracφ pouze klφΦe tΘto hodnoty. Jinak vracφ v╣echny klφΦe z pole
  41210.      <TT
  41211. CLASS="parameter"
  41212. ><I
  41213. >input</I
  41214. ></TT
  41215. >.
  41216.     </P
  41217. ><P
  41218. >      <TABLE
  41219. WIDTH="100%"
  41220. BORDER="0"
  41221. CELLPADDING="0"
  41222. CELLSPACING="0"
  41223. CLASS="EXAMPLE"
  41224. ><TR
  41225. ><TD
  41226. ><DIV
  41227. CLASS="example"
  41228. ><A
  41229. NAME="AEN7554"
  41230. ></A
  41231. ><P
  41232. ><B
  41233. >P°φklad 1. Ukßzka <B
  41234. CLASS="function"
  41235. >array_keys()</B
  41236. ></B
  41237. ></P
  41238. ><TABLE
  41239. BORDER="0"
  41240. BGCOLOR="#E0E0E0"
  41241. CELLPADDING="5"
  41242. ><TR
  41243. ><TD
  41244. ><PRE
  41245. CLASS="php"
  41246. >$array = array (0 => 100, "color" => "red");
  41247. array_keys ($array);       // vracφ array (0, "color")
  41248.  
  41249. $array = array ("blue", "red", "green", "blue", "blue");
  41250. array_keys ($array, "blue");  //  vracφ array (0, 3, 4)
  41251.  
  41252. $array = array ("color" => array("blue", "red", "green"), "size" => array("small", "medium", "large"));
  41253. array_keys ($array);  //  vracφ array ("color", "size")</PRE
  41254. ></TD
  41255. ></TR
  41256. ></TABLE
  41257. ></DIV
  41258. ></TD
  41259. ></TR
  41260. ></TABLE
  41261. >
  41262.     </P
  41263. ><DIV
  41264. CLASS="note"
  41265. ><BLOCKQUOTE
  41266. CLASS="note"
  41267. ><P
  41268. ><B
  41269. >Poznßmka: </B
  41270. >
  41271.       Tato funkce byla p°idßna v PHP 4, dßle je uvedena implementace pro ty, kte°φ
  41272.       stßle pou╛φvajφ PHP 3.
  41273.       <TABLE
  41274. WIDTH="100%"
  41275. BORDER="0"
  41276. CELLPADDING="0"
  41277. CELLSPACING="0"
  41278. CLASS="EXAMPLE"
  41279. ><TR
  41280. ><TD
  41281. ><DIV
  41282. CLASS="example"
  41283. ><A
  41284. NAME="AEN7560"
  41285. ></A
  41286. ><P
  41287. ><B
  41288. >P°φklad 2. 
  41289.         Implementace <B
  41290. CLASS="function"
  41291. >array_keys()</B
  41292. > pro u╛ivatele PHP 3
  41293.        </B
  41294. ></P
  41295. ><TABLE
  41296. BORDER="0"
  41297. BGCOLOR="#E0E0E0"
  41298. CELLPADDING="5"
  41299. ><TR
  41300. ><TD
  41301. ><PRE
  41302. CLASS="php"
  41303. >function array_keys ($arr, $term="") {
  41304.     $t = array();
  41305.     while (list($k,$v) = each($arr)) {
  41306.         if ($term && $v != $term)
  41307.             continue;
  41308.             $t[] = $k;
  41309.         }
  41310.         return $t;
  41311. }</PRE
  41312. ></TD
  41313. ></TR
  41314. ></TABLE
  41315. ></DIV
  41316. ></TD
  41317. ></TR
  41318. ></TABLE
  41319. >
  41320.      </P
  41321. ></BLOCKQUOTE
  41322. ></DIV
  41323. ><P
  41324. >      Viz takΘ: <A
  41325. HREF="#function.array-values"
  41326. ><B
  41327. CLASS="function"
  41328. >array_values()</B
  41329. ></A
  41330. >.
  41331.     </P
  41332. ></DIV
  41333. ><H1
  41334. ><A
  41335. NAME="function.array-map"
  41336. ></A
  41337. >array_map</H1
  41338. ><DIV
  41339. CLASS="refnamediv"
  41340. ><A
  41341. NAME="AEN7567"
  41342. ></A
  41343. ><P
  41344. >    (PHP 4 >= 4.0.6)</P
  41345. >array_map -- 
  41346.      Applies the callback to the elements of the given arrays
  41347.     </DIV
  41348. ><DIV
  41349. CLASS="refsect1"
  41350. ><A
  41351. NAME="AEN7570"
  41352. ></A
  41353. ><H2
  41354. >Description</H2
  41355. >array <B
  41356. CLASS="methodname"
  41357. >array_map</B
  41358. > ( mixed callback, array arr1 [, array ...])<BR
  41359. ></BR
  41360. ><P
  41361. >      <B
  41362. CLASS="function"
  41363. >array_map()</B
  41364. > returns an array containing all
  41365.      the elements of <TT
  41366. CLASS="parameter"
  41367. ><I
  41368. >arr1</I
  41369. ></TT
  41370. > after applying the
  41371.      <TT
  41372. CLASS="parameter"
  41373. ><I
  41374. >callback</I
  41375. ></TT
  41376. > function to each one.
  41377.      The number of parameters that the <TT
  41378. CLASS="parameter"
  41379. ><I
  41380. >callback</I
  41381. ></TT
  41382. >
  41383.      function accepts
  41384.      should match the number of arrays
  41385.      passed to the <B
  41386. CLASS="function"
  41387. >array_map()</B
  41388. >
  41389.     </P
  41390. ><P
  41391. >      <TABLE
  41392. WIDTH="100%"
  41393. BORDER="0"
  41394. CELLPADDING="0"
  41395. CELLSPACING="0"
  41396. CLASS="EXAMPLE"
  41397. ><TR
  41398. ><TD
  41399. ><DIV
  41400. CLASS="example"
  41401. ><A
  41402. NAME="AEN7591"
  41403. ></A
  41404. ><P
  41405. ><B
  41406. >P°φklad 1. <B
  41407. CLASS="function"
  41408. >array_map()</B
  41409. > example</B
  41410. ></P
  41411. ><TABLE
  41412. BORDER="0"
  41413. BGCOLOR="#E0E0E0"
  41414. CELLPADDING="5"
  41415. ><TR
  41416. ><TD
  41417. ><PRE
  41418. CLASS="php"
  41419. ><?php
  41420. function cube($n) {
  41421.     return($n * $n * $n);
  41422. }
  41423.  
  41424. $a = array(1, 2, 3, 4, 5);
  41425. $b = array_map("cube", $a);
  41426. print_r($b);
  41427. ?></PRE
  41428. ></TD
  41429. ></TR
  41430. ></TABLE
  41431. ><P
  41432. >        This makes <TT
  41433. CLASS="varname"
  41434. >$b</TT
  41435. > have:
  41436.       </P
  41437. ><TABLE
  41438. BORDER="0"
  41439. BGCOLOR="#E0E0E0"
  41440. CELLPADDING="5"
  41441. ><TR
  41442. ><TD
  41443. ><PRE
  41444. CLASS="screen"
  41445. >Array
  41446. (
  41447.     [0] => 1
  41448.     [1] => 8
  41449.     [2] => 27
  41450.     [3] => 64
  41451.     [4] => 125
  41452. )</PRE
  41453. ></TD
  41454. ></TR
  41455. ></TABLE
  41456. ></DIV
  41457. ></TD
  41458. ></TR
  41459. ></TABLE
  41460. >
  41461.     </P
  41462. ><P
  41463. >      <TABLE
  41464. WIDTH="100%"
  41465. BORDER="0"
  41466. CELLPADDING="0"
  41467. CELLSPACING="0"
  41468. CLASS="EXAMPLE"
  41469. ><TR
  41470. ><TD
  41471. ><DIV
  41472. CLASS="example"
  41473. ><A
  41474. NAME="AEN7599"
  41475. ></A
  41476. ><P
  41477. ><B
  41478. >P°φklad 2. <B
  41479. CLASS="function"
  41480. >array_map()</B
  41481. > - using more arrays</B
  41482. ></P
  41483. ><TABLE
  41484. BORDER="0"
  41485. BGCOLOR="#E0E0E0"
  41486. CELLPADDING="5"
  41487. ><TR
  41488. ><TD
  41489. ><PRE
  41490. CLASS="php"
  41491. ><?php
  41492. function show_Spanish($n, $m) {
  41493.     return("The number $n is called $m in Spanish");
  41494. }
  41495.  
  41496. function map_Spanish($n, $m) {
  41497.     return(array($n => $m));
  41498. }
  41499.  
  41500. $a = array(1, 2, 3, 4, 5);
  41501. $b = array("uno", "dos", "tres", "cuatro", "cinco");
  41502.  
  41503. $c = array_map("show_Spanish", $a, $b);
  41504. print_r($c);
  41505.  
  41506. $d = array_map("map_Spanish", $a , $b);
  41507. print_r($d);
  41508. ?></PRE
  41509. ></TD
  41510. ></TR
  41511. ></TABLE
  41512. ><P
  41513. >        This results:
  41514.       </P
  41515. ><TABLE
  41516. BORDER="0"
  41517. BGCOLOR="#E0E0E0"
  41518. CELLPADDING="5"
  41519. ><TR
  41520. ><TD
  41521. ><PRE
  41522. CLASS="screen"
  41523. >// printout of $c
  41524. Array
  41525. (
  41526.     [0] => The number 1 is called uno in Spanish
  41527.     [1] => The number 2 is called dos in Spanish
  41528.     [2] => The number 3 is called tres in Spanish
  41529.     [3] => The number 4 is called cuatro in Spanish
  41530.     [4] => The number 5 is called cinco in Spanish
  41531. )
  41532.  
  41533. // printout of $d
  41534. Array
  41535. (
  41536.     [0] => Array
  41537.         (
  41538.             [1] => uno
  41539.         )
  41540.  
  41541.     [1] => Array
  41542.         (
  41543.             [2] => dos
  41544.         )
  41545.  
  41546.     [2] => Array
  41547.         (
  41548.             [3] => tres
  41549.         )
  41550.  
  41551.     [3] => Array
  41552.         (
  41553.             [4] => cuatro
  41554.         )
  41555.  
  41556.     [4] => Array
  41557.         (
  41558.             [5] => cinco
  41559.         )
  41560.  
  41561. )</PRE
  41562. ></TD
  41563. ></TR
  41564. ></TABLE
  41565. ></DIV
  41566. ></TD
  41567. ></TR
  41568. ></TABLE
  41569. >
  41570.     </P
  41571. ><P
  41572. >      Usually when using two or more arrays, they should be of equal length
  41573.      because the callback function is applied in parallel to the corresponding
  41574.      elements.
  41575.      If the arrays are of unequal length, the shortest one will be extended
  41576.      with empty elements.
  41577.     </P
  41578. ><P
  41579. >      An interesting use of this function is to construct an array of arrays,
  41580.      which can be easily performed by using <TT
  41581. CLASS="constant"
  41582. ><B
  41583. >NULL</B
  41584. ></TT
  41585. >
  41586.      as the name of the callback function
  41587.     </P
  41588. ><P
  41589. >      <TABLE
  41590. WIDTH="100%"
  41591. BORDER="0"
  41592. CELLPADDING="0"
  41593. CELLSPACING="0"
  41594. CLASS="EXAMPLE"
  41595. ><TR
  41596. ><TD
  41597. ><DIV
  41598. CLASS="example"
  41599. ><A
  41600. NAME="AEN7609"
  41601. ></A
  41602. ><P
  41603. ><B
  41604. >P°φklad 3. Creating an array of arrays</B
  41605. ></P
  41606. ><TABLE
  41607. BORDER="0"
  41608. BGCOLOR="#E0E0E0"
  41609. CELLPADDING="5"
  41610. ><TR
  41611. ><TD
  41612. ><PRE
  41613. CLASS="php"
  41614. ><?php
  41615. $a = array(1, 2, 3, 4, 5);
  41616. $b = array("one", "two", "three", "four", "five");
  41617. $c = array("uno", "dos", "tres", "cuatro", "cinco");
  41618.  
  41619. $d = array_map(null, $a, $b, $c);
  41620. print_r($d);
  41621. ?></PRE
  41622. ></TD
  41623. ></TR
  41624. ></TABLE
  41625. ></DIV
  41626. ></TD
  41627. ></TR
  41628. ></TABLE
  41629. >
  41630.     </P
  41631. ><P
  41632. >      The printout of the program above will be:
  41633.     </P
  41634. ><TABLE
  41635. BORDER="0"
  41636. BGCOLOR="#E0E0E0"
  41637. CELLPADDING="5"
  41638. ><TR
  41639. ><TD
  41640. ><PRE
  41641. CLASS="screen"
  41642. >Array
  41643. (
  41644.     [0] => Array
  41645.         (
  41646.             [0] => 1
  41647.             [1] => one
  41648.             [2] => uno
  41649.         )
  41650.  
  41651.     [1] => Array
  41652.         (
  41653.             [0] => 2
  41654.             [1] => two
  41655.             [2] => dos
  41656.         )
  41657.  
  41658.     [2] => Array
  41659.         (
  41660.             [0] => 3
  41661.             [1] => three
  41662.             [2] => tres
  41663.         )
  41664.  
  41665.     [3] => Array
  41666.         (
  41667.             [0] => 4
  41668.             [1] => four
  41669.             [2] => cuatro
  41670.         )
  41671.  
  41672.     [4] => Array
  41673.         (
  41674.             [0] => 5
  41675.             [1] => five
  41676.             [2] => cinco
  41677.         )
  41678.  
  41679. )</PRE
  41680. ></TD
  41681. ></TR
  41682. ></TABLE
  41683. ><P
  41684. >      See also <A
  41685. HREF="#function.array-filter"
  41686. ><B
  41687. CLASS="function"
  41688. >array_filter()</B
  41689. ></A
  41690. >, 
  41691.      <A
  41692. HREF="#function.array-reduce"
  41693. ><B
  41694. CLASS="function"
  41695. >array_reduce()</B
  41696. ></A
  41697. >, and
  41698.      <A
  41699. HREF="#function.array-walk"
  41700. ><B
  41701. CLASS="function"
  41702. >array_walk()</B
  41703. ></A
  41704. >.
  41705.     </P
  41706. ></DIV
  41707. ><H1
  41708. ><A
  41709. NAME="function.array-merge-recursive"
  41710. ></A
  41711. >array_merge_recursive</H1
  41712. ><DIV
  41713. CLASS="refnamediv"
  41714. ><A
  41715. NAME="AEN7619"
  41716. ></A
  41717. ><P
  41718. >    (PHP 4 >= 4.0.1)</P
  41719. >array_merge_recursive -- Rekurzivn∞ slouΦit dv∞ nebo vφce polφ</DIV
  41720. ><DIV
  41721. CLASS="refsect1"
  41722. ><A
  41723. NAME="AEN7622"
  41724. ></A
  41725. ><H2
  41726. >Popis</H2
  41727. >array <B
  41728. CLASS="methodname"
  41729. >array_merge_recursive</B
  41730. > ( array array1, array array2 [, array ...])<BR
  41731. ></BR
  41732. ><P
  41733. >      <B
  41734. CLASS="function"
  41735. >array_merge_recursive()</B
  41736. > slouΦφ prvky dvou nebo vφce
  41737.      polφ tak, ╛e hodnoty pole se p°ipojφ na konec p°edchozφho pole. Vracφ
  41738.      v²slednΘ pole.
  41739.     </P
  41740. ><P
  41741. >      Pokud obsahujφ vstupnφ pole stejn² textov² klφΦ, hodnoty t∞chto klφΦ∙ se
  41742.      rekurzivn∞ slouΦφ do pole tak, ╛e pokud je jedna z hodnot sama pole, tato
  41743.      funkce ji takΘ slouΦφ s odpovφdajφcφ polo╛kou z dal╣φho pole. Pokud ale
  41744.      tato pole majφ stejn² Φφseln² klφΦ, pozd∞j╣φ hodnota nep°epφ╣e tu d°φv∞j╣φ,
  41745.      ale p°ipojφ se.
  41746.     </P
  41747. ><P
  41748. >      <TABLE
  41749. WIDTH="100%"
  41750. BORDER="0"
  41751. CELLPADDING="0"
  41752. CELLSPACING="0"
  41753. CLASS="EXAMPLE"
  41754. ><TR
  41755. ><TD
  41756. ><DIV
  41757. CLASS="example"
  41758. ><A
  41759. NAME="AEN7640"
  41760. ></A
  41761. ><P
  41762. ><B
  41763. >P°φklad 1. Ukßzka <B
  41764. CLASS="function"
  41765. >array_merge_recursive()</B
  41766. ></B
  41767. ></P
  41768. ><TABLE
  41769. BORDER="0"
  41770. BGCOLOR="#E0E0E0"
  41771. CELLPADDING="5"
  41772. ><TR
  41773. ><TD
  41774. ><PRE
  41775. CLASS="php"
  41776. >$ar1 = array ("color" => array ("favorite" => "red"), 5);
  41777. $ar2 = array (10, "color" => array ("favorite" => "green", "blue"));
  41778. $result = array_merge_recursive ($ar1, $ar2);</PRE
  41779. ></TD
  41780. ></TR
  41781. ></TABLE
  41782. ></DIV
  41783. ></TD
  41784. ></TR
  41785. ></TABLE
  41786. >
  41787.     </P
  41788. ><P
  41789. >      V²slednΘ pole bude <TT
  41790. CLASS="literal"
  41791. >array ("color" => array
  41792.      ("favorite" => array ("red", "green"), "blue"), 5, 10)</TT
  41793. >.
  41794.     </P
  41795. ><P
  41796. >      Viz takΘ: <A
  41797. HREF="#function.array-merge"
  41798. ><B
  41799. CLASS="function"
  41800. >array_merge()</B
  41801. ></A
  41802. >.
  41803.     </P
  41804. ></DIV
  41805. ><H1
  41806. ><A
  41807. NAME="function.array-merge"
  41808. ></A
  41809. >array_merge</H1
  41810. ><DIV
  41811. CLASS="refnamediv"
  41812. ><A
  41813. NAME="AEN7649"
  41814. ></A
  41815. ><P
  41816. >    (PHP 4 )</P
  41817. >array_merge -- SlouΦit dv∞ nebo vφce polφ</DIV
  41818. ><DIV
  41819. CLASS="refsect1"
  41820. ><A
  41821. NAME="AEN7652"
  41822. ></A
  41823. ><H2
  41824. >Popis</H2
  41825. >array <B
  41826. CLASS="methodname"
  41827. >array_merge</B
  41828. > ( array array1, array array2 [, array ...])<BR
  41829. ></BR
  41830. ><P
  41831. >      <B
  41832. CLASS="function"
  41833. >array_merge()</B
  41834. > slouΦφ prvky dvou nebo vφce polφ dohromady
  41835.      tak, ╛e hodnoty ka╛dΘho pole se p°ipojφ na konec p°edchozφho. Vracφ v²slednΘ
  41836.      pole.
  41837.     </P
  41838. ><P
  41839. >      Pokud majφ vstupnφ pole stejn² textov² klφΦ, pozd∞j╣φ hodnota p°epφ╣e
  41840.      d°φv∞j╣φ hodnotu. Pokud ale majφ stejn² Φφseln² klφΦ, pozd∞j╣φ hodnota tu
  41841.      p·vodnφ nep°epφ╣e, ale p°ipojφ se k nφ.
  41842.     </P
  41843. ><P
  41844. >      <TABLE
  41845. WIDTH="100%"
  41846. BORDER="0"
  41847. CELLPADDING="0"
  41848. CELLSPACING="0"
  41849. CLASS="EXAMPLE"
  41850. ><TR
  41851. ><TD
  41852. ><DIV
  41853. CLASS="example"
  41854. ><A
  41855. NAME="AEN7670"
  41856. ></A
  41857. ><P
  41858. ><B
  41859. >P°φklad 1. Ukßzka <B
  41860. CLASS="function"
  41861. >array_merge()</B
  41862. ></B
  41863. ></P
  41864. ><TABLE
  41865. BORDER="0"
  41866. BGCOLOR="#E0E0E0"
  41867. CELLPADDING="5"
  41868. ><TR
  41869. ><TD
  41870. ><PRE
  41871. CLASS="php"
  41872. >$array1 = array ("color" => "red", 2, 4);
  41873. $array2 = array ("a", "b", "color" => "green", "shape" => "trapezoid", 4);
  41874. array_merge ($array1, $array2);</PRE
  41875. ></TD
  41876. ></TR
  41877. ></TABLE
  41878. ></DIV
  41879. ></TD
  41880. ></TR
  41881. ></TABLE
  41882. >
  41883.     </P
  41884. ><P
  41885. >      V²slednΘ pole bude <TT
  41886. CLASS="literal"
  41887. >array("color" => "green", 2, 4,
  41888.      "a", "b", "shape" => "trapezoid", 4)</TT
  41889. >.
  41890.     </P
  41891. ><P
  41892. >      Viz takΘ: <A
  41893. HREF="#function.array-merge-recursive"
  41894. ><B
  41895. CLASS="function"
  41896. >array_merge_recursive()</B
  41897. ></A
  41898. >.
  41899.     </P
  41900. ></DIV
  41901. ><H1
  41902. ><A
  41903. NAME="function.array-multisort"
  41904. ></A
  41905. >array_multisort</H1
  41906. ><DIV
  41907. CLASS="refnamediv"
  41908. ><A
  41909. NAME="AEN7679"
  41910. ></A
  41911. ><P
  41912. >    (PHP 4 )</P
  41913. >array_multisort -- T°φdit vφce polφ, nebo vφcerozm∞rnΘ pole</DIV
  41914. ><DIV
  41915. CLASS="refsect1"
  41916. ><A
  41917. NAME="AEN7682"
  41918. ></A
  41919. ><H2
  41920. >Popis</H2
  41921. >bool <B
  41922. CLASS="methodname"
  41923. >array_multisort</B
  41924. > ( array ar1 [, mixed arg [, mixed ... [, array ...]]])<BR
  41925. ></BR
  41926. ><P
  41927. >      <B
  41928. CLASS="function"
  41929. >array_multisort()</B
  41930. > se dß vyu╛φt k t°φd∞nφ n∞kolika
  41931.      polφ najednou nebo k t°φd∞nφ vφcerozm∞rnΘho pole XXX according by one of
  41932.      more dimensions. P°i t°φd∞nφ udr╛uje asociace klφΦ∙.
  41933.     </P
  41934. ><P
  41935. >      Vstupnφ pole jsou manipulovßna jako sloupce tabulky, kterß se mß t°φdit
  41936.      podle °ßdk∙ - p°ipomφnß to funkcionalitu SQL klauzule ORDER BY. Prvnφ pole
  41937.      je to, podle kterΘho se bude t°φdit. ╪ßdky (hodnoty) v tomto poli that
  41938.      compare the same are sorted by the next input array, and so on.
  41939.     </P
  41940. ><P
  41941. >      Struktura argument∙ tΘto funkce je trochu neobvyklß, ale pru╛nß. Prvnφ
  41942.      argument musφ b²t pole. Ka╛d² dal╣φ argument m∙╛e b²t bu∩ pole nebo jeden
  41943.      z p°φznak z nßsledujφcφch seznam∙:
  41944.     </P
  41945. ><P
  41946. >      P°φznaky sm∞ru t°φd∞nφ:
  41947.      <P
  41948. ></P
  41949. ><UL
  41950. ><LI
  41951. ><P
  41952. >SORT_ASC - t°φdit vzestupn∞</P
  41953. ></LI
  41954. ><LI
  41955. ><P
  41956. >SORT_DESC - t°φdit sestupn∞</P
  41957. ></LI
  41958. ></UL
  41959. >
  41960.     </P
  41961. ><P
  41962. >      P°φznaky typu t°φd∞nφ:
  41963.      <P
  41964. ></P
  41965. ><UL
  41966. ><LI
  41967. ><P
  41968. >SORT_REGULAR - porovnßvat polo╛ky normßln∞</P
  41969. ></LI
  41970. ><LI
  41971. ><P
  41972. >SORT_NUMERIC - porovnßvat polo╛ky Φφseln∞</P
  41973. ></LI
  41974. ><LI
  41975. ><P
  41976. >SORT_STRING - porovnßvat polo╛ky jako °et∞zce</P
  41977. ></LI
  41978. ></UL
  41979. >
  41980.     </P
  41981. ><P
  41982. >      Po ka╛dΘm poli m∙╛ete specifikovat jeden p°φznak ka╛dΘho typu. P°φznaky
  41983.      t°φd∞nφ specifikovanΘ po ka╛dΘm poli platφ pouze pro toto pole - pro dal╣φ
  41984.      pole se resetujφ na defaultnφ SORT_ASC a SORT_REGULAR.
  41985.     </P
  41986. ><P
  41987. >      P°i ·sp∞chu vracφ <TT
  41988. CLASS="constant"
  41989. ><B
  41990. >TRUE</B
  41991. ></TT
  41992. >, p°i selhßnφ
  41993.      <TT
  41994. CLASS="constant"
  41995. ><B
  41996. >FALSE</B
  41997. ></TT
  41998. >.
  41999.     </P
  42000. ><P
  42001. >      <TABLE
  42002. WIDTH="100%"
  42003. BORDER="0"
  42004. CELLPADDING="0"
  42005. CELLSPACING="0"
  42006. CLASS="EXAMPLE"
  42007. ><TR
  42008. ><TD
  42009. ><DIV
  42010. CLASS="example"
  42011. ><A
  42012. NAME="AEN7722"
  42013. ></A
  42014. ><P
  42015. ><B
  42016. >P°φklad 1. T°φd∞nφ vφce polφ</B
  42017. ></P
  42018. ><TABLE
  42019. BORDER="0"
  42020. BGCOLOR="#E0E0E0"
  42021. CELLPADDING="5"
  42022. ><TR
  42023. ><TD
  42024. ><PRE
  42025. CLASS="php"
  42026. >$ar1 = array ("10", 100, 100, "a");
  42027. $ar2 = array (1, 3, "2", 1);
  42028. array_multisort ($ar1, $ar2);</PRE
  42029. ></TD
  42030. ></TR
  42031. ></TABLE
  42032. ></DIV
  42033. ></TD
  42034. ></TR
  42035. ></TABLE
  42036. >
  42037.     </P
  42038. ><P
  42039. >      V tΘto ukßzce bude po set°φd∞nφ prvnφ pole obsahovat 10, "a", 100, 100.
  42040.      DruhΘ pole bude obsahovat 1, 1, 2, "3". Polo╛ky druhΘho pole odpovφdajφcφ
  42041.      identick²m polo╛kßm v prvnφm poli (100 a 100) byly takΘ set°φd∞ny.
  42042.     </P
  42043. ><P
  42044. >      <TABLE
  42045. WIDTH="100%"
  42046. BORDER="0"
  42047. CELLPADDING="0"
  42048. CELLSPACING="0"
  42049. CLASS="EXAMPLE"
  42050. ><TR
  42051. ><TD
  42052. ><DIV
  42053. CLASS="example"
  42054. ><A
  42055. NAME="AEN7727"
  42056. ></A
  42057. ><P
  42058. ><B
  42059. >P°φklad 2. T°φd∞nφ vφcerozm∞rnΘho pole</B
  42060. ></P
  42061. ><TABLE
  42062. BORDER="0"
  42063. BGCOLOR="#E0E0E0"
  42064. CELLPADDING="5"
  42065. ><TR
  42066. ><TD
  42067. ><PRE
  42068. CLASS="php"
  42069. >$ar = array (array ("10", 100, 100, "a"), array (1, 3, "2", 1));
  42070. array_multisort ($ar[0], SORT_ASC, SORT_STRING,
  42071.                  $ar[1], SORT_NUMERIC, SORT_DESC);</PRE
  42072. ></TD
  42073. ></TR
  42074. ></TABLE
  42075. ></DIV
  42076. ></TD
  42077. ></TR
  42078. ></TABLE
  42079. >
  42080.     </P
  42081. ><P
  42082. >      V tΘto ukßzce bude po set°φd∞nφ prvnφ pole obsahovat 10, 100, 100, "a"
  42083.      (bylo t°φd∞no vzestupn∞ jako °et∞zce) a druhΘ pole bude obsahovat 1, 3,
  42084.      "2", 1 (t°φd∞no jako Φφsla, sestupn∞).
  42085.     </P
  42086. ></DIV
  42087. ><H1
  42088. ><A
  42089. NAME="function.array-pad"
  42090. ></A
  42091. >array_pad</H1
  42092. ><DIV
  42093. CLASS="refnamediv"
  42094. ><A
  42095. NAME="AEN7732"
  42096. ></A
  42097. ><P
  42098. >    (PHP 4 )</P
  42099. >array_pad -- Doplnit pole hodnotou na urΦenou dΘlku</DIV
  42100. ><DIV
  42101. CLASS="refsect1"
  42102. ><A
  42103. NAME="AEN7735"
  42104. ></A
  42105. ><H2
  42106. >Popis</H2
  42107. >array <B
  42108. CLASS="methodname"
  42109. >array_pad</B
  42110. > ( array input, int pad_size, mixed pad_value)<BR
  42111. ></BR
  42112. ><P
  42113. >      <B
  42114. CLASS="function"
  42115. >array_pad()</B
  42116. > vracφ kopii pole
  42117.      <TT
  42118. CLASS="parameter"
  42119. ><I
  42120. >input</I
  42121. ></TT
  42122. > dopln∞nou na velikost
  42123.      <TT
  42124. CLASS="parameter"
  42125. ><I
  42126. >pad_size</I
  42127. ></TT
  42128. > hodnotou
  42129.      <TT
  42130. CLASS="parameter"
  42131. ><I
  42132. >pad_value</I
  42133. ></TT
  42134. >. Pokud je
  42135.      <TT
  42136. CLASS="parameter"
  42137. ><I
  42138. >pad_size</I
  42139. ></TT
  42140. > kladnß, pole je dopln∞no zprava, pokud je
  42141.      negativnφ, zleva. Pokud je absolutnφ hodnota <TT
  42142. CLASS="parameter"
  42143. ><I
  42144. >pad_size</I
  42145. ></TT
  42146. >
  42147.      men╣φ nebo rovna velikosti <TT
  42148. CLASS="parameter"
  42149. ><I
  42150. >input</I
  42151. ></TT
  42152. >, k dopln∞nφ nedojde.
  42153.     </P
  42154. ><P
  42155. >      <TABLE
  42156. WIDTH="100%"
  42157. BORDER="0"
  42158. CELLPADDING="0"
  42159. CELLSPACING="0"
  42160. CLASS="EXAMPLE"
  42161. ><TR
  42162. ><TD
  42163. ><DIV
  42164. CLASS="example"
  42165. ><A
  42166. NAME="AEN7758"
  42167. ></A
  42168. ><P
  42169. ><B
  42170. >P°φklad 1. Ukßzka <B
  42171. CLASS="function"
  42172. >array_pad()</B
  42173. ></B
  42174. ></P
  42175. ><TABLE
  42176. BORDER="0"
  42177. BGCOLOR="#E0E0E0"
  42178. CELLPADDING="5"
  42179. ><TR
  42180. ><TD
  42181. ><PRE
  42182. CLASS="php"
  42183. >$input = array (12, 10, 9);
  42184.  
  42185. $result = array_pad ($input, 5, 0);
  42186. // v²sledek je array (12, 10, 9, 0, 0)
  42187.  
  42188. $result = array_pad ($input, -7, -1);
  42189. // v²sledek je array (-1, -1, -1, -1, 12, 10, 9)
  42190.  
  42191. $result = array_pad ($input, 2, "noop");
  42192. // nedopln∞no</PRE
  42193. ></TD
  42194. ></TR
  42195. ></TABLE
  42196. ></DIV
  42197. ></TD
  42198. ></TR
  42199. ></TABLE
  42200. >
  42201.     </P
  42202. ></DIV
  42203. ><H1
  42204. ><A
  42205. NAME="function.array-pop"
  42206. ></A
  42207. >array_pop</H1
  42208. ><DIV
  42209. CLASS="refnamediv"
  42210. ><A
  42211. NAME="AEN7763"
  42212. ></A
  42213. ><P
  42214. >    (PHP 4 )</P
  42215. >array_pop -- Odstranit prvek z konce pole</DIV
  42216. ><DIV
  42217. CLASS="refsect1"
  42218. ><A
  42219. NAME="AEN7766"
  42220. ></A
  42221. ><H2
  42222. >Popis</H2
  42223. >mixed <B
  42224. CLASS="methodname"
  42225. >array_pop</B
  42226. > ( array array)<BR
  42227. ></BR
  42228. ><P
  42229. >      <B
  42230. CLASS="function"
  42231. >array_pop()</B
  42232. > odstranφ a vrßtφ poslednφ hodnotu pole
  42233.      <TT
  42234. CLASS="parameter"
  42235. ><I
  42236. >array</I
  42237. ></TT
  42238. >, Φφm╛ ho zkrßtφ o jeden prvek.
  42239.     </P
  42240. ><P
  42241. >      <TABLE
  42242. WIDTH="100%"
  42243. BORDER="0"
  42244. CELLPADDING="0"
  42245. CELLSPACING="0"
  42246. CLASS="EXAMPLE"
  42247. ><TR
  42248. ><TD
  42249. ><DIV
  42250. CLASS="example"
  42251. ><A
  42252. NAME="AEN7778"
  42253. ></A
  42254. ><P
  42255. ><B
  42256. >P°φklad 1. Ukßzka <B
  42257. CLASS="function"
  42258. >array_pop()</B
  42259. ></B
  42260. ></P
  42261. ><TABLE
  42262. BORDER="0"
  42263. BGCOLOR="#E0E0E0"
  42264. CELLPADDING="5"
  42265. ><TR
  42266. ><TD
  42267. ><PRE
  42268. CLASS="php"
  42269. >$stack = array ("orange", "apple", "raspberry");
  42270. $fruit = array_pop ($stack);</PRE
  42271. ></TD
  42272. ></TR
  42273. ></TABLE
  42274. ></DIV
  42275. ></TD
  42276. ></TR
  42277. ></TABLE
  42278. >
  42279.     </P
  42280. ><P
  42281. >      <TT
  42282. CLASS="varname"
  42283. >$stack</TT
  42284. > mß te∩ pouze dva prvky:
  42285.      "orange" a "apple", a <TT
  42286. CLASS="varname"
  42287. >$fruit</TT
  42288. > obsahuje "raspberry".
  42289.     </P
  42290. ><P
  42291. >      Viz takΘ: <A
  42292. HREF="#function.array-push"
  42293. ><B
  42294. CLASS="function"
  42295. >array_push()</B
  42296. ></A
  42297. >,
  42298.      <A
  42299. HREF="#function.array-shift"
  42300. ><B
  42301. CLASS="function"
  42302. >array_shift()</B
  42303. ></A
  42304. > a
  42305.      <A
  42306. HREF="#function.array-unshift"
  42307. ><B
  42308. CLASS="function"
  42309. >array_unshift()</B
  42310. ></A
  42311. >.
  42312.     </P
  42313. ></DIV
  42314. ><H1
  42315. ><A
  42316. NAME="function.array-push"
  42317. ></A
  42318. >array_push</H1
  42319. ><DIV
  42320. CLASS="refnamediv"
  42321. ><A
  42322. NAME="AEN7790"
  42323. ></A
  42324. ><P
  42325. >    (PHP 4 )</P
  42326. >array_push -- P°idat jeden nebo vφce prvk∙ na konec pole</DIV
  42327. ><DIV
  42328. CLASS="refsect1"
  42329. ><A
  42330. NAME="AEN7793"
  42331. ></A
  42332. ><H2
  42333. >Popis</H2
  42334. >int <B
  42335. CLASS="methodname"
  42336. >array_push</B
  42337. > ( array array, mixed var [, mixed ...])<BR
  42338. ></BR
  42339. ><P
  42340. >      <B
  42341. CLASS="function"
  42342. >array_push()</B
  42343. > p°ipojuje p°edanΘ prom∞nnΘ na konec
  42344.      <TT
  42345. CLASS="parameter"
  42346. ><I
  42347. >array</I
  42348. ></TT
  42349. >. DΘlka <TT
  42350. CLASS="parameter"
  42351. ><I
  42352. >array</I
  42353. ></TT
  42354. > se zv∞t╣uje
  42355.      o poΦet p°idan²ch prom∞nn²ch. ┌Φinek je stejn² jako:
  42356.      <TABLE
  42357. BORDER="0"
  42358. BGCOLOR="#E0E0E0"
  42359. CELLPADDING="5"
  42360. ><TR
  42361. ><TD
  42362. ><PRE
  42363. CLASS="php"
  42364. >$array[] = $var;</PRE
  42365. ></TD
  42366. ></TR
  42367. ></TABLE
  42368. >
  42369.      opakovanΘ pro ka╛dou <TT
  42370. CLASS="parameter"
  42371. ><I
  42372. >var</I
  42373. ></TT
  42374. >.
  42375.     </P
  42376. ><P
  42377. >      Vracφ nov² poΦet prvk∙ v poli.
  42378.     </P
  42379. ><P
  42380. >      <TABLE
  42381. WIDTH="100%"
  42382. BORDER="0"
  42383. CELLPADDING="0"
  42384. CELLSPACING="0"
  42385. CLASS="EXAMPLE"
  42386. ><TR
  42387. ><TD
  42388. ><DIV
  42389. CLASS="example"
  42390. ><A
  42391. NAME="AEN7815"
  42392. ></A
  42393. ><P
  42394. ><B
  42395. >P°φklad 1. Ukßzka <B
  42396. CLASS="function"
  42397. >array_push()</B
  42398. ></B
  42399. ></P
  42400. ><TABLE
  42401. BORDER="0"
  42402. BGCOLOR="#E0E0E0"
  42403. CELLPADDING="5"
  42404. ><TR
  42405. ><TD
  42406. ><PRE
  42407. CLASS="php"
  42408. >$stack = array (1, 2);
  42409. array_push ($stack, "+", 3);</PRE
  42410. ></TD
  42411. ></TR
  42412. ></TABLE
  42413. ></DIV
  42414. ></TD
  42415. ></TR
  42416. ></TABLE
  42417. >
  42418.     </P
  42419. ><P
  42420. >      V²sledkem tΘto ukßzky by byl <TT
  42421. CLASS="varname"
  42422. >$stack</TT
  42423. > obsahujφcφ 4
  42424.      prvky: 1, 2, "+" a 3.
  42425.     </P
  42426. ><P
  42427. >      Viz takΘ: <A
  42428. HREF="#function.array-pop"
  42429. ><B
  42430. CLASS="function"
  42431. >array_pop()</B
  42432. ></A
  42433. >,
  42434.      <A
  42435. HREF="#function.array-shift"
  42436. ><B
  42437. CLASS="function"
  42438. >array_shift()</B
  42439. ></A
  42440. > a
  42441.      <A
  42442. HREF="#function.array-unshift"
  42443. ><B
  42444. CLASS="function"
  42445. >array_unshift()</B
  42446. ></A
  42447. >.
  42448.     </P
  42449. ></DIV
  42450. ><H1
  42451. ><A
  42452. NAME="function.array-rand"
  42453. ></A
  42454. >array_rand</H1
  42455. ><DIV
  42456. CLASS="refnamediv"
  42457. ><A
  42458. NAME="AEN7826"
  42459. ></A
  42460. ><P
  42461. >    (PHP 4 )</P
  42462. >array_rand -- Vybrat nßhodn∞ jeden nebo vφce prvk∙ pole</DIV
  42463. ><DIV
  42464. CLASS="refsect1"
  42465. ><A
  42466. NAME="AEN7829"
  42467. ></A
  42468. ><H2
  42469. >Popis</H2
  42470. >mixed <B
  42471. CLASS="methodname"
  42472. >array_rand</B
  42473. > ( array input [, int num_req])<BR
  42474. ></BR
  42475. ><P
  42476. >      <B
  42477. CLASS="function"
  42478. >array_rand()</B
  42479. > je pom∞rn∞ u╛iteΦnß, kdy╛ chcete z pole
  42480.      vybrat nßhodn∞ jednu nebo vφce hodnot. P°ijφmß pole
  42481.      <TT
  42482. CLASS="parameter"
  42483. ><I
  42484. >input</I
  42485. ></TT
  42486. > a voliteln² argument
  42487.      <TT
  42488. CLASS="parameter"
  42489. ><I
  42490. >num_req</I
  42491. ></TT
  42492. >, kter² urΦuje, kolik polo╛ek chcete. Jeho
  42493.      defaultnφ hodnota je 1.
  42494.     </P
  42495. ><P
  42496. >      Pokud vybφrßte pouze jednu polo╛ku, <B
  42497. CLASS="function"
  42498. >array_rand()</B
  42499. >
  42500.      vracφ klφΦ nßhodnΘ polo╛ky. Jinak vracφ pole klφΦ∙ nßhodn∞ vybran²ch polo╛ek.
  42501.      Takto m∙╛ete vybφrat nßhodn∞ hodnoty i klφΦe.
  42502.     </P
  42503. ><P
  42504. >      Nezapome≥te inicializovat generßtor nßhodn²ch Φφsel pomocφ
  42505.      <A
  42506. HREF="#function.srand"
  42507. ><B
  42508. CLASS="function"
  42509. >srand()</B
  42510. ></A
  42511. >.
  42512.     </P
  42513. ><P
  42514. >      <TABLE
  42515. WIDTH="100%"
  42516. BORDER="0"
  42517. CELLPADDING="0"
  42518. CELLSPACING="0"
  42519. CLASS="EXAMPLE"
  42520. ><TR
  42521. ><TD
  42522. ><DIV
  42523. CLASS="example"
  42524. ><A
  42525. NAME="AEN7849"
  42526. ></A
  42527. ><P
  42528. ><B
  42529. >P°φklad 1. Ukßzka <B
  42530. CLASS="function"
  42531. >array_rand()</B
  42532. ></B
  42533. ></P
  42534. ><TABLE
  42535. BORDER="0"
  42536. BGCOLOR="#E0E0E0"
  42537. CELLPADDING="5"
  42538. ><TR
  42539. ><TD
  42540. ><PRE
  42541. CLASS="php"
  42542. >srand ((double) microtime() * 10000000);
  42543. $input = array ("Neo", "Morpheus", "Trinity", "Cypher", "Tank");
  42544. $rand_keys = array_rand ($input, 2);
  42545. print $input[$rand_keys[0]]."\n";
  42546. print $input[$rand_keys[1]]."\n";</PRE
  42547. ></TD
  42548. ></TR
  42549. ></TABLE
  42550. ></DIV
  42551. ></TD
  42552. ></TR
  42553. ></TABLE
  42554. >
  42555.     </P
  42556. ></DIV
  42557. ><H1
  42558. ><A
  42559. NAME="function.array-reduce"
  42560. ></A
  42561. >array_reduce</H1
  42562. ><DIV
  42563. CLASS="refnamediv"
  42564. ><A
  42565. NAME="AEN7854"
  42566. ></A
  42567. ><P
  42568. >    (PHP 4 >= 4.0.5)</P
  42569. >array_reduce -- 
  42570.      Iteratively reduce the array to a single value using a callback
  42571.      function
  42572.     </DIV
  42573. ><DIV
  42574. CLASS="refsect1"
  42575. ><A
  42576. NAME="AEN7857"
  42577. ></A
  42578. ><H2
  42579. >Description</H2
  42580. >mixed <B
  42581. CLASS="methodname"
  42582. >array_reduce</B
  42583. > ( array input, callback function [, int initial])<BR
  42584. ></BR
  42585. ><P
  42586. >      <B
  42587. CLASS="function"
  42588. >array_reduce()</B
  42589. > applies iteratively the
  42590.      <TT
  42591. CLASS="parameter"
  42592. ><I
  42593. >function</I
  42594. ></TT
  42595. > function to the elements of the
  42596.      array <TT
  42597. CLASS="parameter"
  42598. ><I
  42599. >input</I
  42600. ></TT
  42601. >, so as to reduce the array to
  42602.      a single value. If the optional <TT
  42603. CLASS="parameter"
  42604. ><I
  42605. >initial</I
  42606. ></TT
  42607. > is
  42608.      available, it will be used at the beginning of the process, or as
  42609.      a final result in case the array is empty.
  42610.     </P
  42611. ><P
  42612. >      <TABLE
  42613. WIDTH="100%"
  42614. BORDER="0"
  42615. CELLPADDING="0"
  42616. CELLSPACING="0"
  42617. CLASS="EXAMPLE"
  42618. ><TR
  42619. ><TD
  42620. ><DIV
  42621. CLASS="example"
  42622. ><A
  42623. NAME="AEN7877"
  42624. ></A
  42625. ><P
  42626. ><B
  42627. >P°φklad 1. <B
  42628. CLASS="function"
  42629. >array_reduce()</B
  42630. > example</B
  42631. ></P
  42632. ><TABLE
  42633. BORDER="0"
  42634. BGCOLOR="#E0E0E0"
  42635. CELLPADDING="5"
  42636. ><TR
  42637. ><TD
  42638. ><PRE
  42639. CLASS="php"
  42640. ><?php
  42641. function rsum($v, $w) {
  42642.     $v += $w;
  42643.     return $v;
  42644. }
  42645.  
  42646. function rmul($v, $w) {
  42647.     $v *= $w;
  42648.     return $v;
  42649. }
  42650.  
  42651. $a = array(1, 2, 3, 4, 5);
  42652. $x = array();
  42653. $b = array_reduce($a, "rsum");
  42654. $c = array_reduce($a, "rmul", 10);
  42655. $d = array_reduce($x, "rsum", 1);
  42656. ?></PRE
  42657. ></TD
  42658. ></TR
  42659. ></TABLE
  42660. ></DIV
  42661. ></TD
  42662. ></TR
  42663. ></TABLE
  42664. >
  42665.     </P
  42666. ><P
  42667. >      This will result in <TT
  42668. CLASS="varname"
  42669. >$b</TT
  42670. > containing
  42671.      <TT
  42672. CLASS="literal"
  42673. >15</TT
  42674. >, <TT
  42675. CLASS="varname"
  42676. >$c</TT
  42677. > containing
  42678.      <TT
  42679. CLASS="literal"
  42680. >1200</TT
  42681. > (= 1*2*3*4*5*10), and
  42682.      <TT
  42683. CLASS="varname"
  42684. >$d</TT
  42685. > containing <TT
  42686. CLASS="literal"
  42687. >1</TT
  42688. >.
  42689.     </P
  42690. ><P
  42691. >      See also <A
  42692. HREF="#function.array-filter"
  42693. ><B
  42694. CLASS="function"
  42695. >array_filter()</B
  42696. ></A
  42697. >,
  42698.      <A
  42699. HREF="#function.array-map"
  42700. ><B
  42701. CLASS="function"
  42702. >array_map()</B
  42703. ></A
  42704. >,
  42705.      <A
  42706. HREF="#function.array-unique"
  42707. ><B
  42708. CLASS="function"
  42709. >array_unique()</B
  42710. ></A
  42711. >, and
  42712.      <A
  42713. HREF="#function.array-count-values"
  42714. ><B
  42715. CLASS="function"
  42716. >array_count_values()</B
  42717. ></A
  42718. >.
  42719.     </P
  42720. ></DIV
  42721. ><H1
  42722. ><A
  42723. NAME="function.array-reverse"
  42724. ></A
  42725. >array_reverse</H1
  42726. ><DIV
  42727. CLASS="refnamediv"
  42728. ><A
  42729. NAME="AEN7894"
  42730. ></A
  42731. ><P
  42732. >    (PHP 4 )</P
  42733. >array_reverse -- Vrßtit pole s prvky v opaΦnΘm po°adφ</DIV
  42734. ><DIV
  42735. CLASS="refsect1"
  42736. ><A
  42737. NAME="AEN7897"
  42738. ></A
  42739. ><H2
  42740. >Popis</H2
  42741. >array <B
  42742. CLASS="methodname"
  42743. >array_reverse</B
  42744. > ( array array [, bool preserve_keys])<BR
  42745. ></BR
  42746. ><P
  42747. >      <B
  42748. CLASS="function"
  42749. >array_reverse()</B
  42750. > takes input
  42751.      <TT
  42752. CLASS="parameter"
  42753. ><I
  42754. >array</I
  42755. ></TT
  42756. > and returns a new array with the
  42757.      order of the elements reversed, preserving the keys if
  42758.      <TT
  42759. CLASS="parameter"
  42760. ><I
  42761. >preserve_keys</I
  42762. ></TT
  42763. > is <TT
  42764. CLASS="constant"
  42765. ><B
  42766. >TRUE</B
  42767. ></TT
  42768. >.
  42769.     </P
  42770. ><P
  42771. >      <TABLE
  42772. WIDTH="100%"
  42773. BORDER="0"
  42774. CELLPADDING="0"
  42775. CELLSPACING="0"
  42776. CLASS="EXAMPLE"
  42777. ><TR
  42778. ><TD
  42779. ><DIV
  42780. CLASS="example"
  42781. ><A
  42782. NAME="AEN7914"
  42783. ></A
  42784. ><P
  42785. ><B
  42786. >P°φklad 1. <B
  42787. CLASS="function"
  42788. >array_reverse()</B
  42789. > example</B
  42790. ></P
  42791. ><TABLE
  42792. BORDER="0"
  42793. BGCOLOR="#E0E0E0"
  42794. CELLPADDING="5"
  42795. ><TR
  42796. ><TD
  42797. ><PRE
  42798. CLASS="php"
  42799. >$input = array ("php", 4.0, array ("green", "red"));
  42800. $result = array_reverse ($input);
  42801. $result_keyed = array_reverse ($input, true);</PRE
  42802. ></TD
  42803. ></TR
  42804. ></TABLE
  42805. ></DIV
  42806. ></TD
  42807. ></TR
  42808. ></TABLE
  42809. >
  42810.     </P
  42811. ><P
  42812. >      <TT
  42813. CLASS="varname"
  42814. >$result</TT
  42815. > te∩ obsahuje <TT
  42816. CLASS="literal"
  42817. >array (array ("green",
  42818.      "red"), 4.0, "php")</TT
  42819. >. Ale <TT
  42820. CLASS="varname"
  42821. >$result2[0]</TT
  42822. > je stßle
  42823.      <TT
  42824. CLASS="literal"
  42825. >"php"</TT
  42826. >.
  42827.     </P
  42828. ><DIV
  42829. CLASS="note"
  42830. ><BLOCKQUOTE
  42831. CLASS="note"
  42832. ><P
  42833. ><B
  42834. >Poznßmka: </B
  42835. >
  42836.       Druh² argument byl p°idßn v PHP 4.0.3.
  42837.      </P
  42838. ></BLOCKQUOTE
  42839. ></DIV
  42840. ></DIV
  42841. ><H1
  42842. ><A
  42843. NAME="function.array-search"
  42844. ></A
  42845. >array_search</H1
  42846. ><DIV
  42847. CLASS="refnamediv"
  42848. ><A
  42849. NAME="AEN7926"
  42850. ></A
  42851. ><P
  42852. >    (PHP 4 >= 4.0.5)</P
  42853. >array_search -- 
  42854.      Searches the array for a given value and returns the
  42855.      corresponding key if successful
  42856.     </DIV
  42857. ><DIV
  42858. CLASS="refsect1"
  42859. ><A
  42860. NAME="AEN7929"
  42861. ></A
  42862. ><H2
  42863. >Description</H2
  42864. >mixed <B
  42865. CLASS="methodname"
  42866. >array_search</B
  42867. > ( mixed needle, array haystack [, bool strict])<BR
  42868. ></BR
  42869. ><P
  42870. >      Searches <TT
  42871. CLASS="parameter"
  42872. ><I
  42873. >haystack</I
  42874. ></TT
  42875. > for
  42876.      <TT
  42877. CLASS="parameter"
  42878. ><I
  42879. >needle</I
  42880. ></TT
  42881. > and returns the key if it is found in
  42882.      the array, <TT
  42883. CLASS="constant"
  42884. ><B
  42885. >FALSE</B
  42886. ></TT
  42887. > otherwise.
  42888.     </P
  42889. ><DIV
  42890. CLASS="note"
  42891. ><BLOCKQUOTE
  42892. CLASS="note"
  42893. ><P
  42894. ><B
  42895. >Poznßmka: </B
  42896. >
  42897.       If <TT
  42898. CLASS="parameter"
  42899. ><I
  42900. >needle</I
  42901. ></TT
  42902. > is a string, the comparison is done
  42903.       in a case-sensitive manner.
  42904.      </P
  42905. ></BLOCKQUOTE
  42906. ></DIV
  42907. ><DIV
  42908. CLASS="note"
  42909. ><BLOCKQUOTE
  42910. CLASS="note"
  42911. ><P
  42912. ><B
  42913. >Poznßmka: </B
  42914. >
  42915.       Prior to PHP 4.2.0, <B
  42916. CLASS="function"
  42917. >array_search()</B
  42918. > returns
  42919.       <TT
  42920. CLASS="constant"
  42921. ><B
  42922. >NULL</B
  42923. ></TT
  42924. > on failure instead of <TT
  42925. CLASS="constant"
  42926. ><B
  42927. >FALSE</B
  42928. ></TT
  42929. >.
  42930.      </P
  42931. ></BLOCKQUOTE
  42932. ></DIV
  42933. ><P
  42934. >      If the optional third parameter <TT
  42935. CLASS="parameter"
  42936. ><I
  42937. >strict</I
  42938. ></TT
  42939. > is set to
  42940.      <TT
  42941. CLASS="constant"
  42942. ><B
  42943. >TRUE</B
  42944. ></TT
  42945. > then the <B
  42946. CLASS="function"
  42947. >array_search()</B
  42948. >
  42949.      will also check the types of the <TT
  42950. CLASS="parameter"
  42951. ><I
  42952. >needle</I
  42953. ></TT
  42954. >
  42955.      in the <TT
  42956. CLASS="parameter"
  42957. ><I
  42958. >haystack</I
  42959. ></TT
  42960. >.
  42961.     </P
  42962. ><P
  42963. >      If <TT
  42964. CLASS="parameter"
  42965. ><I
  42966. >needle</I
  42967. ></TT
  42968. > is found in
  42969.      <TT
  42970. CLASS="parameter"
  42971. ><I
  42972. >haystack</I
  42973. ></TT
  42974. > more than once, the first matching key
  42975.      is returned. To return the keys for all matching values, use
  42976.      <A
  42977. HREF="#function.array-keys"
  42978. ><B
  42979. CLASS="function"
  42980. >array_keys()</B
  42981. ></A
  42982. > with the optional
  42983.      <TT
  42984. CLASS="parameter"
  42985. ><I
  42986. >search_value</I
  42987. ></TT
  42988. > parameter instead.
  42989.     </P
  42990. ><P
  42991. >      <TABLE
  42992. WIDTH="100%"
  42993. BORDER="0"
  42994. CELLPADDING="0"
  42995. CELLSPACING="0"
  42996. CLASS="EXAMPLE"
  42997. ><TR
  42998. ><TD
  42999. ><DIV
  43000. CLASS="example"
  43001. ><A
  43002. NAME="AEN7967"
  43003. ></A
  43004. ><P
  43005. ><B
  43006. >P°φklad 1. <B
  43007. CLASS="function"
  43008. >array_search()</B
  43009. > example</B
  43010. ></P
  43011. ><TABLE
  43012. BORDER="0"
  43013. BGCOLOR="#E0E0E0"
  43014. CELLPADDING="5"
  43015. ><TR
  43016. ><TD
  43017. ><PRE
  43018. CLASS="php"
  43019. ><?php
  43020. $array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');
  43021.  
  43022. $key = array_search('green', $array); // $key = 2;
  43023. $key = array_search('red', $array);   // $key = 1;
  43024. ?></PRE
  43025. ></TD
  43026. ></TR
  43027. ></TABLE
  43028. ></DIV
  43029. ></TD
  43030. ></TR
  43031. ></TABLE
  43032. >
  43033.     </P
  43034. ><DIV
  43035. CLASS="warning"
  43036. ><P
  43037. ></P
  43038. ><TABLE
  43039. CLASS="warning"
  43040. BORDER="1"
  43041. WIDTH="100%"
  43042. ><TR
  43043. ><TD
  43044. ALIGN="CENTER"
  43045. ><B
  43046. >Varovßnφ</B
  43047. ></TD
  43048. ></TR
  43049. ><TR
  43050. ><TD
  43051. ALIGN="LEFT"
  43052. ><P
  43053. >Tato funkce m∙╛e vracet
  43054. booleovskou hodnotu <TT
  43055. CLASS="constant"
  43056. ><B
  43057. >FALSE</B
  43058. ></TT
  43059. >, ale takΘ nebooleovskou hodnotu odpovφdajφcφ
  43060. ohodnocenφ <TT
  43061. CLASS="constant"
  43062. ><B
  43063. >FALSE</B
  43064. ></TT
  43065. >, nap°φklad <TT
  43066. CLASS="literal"
  43067. >0</TT
  43068. > nebo "". ╚t∞te
  43069. prosφm sekci o typu <A
  43070. HREF="#language.types.boolean"
  43071. >Boolean</A
  43072. >, kde
  43073. najdete vφce informacφ. Pro testovßnφ nßvratovΘ hodnoty tΘto funkce pou╛ijte
  43074. <A
  43075. HREF="#language.operators.comparison"
  43076. >operßtor
  43077. ===</A
  43078. >.</P
  43079. ></TD
  43080. ></TR
  43081. ></TABLE
  43082. ></DIV
  43083. ><P
  43084. >      See also <A
  43085. HREF="#function.array-keys"
  43086. ><B
  43087. CLASS="function"
  43088. >array_keys()</B
  43089. ></A
  43090. >,
  43091.      <A
  43092. HREF="#function.array-values"
  43093. ><B
  43094. CLASS="function"
  43095. >array_values()</B
  43096. ></A
  43097. >,
  43098.      <A
  43099. HREF="#function.array-key-exists"
  43100. ><B
  43101. CLASS="function"
  43102. >array_key_exists()</B
  43103. ></A
  43104. >, and
  43105.      <A
  43106. HREF="#function.in-array"
  43107. ><B
  43108. CLASS="function"
  43109. >in_array()</B
  43110. ></A
  43111. >.
  43112.     </P
  43113. ></DIV
  43114. ><H1
  43115. ><A
  43116. NAME="function.array-shift"
  43117. ></A
  43118. >array_shift</H1
  43119. ><DIV
  43120. CLASS="refnamediv"
  43121. ><A
  43122. NAME="AEN7984"
  43123. ></A
  43124. ><P
  43125. >    (PHP 4 )</P
  43126. >array_shift -- Odstranit prvek ze zaΦßtku pole</DIV
  43127. ><DIV
  43128. CLASS="refsect1"
  43129. ><A
  43130. NAME="AEN7987"
  43131. ></A
  43132. ><H2
  43133. >Popis</H2
  43134. >mixed <B
  43135. CLASS="methodname"
  43136. >array_shift</B
  43137. > ( array array)<BR
  43138. ></BR
  43139. ><P
  43140. >      <B
  43141. CLASS="function"
  43142. >array_shift()</B
  43143. > vracφ prvnφ polo╛ku
  43144.      <TT
  43145. CLASS="parameter"
  43146. ><I
  43147. >array</I
  43148. ></TT
  43149. > a odstranφ ji, Φφm╛ zkrßtφ
  43150.      <TT
  43151. CLASS="parameter"
  43152. ><I
  43153. >array</I
  43154. ></TT
  43155. > o jeden prvek a ostatnφ posune dol∙.
  43156.     </P
  43157. ><P
  43158. >      <TABLE
  43159. WIDTH="100%"
  43160. BORDER="0"
  43161. CELLPADDING="0"
  43162. CELLSPACING="0"
  43163. CLASS="EXAMPLE"
  43164. ><TR
  43165. ><TD
  43166. ><DIV
  43167. CLASS="example"
  43168. ><A
  43169. NAME="AEN8000"
  43170. ></A
  43171. ><P
  43172. ><B
  43173. >P°φklad 1. Ukßzka <B
  43174. CLASS="function"
  43175. >array_shift()</B
  43176. ></B
  43177. ></P
  43178. ><TABLE
  43179. BORDER="0"
  43180. BGCOLOR="#E0E0E0"
  43181. CELLPADDING="5"
  43182. ><TR
  43183. ><TD
  43184. ><PRE
  43185. CLASS="php"
  43186. >$args = array ("-v", "-f");
  43187. $opt = array_shift ($args);</PRE
  43188. ></TD
  43189. ></TR
  43190. ></TABLE
  43191. ></DIV
  43192. ></TD
  43193. ></TR
  43194. ></TABLE
  43195. >
  43196.     </P
  43197. ><P
  43198. >      <TT
  43199. CLASS="varname"
  43200. >$args</TT
  43201. > te∩ mß jeden prvek: "-f" a <TT
  43202. CLASS="varname"
  43203. >$opt</TT
  43204. >
  43205.      je "-v".
  43206.     </P
  43207. ><P
  43208. >      Viz takΘ: <A
  43209. HREF="#function.array-unshift"
  43210. ><B
  43211. CLASS="function"
  43212. >array_unshift()</B
  43213. ></A
  43214. >,
  43215.      <A
  43216. HREF="#function.array-push"
  43217. ><B
  43218. CLASS="function"
  43219. >array_push()</B
  43220. ></A
  43221. > a
  43222.      <A
  43223. HREF="#function.array-pop"
  43224. ><B
  43225. CLASS="function"
  43226. >array_pop()</B
  43227. ></A
  43228. >.
  43229.     </P
  43230. ></DIV
  43231. ><H1
  43232. ><A
  43233. NAME="function.array-slice"
  43234. ></A
  43235. >array_slice</H1
  43236. ><DIV
  43237. CLASS="refnamediv"
  43238. ><A
  43239. NAME="AEN8012"
  43240. ></A
  43241. ><P
  43242. >    (PHP 4 )</P
  43243. >array_slice -- Vytßhnout Φßst pole</DIV
  43244. ><DIV
  43245. CLASS="refsect1"
  43246. ><A
  43247. NAME="AEN8015"
  43248. ></A
  43249. ><H2
  43250. >Popis</H2
  43251. >array <B
  43252. CLASS="methodname"
  43253. >array_slice</B
  43254. > ( array array, int offset [, int length])<BR
  43255. ></BR
  43256. ><P
  43257. >      <B
  43258. CLASS="function"
  43259. >array_slice()</B
  43260. > vracφ sekvenci prvk∙
  43261.      <TT
  43262. CLASS="parameter"
  43263. ><I
  43264. >array</I
  43265. ></TT
  43266. > urΦen²ch argumenty
  43267.      <TT
  43268. CLASS="parameter"
  43269. ><I
  43270. >offset</I
  43271. ></TT
  43272. > a <TT
  43273. CLASS="parameter"
  43274. ><I
  43275. >length</I
  43276. ></TT
  43277. >.
  43278.     </P
  43279. ><P
  43280. >      Pokud je <TT
  43281. CLASS="parameter"
  43282. ><I
  43283. >offset</I
  43284. ></TT
  43285. > kladn², tato sekvence zaΦne
  43286.      <TT
  43287. CLASS="parameter"
  43288. ><I
  43289. >offset</I
  43290. ></TT
  43291. > polo╛ek od zaΦßtku
  43292.      <TT
  43293. CLASS="parameter"
  43294. ><I
  43295. >array</I
  43296. ></TT
  43297. >.  Pokud je <TT
  43298. CLASS="parameter"
  43299. ><I
  43300. >offset</I
  43301. ></TT
  43302. >
  43303.      zßporn², tato sekvence zaΦne tolik polo╛ek od konce
  43304.      <TT
  43305. CLASS="parameter"
  43306. ><I
  43307. >array</I
  43308. ></TT
  43309. >.
  43310.     </P
  43311. ><P
  43312. >      Pokud je <TT
  43313. CLASS="parameter"
  43314. ><I
  43315. >length</I
  43316. ></TT
  43317. > kladnß, tato sekvence bude obsahovat
  43318.      tolik prvk∙. Pokud je <TT
  43319. CLASS="parameter"
  43320. ><I
  43321. >length</I
  43322. ></TT
  43323. > zßpornß, tato sekvence
  43324.      skonΦφ tolik prvk∙ od konce <TT
  43325. CLASS="parameter"
  43326. ><I
  43327. >array</I
  43328. ></TT
  43329. >. Pokud
  43330.      <TT
  43331. CLASS="parameter"
  43332. ><I
  43333. >length</I
  43334. ></TT
  43335. > vynechßte, tato sekvence bude obsahovat
  43336.      v╣echny prvky <TT
  43337. CLASS="parameter"
  43338. ><I
  43339. >array</I
  43340. ></TT
  43341. > od <TT
  43342. CLASS="parameter"
  43343. ><I
  43344. >offset</I
  43345. ></TT
  43346. >
  43347.      do konce.
  43348.     </P
  43349. ><P
  43350. >      <TABLE
  43351. WIDTH="100%"
  43352. BORDER="0"
  43353. CELLPADDING="0"
  43354. CELLSPACING="0"
  43355. CLASS="EXAMPLE"
  43356. ><TR
  43357. ><TD
  43358. ><DIV
  43359. CLASS="example"
  43360. ><A
  43361. NAME="AEN8048"
  43362. ></A
  43363. ><P
  43364. ><B
  43365. >P°φklad 1. Ukßzka <B
  43366. CLASS="function"
  43367. >array_slice()</B
  43368. ></B
  43369. ></P
  43370. ><TABLE
  43371. BORDER="0"
  43372. BGCOLOR="#E0E0E0"
  43373. CELLPADDING="5"
  43374. ><TR
  43375. ><TD
  43376. ><PRE
  43377. CLASS="php"
  43378. >$input = array ("a", "b", "c", "d", "e");
  43379.  
  43380. $output = array_slice ($input, 2);      // returns "c", "d", and "e"
  43381. $output = array_slice ($input, 2, -1);  // returns "c", "d"
  43382. $output = array_slice ($input, -2, 1);  // returns "d"
  43383. $output = array_slice ($input, 0, 3);   // returns "a", "b", and "c"</PRE
  43384. ></TD
  43385. ></TR
  43386. ></TABLE
  43387. ></DIV
  43388. ></TD
  43389. ></TR
  43390. ></TABLE
  43391. >
  43392.     </P
  43393. ><P
  43394. >      Viz takΘ: <A
  43395. HREF="#function.array-splice"
  43396. ><B
  43397. CLASS="function"
  43398. >array_splice()</B
  43399. ></A
  43400. >.
  43401.     </P
  43402. ></DIV
  43403. ><H1
  43404. ><A
  43405. NAME="function.array-splice"
  43406. ></A
  43407. >array_splice</H1
  43408. ><DIV
  43409. CLASS="refnamediv"
  43410. ><A
  43411. NAME="AEN8055"
  43412. ></A
  43413. ><P
  43414. >    (PHP 4 )</P
  43415. >array_splice -- Odstranit Φßst pole a nahradit ji n∞Φφm jin²m</DIV
  43416. ><DIV
  43417. CLASS="refsect1"
  43418. ><A
  43419. NAME="AEN8058"
  43420. ></A
  43421. ><H2
  43422. >Popis</H2
  43423. >array <B
  43424. CLASS="methodname"
  43425. >array_splice</B
  43426. > ( array input, int offset [, int length [, array replacement]])<BR
  43427. ></BR
  43428. ><P
  43429. >      <B
  43430. CLASS="function"
  43431. >array_splice()</B
  43432. > odstra≥uje prvky pole
  43433.      <TT
  43434. CLASS="parameter"
  43435. ><I
  43436. >input</I
  43437. ></TT
  43438. > urΦenΘ argumenty <TT
  43439. CLASS="parameter"
  43440. ><I
  43441. >offset</I
  43442. ></TT
  43443. >
  43444.      a <TT
  43445. CLASS="parameter"
  43446. ><I
  43447. >length</I
  43448. ></TT
  43449. >, a p°φpadn∞ je nahrazuje prvky volitelnΘho
  43450.      argumentu (pole) <TT
  43451. CLASS="parameter"
  43452. ><I
  43453. >replacement</I
  43454. ></TT
  43455. >.
  43456.     </P
  43457. ><P
  43458. >      Pokud je <TT
  43459. CLASS="parameter"
  43460. ><I
  43461. >offset</I
  43462. ></TT
  43463. > kladn², tato odstran∞nß Φßst zaΦne
  43464.      <TT
  43465. CLASS="parameter"
  43466. ><I
  43467. >offset</I
  43468. ></TT
  43469. > polo╛ek od zaΦßtku
  43470.      <TT
  43471. CLASS="parameter"
  43472. ><I
  43473. >array</I
  43474. ></TT
  43475. >.  Pokud je <TT
  43476. CLASS="parameter"
  43477. ><I
  43478. >offset</I
  43479. ></TT
  43480. >
  43481.      zßporn², zaΦne tolik polo╛ek od konce <TT
  43482. CLASS="parameter"
  43483. ><I
  43484. >array</I
  43485. ></TT
  43486. >.
  43487.     </P
  43488. ><P
  43489. >      Pokud vynechßte <TT
  43490. CLASS="parameter"
  43491. ><I
  43492. >length</I
  43493. ></TT
  43494. >,
  43495.      <B
  43496. CLASS="function"
  43497. >array_splice()</B
  43498. > odstranφ v╣echno od
  43499.      <TT
  43500. CLASS="parameter"
  43501. ><I
  43502. >offset</I
  43503. ></TT
  43504. > do konce pole. Pokud je
  43505.      <TT
  43506. CLASS="parameter"
  43507. ><I
  43508. >length</I
  43509. ></TT
  43510. > kladnß, odstranφ se prßv∞ tolik prvk∙. Pokud
  43511.      je <TT
  43512. CLASS="parameter"
  43513. ><I
  43514. >length</I
  43515. ></TT
  43516. > zßpornß, konec odstran∞nΘ Φßsti bude
  43517.      prßv∞ tolik prvk∙ od konce pole. Tip: k odstran∞nφ v╣ech prvk∙ od
  43518.      <TT
  43519. CLASS="parameter"
  43520. ><I
  43521. >offset</I
  43522. ></TT
  43523. > do konce pole p°i souΦasn∞ urΦenΘm argumentu
  43524.      <TT
  43525. CLASS="parameter"
  43526. ><I
  43527. >replacement</I
  43528. ></TT
  43529. > pou╛ijte jako
  43530.      <TT
  43531. CLASS="parameter"
  43532. ><I
  43533. >length</I
  43534. ></TT
  43535. > <TT
  43536. CLASS="literal"
  43537. >count($input)</TT
  43538. >.
  43539.     </P
  43540. ><P
  43541. >      Pokud zadßte <TT
  43542. CLASS="parameter"
  43543. ><I
  43544. >replacement</I
  43545. ></TT
  43546. > pole, odstran∞nΘ prvky se
  43547.      nahradφ prvky tohoto pole. Pokud argumenty <TT
  43548. CLASS="parameter"
  43549. ><I
  43550. >offset</I
  43551. ></TT
  43552. > a
  43553.      <TT
  43554. CLASS="parameter"
  43555. ><I
  43556. >length</I
  43557. ></TT
  43558. > definovßny tak, ╛e se nic neodstranφ, prvky
  43559.      pole <TT
  43560. CLASS="parameter"
  43561. ><I
  43562. >replacement</I
  43563. ></TT
  43564. > se vlo╛φ na mφsto urΦenΘ argumentem
  43565.      <TT
  43566. CLASS="parameter"
  43567. ><I
  43568. >offset</I
  43569. ></TT
  43570. >. Tip: pokud je <TT
  43571. CLASS="parameter"
  43572. ><I
  43573. >replacement</I
  43574. ></TT
  43575. >
  43576.      jen jedna hodnota, nenφ nutno ji umis╗ovat do <TT
  43577. CLASS="literal"
  43578. >array()</TT
  43579. >,
  43580.      leda╛e chcete, aby tato polo╛ka byla opravdu pole.
  43581.     </P
  43582. ><P
  43583. >      Nßsledujφcφ volßnφ jsou ekvivalentnφ:
  43584.      <TABLE
  43585. BORDER="0"
  43586. BGCOLOR="#E0E0E0"
  43587. CELLPADDING="5"
  43588. ><TR
  43589. ><TD
  43590. ><PRE
  43591. CLASS="programlisting"
  43592. >array_push ($input, $x, $y)     array_splice ($input, count ($input), 0,
  43593.                                              array ($x, $y))
  43594. array_pop ($input)              array_splice ($input, -1)
  43595. array_shift ($input)            array_splice ($input, 0, 1)
  43596. array_unshift ($input, $x, $y)  array_splice ($input, 0, 0, array ($x, $y))
  43597. $a[$x] = $y                     array_splice ($input, $x, 1, $y)</PRE
  43598. ></TD
  43599. ></TR
  43600. ></TABLE
  43601. >
  43602.     </P
  43603. ><P
  43604. >      Vracφ pole odstran∞n²ch prvk∙.
  43605.     </P
  43606. ><P
  43607. >      <TABLE
  43608. WIDTH="100%"
  43609. BORDER="0"
  43610. CELLPADDING="0"
  43611. CELLSPACING="0"
  43612. CLASS="EXAMPLE"
  43613. ><TR
  43614. ><TD
  43615. ><DIV
  43616. CLASS="example"
  43617. ><A
  43618. NAME="AEN8109"
  43619. ></A
  43620. ><P
  43621. ><B
  43622. >P°φklad 1. Ukßzky <B
  43623. CLASS="function"
  43624. >array_splice()</B
  43625. ></B
  43626. ></P
  43627. ><TABLE
  43628. BORDER="0"
  43629. BGCOLOR="#E0E0E0"
  43630. CELLPADDING="5"
  43631. ><TR
  43632. ><TD
  43633. ><PRE
  43634. CLASS="php"
  43635. >$input = array ("red", "green", "blue", "yellow");
  43636.  
  43637. array_splice ($input, 2);      // $input is now array ("red", "green")
  43638. array_splice ($input, 1, -1);  // $input is now array ("red", "yellow")
  43639. array_splice ($input, 1, count($input), "orange");
  43640.                                // $input is now array ("red", "orange")
  43641. array_splice ($input, -1, 1, array("black", "maroon"));
  43642.                                // $input is now array ("red", "green",
  43643.                                //          "blue", "black", "maroon")</PRE
  43644. ></TD
  43645. ></TR
  43646. ></TABLE
  43647. ></DIV
  43648. ></TD
  43649. ></TR
  43650. ></TABLE
  43651. >
  43652.     </P
  43653. ><P
  43654. >      Viz takΘ: <A
  43655. HREF="#function.array-slice"
  43656. ><B
  43657. CLASS="function"
  43658. >array_slice()</B
  43659. ></A
  43660. >.
  43661.     </P
  43662. ></DIV
  43663. ><H1
  43664. ><A
  43665. NAME="function.array-sum"
  43666. ></A
  43667. >array_sum</H1
  43668. ><DIV
  43669. CLASS="refnamediv"
  43670. ><A
  43671. NAME="AEN8116"
  43672. ></A
  43673. ><P
  43674. >    (PHP 4 >= 4.0.4)</P
  43675. >array_sum -- 
  43676.      Calculate the sum of values in an array.
  43677.     </DIV
  43678. ><DIV
  43679. CLASS="refsect1"
  43680. ><A
  43681. NAME="AEN8119"
  43682. ></A
  43683. ><H2
  43684. >Description</H2
  43685. >mixed <B
  43686. CLASS="methodname"
  43687. >array_sum</B
  43688. > ( array array)<BR
  43689. ></BR
  43690. ><P
  43691. >      <B
  43692. CLASS="function"
  43693. >array_sum()</B
  43694. > returns the sum of values
  43695.      in an array as an integer or float.
  43696.     </P
  43697. ><P
  43698. >      <TABLE
  43699. WIDTH="100%"
  43700. BORDER="0"
  43701. CELLPADDING="0"
  43702. CELLSPACING="0"
  43703. CLASS="EXAMPLE"
  43704. ><TR
  43705. ><TD
  43706. ><DIV
  43707. CLASS="example"
  43708. ><A
  43709. NAME="AEN8130"
  43710. ></A
  43711. ><P
  43712. ><B
  43713. >P°φklad 1. <B
  43714. CLASS="function"
  43715. >array_sum()</B
  43716. > examples</B
  43717. ></P
  43718. ><TABLE
  43719. BORDER="0"
  43720. BGCOLOR="#E0E0E0"
  43721. CELLPADDING="5"
  43722. ><TR
  43723. ><TD
  43724. ><PRE
  43725. CLASS="php"
  43726. ><?php
  43727. $a = array(2, 4, 6, 8);
  43728. echo "sum(a) = " . array_sum($a) . "\n";
  43729.  
  43730. $b = array("a" => 1.2, "b" => 2.3, "c" => 3.4);
  43731. echo "sum(b) = " . array_sum($b) . "\n";
  43732. ?></PRE
  43733. ></TD
  43734. ></TR
  43735. ></TABLE
  43736. ><P
  43737. >        The printout of the program above will be:
  43738.       </P
  43739. ><TABLE
  43740. BORDER="0"
  43741. BGCOLOR="#E0E0E0"
  43742. CELLPADDING="5"
  43743. ><TR
  43744. ><TD
  43745. ><PRE
  43746. CLASS="screen"
  43747. >sum(a) = 20
  43748. sum(b) = 6.9</PRE
  43749. ></TD
  43750. ></TR
  43751. ></TABLE
  43752. ></DIV
  43753. ></TD
  43754. ></TR
  43755. ></TABLE
  43756. >
  43757.     </P
  43758. ><DIV
  43759. CLASS="note"
  43760. ><BLOCKQUOTE
  43761. CLASS="note"
  43762. ><P
  43763. ><B
  43764. >Poznßmka: </B
  43765. >
  43766.       PHP versions prior to 4.2.1 modified the passed array
  43767.       itself and converted strings to numbers (which most
  43768.       of the time converted them to zero, depending on
  43769.       their value).
  43770.      </P
  43771. ></BLOCKQUOTE
  43772. ></DIV
  43773. ></DIV
  43774. ><H1
  43775. ><A
  43776. NAME="function.array-udiff-assoc"
  43777. ></A
  43778. >array_udiff_assoc</H1
  43779. ><DIV
  43780. CLASS="refnamediv"
  43781. ><A
  43782. NAME="AEN8139"
  43783. ></A
  43784. ><P
  43785. >    (no version information, might be only in CVS)</P
  43786. >array_udiff_assoc -- Computes the difference of arrays with additional index check. The data is compared by using a callback function.</DIV
  43787. ><DIV
  43788. CLASS="refsect1"
  43789. ><A
  43790. NAME="AEN8142"
  43791. ></A
  43792. ><H2
  43793. >Description</H2
  43794. >array <B
  43795. CLASS="methodname"
  43796. >array_udiff_assoc</B
  43797. > ( array array1, array array2 [, array ..., callback data_compare_func])<BR
  43798. ></BR
  43799. ><P
  43800. >      <B
  43801. CLASS="function"
  43802. >array_udiff_assoc()</B
  43803. > returns an <A
  43804. HREF="#language.types.array"
  43805. ><B
  43806. CLASS="type"
  43807. >array</B
  43808. ></A
  43809. >
  43810.      containing all the values from <TT
  43811. CLASS="parameter"
  43812. ><I
  43813. >array1</I
  43814. ></TT
  43815. >
  43816.      that are not present in any of the other arguments.
  43817.      Note that the keys are used in the comparison unlike 
  43818.      <A
  43819. HREF="#function.array-diff"
  43820. ><B
  43821. CLASS="function"
  43822. >array_diff()</B
  43823. ></A
  43824. > and <A
  43825. HREF="#function.array-udiff"
  43826. ><B
  43827. CLASS="function"
  43828. >array_udiff()</B
  43829. ></A
  43830. >.
  43831.      The comparison of arrays' data is performed by using an user-supplied
  43832.      callback. In this aspect the behaviour is opposite to the behaviour of
  43833.      <A
  43834. HREF="#function.array-diff-assoc"
  43835. ><B
  43836. CLASS="function"
  43837. >array_diff_assoc()</B
  43838. ></A
  43839. > which uses internal function for
  43840.      comparison.
  43841.     </P
  43842. ><P
  43843. >      <TABLE
  43844. WIDTH="100%"
  43845. BORDER="0"
  43846. CELLPADDING="0"
  43847. CELLSPACING="0"
  43848. CLASS="EXAMPLE"
  43849. ><TR
  43850. ><TD
  43851. ><DIV
  43852. CLASS="example"
  43853. ><A
  43854. NAME="AEN8167"
  43855. ></A
  43856. ><P
  43857. ><B
  43858. >P°φklad 1. <B
  43859. CLASS="function"
  43860. >array_udiff_assoc()</B
  43861. > example</B
  43862. ></P
  43863. ><TABLE
  43864. BORDER="0"
  43865. BGCOLOR="#E0E0E0"
  43866. CELLPADDING="5"
  43867. ><TR
  43868. ><TD
  43869. ><PRE
  43870. CLASS="php"
  43871. ><?php
  43872. class cr {
  43873.     var $priv_member;
  43874.     function cr($val) {
  43875.         $this->priv_member = $val;
  43876.     }
  43877.     function comp_func_cr($a, $b) {
  43878.         if ($a->priv_member === $b->priv_member) return 0;
  43879.         return ($a->priv_member > $b->priv_member)? 1:-1;
  43880.     }
  43881. }
  43882. $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),);
  43883. $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),);
  43884.  
  43885. $result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr"));
  43886. print_r($result);
  43887. ?></PRE
  43888. ></TD
  43889. ></TR
  43890. ></TABLE
  43891. ><P
  43892. >        The result is:
  43893.       </P
  43894. ><TABLE
  43895. BORDER="0"
  43896. BGCOLOR="#E0E0E0"
  43897. CELLPADDING="5"
  43898. ><TR
  43899. ><TD
  43900. ><PRE
  43901. CLASS="screen"
  43902. >Array
  43903. (
  43904.     [0.1] => cr Object
  43905.         (
  43906.             [priv_member:private] => 9
  43907.         )
  43908.  
  43909.     [0.5] => cr Object
  43910.         (
  43911.             [priv_member:private] => 12
  43912.         )
  43913.  
  43914.     [0] => cr Object
  43915.         (
  43916.             [priv_member:private] => 23
  43917.         )
  43918. )</PRE
  43919. ></TD
  43920. ></TR
  43921. ></TABLE
  43922. ></DIV
  43923. ></TD
  43924. ></TR
  43925. ></TABLE
  43926. >
  43927.     </P
  43928. ><P
  43929. >      In our example above you see the <TT
  43930. CLASS="literal"
  43931. >"1" => new cr(4)</TT
  43932. >
  43933.      pair is present in both arrays and thus it is not in the ouput from the
  43934.      function.
  43935.     </P
  43936. ><P
  43937. >      For comparison is used the user supplied callback function.
  43938.      It must return an integer less than, equal
  43939.      to, or greater than zero if the first argument is considered to
  43940.      be respectively less than, equal to, or greater than the
  43941.      second.
  43942.     </P
  43943. ><DIV
  43944. CLASS="note"
  43945. ><BLOCKQUOTE
  43946. CLASS="note"
  43947. ><P
  43948. ><B
  43949. >Poznßmka: </B
  43950. >
  43951.       Please note that this function only checks one dimension of a n-dimensional
  43952.       array. Of course you can check deeper dimensions by using, for example, 
  43953.       <TT
  43954. CLASS="literal"
  43955. >array_udiff_assoc($array1[0], $array2[0], "some_comparison_func");</TT
  43956. >.
  43957.      </P
  43958. ></BLOCKQUOTE
  43959. ></DIV
  43960. ><P
  43961. >      See also
  43962.      <A
  43963. HREF="#function.array-diff"
  43964. ><B
  43965. CLASS="function"
  43966. >array_diff()</B
  43967. ></A
  43968. >,
  43969.      <A
  43970. HREF="#function.array-diff-assoc"
  43971. ><B
  43972. CLASS="function"
  43973. >array_diff_assoc()</B
  43974. ></A
  43975. >,
  43976.      <A
  43977. HREF="#function.array-diff-uassoc"
  43978. ><B
  43979. CLASS="function"
  43980. >array_diff_uassoc()</B
  43981. ></A
  43982. >,
  43983.      <A
  43984. HREF="#function.array-udiff"
  43985. ><B
  43986. CLASS="function"
  43987. >array_udiff()</B
  43988. ></A
  43989. >,
  43990.      <A
  43991. HREF="#function.array-udiff-uassoc"
  43992. ><B
  43993. CLASS="function"
  43994. >array_udiff_uassoc()</B
  43995. ></A
  43996. >, 
  43997.      <A
  43998. HREF="#function.array-intersect"
  43999. ><B
  44000. CLASS="function"
  44001. >array_intersect()</B
  44002. ></A
  44003. >,  
  44004.      <A
  44005. HREF="#function.array-intersect-assoc"
  44006. ><B
  44007. CLASS="function"
  44008. >array_intersect_assoc()</B
  44009. ></A
  44010. >,
  44011.      <B
  44012. CLASS="function"
  44013. >array_uintersect()</B
  44014. >,  
  44015.      <B
  44016. CLASS="function"
  44017. >array_uintersect_assoc()</B
  44018. > and 
  44019.      <B
  44020. CLASS="function"
  44021. >array_uintersect_uassoc()</B
  44022. >.
  44023.     </P
  44024. ></DIV
  44025. ><H1
  44026. ><A
  44027. NAME="function.array-udiff-uassoc"
  44028. ></A
  44029. >array_udiff_uassoc</H1
  44030. ><DIV
  44031. CLASS="refnamediv"
  44032. ><A
  44033. NAME="AEN8191"
  44034. ></A
  44035. ><P
  44036. >    (no version information, might be only in CVS)</P
  44037. >array_udiff_uassoc -- Computes the difference of arrays with additional index check. The data is compared by using a callback function. The index check is done by a callback function also</DIV
  44038. ><DIV
  44039. CLASS="refsect1"
  44040. ><A
  44041. NAME="AEN8194"
  44042. ></A
  44043. ><H2
  44044. >Description</H2
  44045. >array <B
  44046. CLASS="methodname"
  44047. >array_udiff_uassoc</B
  44048. > ( array array1, array array2 [, array ..., callback data_compare_func, callback key_compare_func])<BR
  44049. ></BR
  44050. ><P
  44051. >      <B
  44052. CLASS="function"
  44053. >array_udiff_uassoc()</B
  44054. > returns an <A
  44055. HREF="#language.types.array"
  44056. ><B
  44057. CLASS="type"
  44058. >array</B
  44059. ></A
  44060. >
  44061.      containing all the values from <TT
  44062. CLASS="parameter"
  44063. ><I
  44064. >array1</I
  44065. ></TT
  44066. >
  44067.      that are not present in any of the other arguments.
  44068.      Note that the keys are used in the comparison unlike 
  44069.      <A
  44070. HREF="#function.array-diff"
  44071. ><B
  44072. CLASS="function"
  44073. >array_diff()</B
  44074. ></A
  44075. > and <A
  44076. HREF="#function.array-udiff"
  44077. ><B
  44078. CLASS="function"
  44079. >array_udiff()</B
  44080. ></A
  44081. >.
  44082.      The comparison of arrays' data is performed by using an user-supplied
  44083.      callback : <TT
  44084. CLASS="parameter"
  44085. ><I
  44086. >data_compare_func</I
  44087. ></TT
  44088. >. In this aspect
  44089.      the behaviour is opposite to the behaviour of
  44090.      <A
  44091. HREF="#function.array-diff-assoc"
  44092. ><B
  44093. CLASS="function"
  44094. >array_diff_assoc()</B
  44095. ></A
  44096. > which uses internal function for
  44097.      comparison. The comparison of keys (indices) is done also by the 
  44098.      callback function <TT
  44099. CLASS="parameter"
  44100. ><I
  44101. >key_compare_func</I
  44102. ></TT
  44103. >. This
  44104.      behaviour is unlike what <A
  44105. HREF="#function.array-udiff-assoc"
  44106. ><B
  44107. CLASS="function"
  44108. >array_udiff_assoc()</B
  44109. ></A
  44110. > does, since
  44111.      the latter compares the indices by using an internal function.
  44112.     </P
  44113. ><P
  44114. >      <TABLE
  44115. WIDTH="100%"
  44116. BORDER="0"
  44117. CELLPADDING="0"
  44118. CELLSPACING="0"
  44119. CLASS="EXAMPLE"
  44120. ><TR
  44121. ><TD
  44122. ><DIV
  44123. CLASS="example"
  44124. ><A
  44125. NAME="AEN8225"
  44126. ></A
  44127. ><P
  44128. ><B
  44129. >P°φklad 1. <B
  44130. CLASS="function"
  44131. >array_udiff_uassoc()</B
  44132. > example</B
  44133. ></P
  44134. ><TABLE
  44135. BORDER="0"
  44136. BGCOLOR="#E0E0E0"
  44137. CELLPADDING="5"
  44138. ><TR
  44139. ><TD
  44140. ><PRE
  44141. CLASS="php"
  44142. ><?php
  44143. class cr {
  44144.     var $priv_member;
  44145.     function cr($val) {
  44146.         $this->priv_member = $val;
  44147.     }
  44148.     function comp_func_cr($a, $b) {
  44149.         if ($a->priv_member === $b->priv_member) return 0;
  44150.         return ($a->priv_member > $b->priv_member)? 1:-1;
  44151.     }
  44152.     function comp_func_key($a, $b) {
  44153.         if ($a === $b) return 0;
  44154.         return ($a > $b)? 1:-1;
  44155.     }
  44156. }
  44157. $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),);
  44158. $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),);
  44159.  
  44160. $result = array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key"));
  44161. print_r($result);
  44162. ?></PRE
  44163. ></TD
  44164. ></TR
  44165. ></TABLE
  44166. ><P
  44167. >        The result is:
  44168.       </P
  44169. ><TABLE
  44170. BORDER="0"
  44171. BGCOLOR="#E0E0E0"
  44172. CELLPADDING="5"
  44173. ><TR
  44174. ><TD
  44175. ><PRE
  44176. CLASS="screen"
  44177. >Array
  44178. (
  44179.     [0.1] => cr Object
  44180.         (
  44181.             [priv_member:private] => 9
  44182.         )
  44183.  
  44184.     [0.5] => cr Object
  44185.         (
  44186.             [priv_member:private] => 12
  44187.         )
  44188.  
  44189.     [0] => cr Object
  44190.         (
  44191.             [priv_member:private] => 23
  44192.         )
  44193. )</PRE
  44194. ></TD
  44195. ></TR
  44196. ></TABLE
  44197. ></DIV
  44198. ></TD
  44199. ></TR
  44200. ></TABLE
  44201. >
  44202.     </P
  44203. ><P
  44204. >      In our example above you see the <TT
  44205. CLASS="literal"
  44206. >"1" => new cr(4)</TT
  44207. >
  44208.      pair is present in both arrays and thus it is not in the ouput from the
  44209.      function. Keep in mind that you have to supply 2 callback functions.
  44210.     </P
  44211. ><P
  44212. >      For comparison is used the user supplied callback function.
  44213.      It must return an integer less than, equal
  44214.      to, or greater than zero if the first argument is considered to
  44215.      be respectively less than, equal to, or greater than the
  44216.      second.
  44217.     </P
  44218. ><DIV
  44219. CLASS="note"
  44220. ><BLOCKQUOTE
  44221. CLASS="note"
  44222. ><P
  44223. ><B
  44224. >Poznßmka: </B
  44225. >
  44226.       Please note that this function only checks one dimension of a n-dimensional
  44227.       array. Of course you can check deeper dimensions by using, for example, 
  44228.       <TT
  44229. CLASS="literal"
  44230. >array_udiff_uassoc($array1[0], $array2[0], "data_compare_func",
  44231.       "key_compare_func");</TT
  44232. >.
  44233.      </P
  44234. ></BLOCKQUOTE
  44235. ></DIV
  44236. ><P
  44237. >      See also
  44238.      <A
  44239. HREF="#function.array-diff"
  44240. ><B
  44241. CLASS="function"
  44242. >array_diff()</B
  44243. ></A
  44244. >,
  44245.      <A
  44246. HREF="#function.array-diff-assoc"
  44247. ><B
  44248. CLASS="function"
  44249. >array_diff_assoc()</B
  44250. ></A
  44251. >,
  44252.      <A
  44253. HREF="#function.array-diff-uassoc"
  44254. ><B
  44255. CLASS="function"
  44256. >array_diff_uassoc()</B
  44257. ></A
  44258. >,
  44259.      <A
  44260. HREF="#function.array-udiff"
  44261. ><B
  44262. CLASS="function"
  44263. >array_udiff()</B
  44264. ></A
  44265. >,
  44266.      <A
  44267. HREF="#function.array-udiff-assoc"
  44268. ><B
  44269. CLASS="function"
  44270. >array_udiff_assoc()</B
  44271. ></A
  44272. >, 
  44273.      <A
  44274. HREF="#function.array-intersect"
  44275. ><B
  44276. CLASS="function"
  44277. >array_intersect()</B
  44278. ></A
  44279. >,  
  44280.      <A
  44281. HREF="#function.array-intersect-assoc"
  44282. ><B
  44283. CLASS="function"
  44284. >array_intersect_assoc()</B
  44285. ></A
  44286. >,
  44287.      <B
  44288. CLASS="function"
  44289. >array_uintersect()</B
  44290. >,  
  44291.      <B
  44292. CLASS="function"
  44293. >array_uintersect_assoc()</B
  44294. > and 
  44295.      <B
  44296. CLASS="function"
  44297. >array_uintersect_uassoc()</B
  44298. >.
  44299.     </P
  44300. ></DIV
  44301. ><H1
  44302. ><A
  44303. NAME="function.array-udiff"
  44304. ></A
  44305. >array_udiff</H1
  44306. ><DIV
  44307. CLASS="refnamediv"
  44308. ><A
  44309. NAME="AEN8249"
  44310. ></A
  44311. ><P
  44312. >    (no version information, might be only in CVS)</P
  44313. >array_udiff -- Computes the difference of arrays by using a callback function for data comparison.</DIV
  44314. ><DIV
  44315. CLASS="refsect1"
  44316. ><A
  44317. NAME="AEN8252"
  44318. ></A
  44319. ><H2
  44320. >Description</H2
  44321. >array <B
  44322. CLASS="methodname"
  44323. >array_udiff</B
  44324. > ( array array1, array array2 [, array ..., callback data_compare_func])<BR
  44325. ></BR
  44326. ><P
  44327. >      <B
  44328. CLASS="function"
  44329. >array_udiff()</B
  44330. > returns an array
  44331.      containing all the values of <TT
  44332. CLASS="parameter"
  44333. ><I
  44334. >array1</I
  44335. ></TT
  44336. >
  44337.      that are not present in any of the other arguments.
  44338.      Note that keys are preserved. For the comparison of the data
  44339.      <TT
  44340. CLASS="parameter"
  44341. ><I
  44342. >data_compare_func</I
  44343. ></TT
  44344. > is used.
  44345.      It must return an integer less than, equal
  44346.      to, or greater than zero if the first argument is considered to
  44347.      be respectively less than, equal to, or greater than the
  44348.      second. This is unlike <A
  44349. HREF="#function.array-diff"
  44350. ><B
  44351. CLASS="function"
  44352. >array_diff()</B
  44353. ></A
  44354. > which uses an
  44355.      internal function for comparing the data.
  44356.     </P
  44357. ><P
  44358. >      <TABLE
  44359. WIDTH="100%"
  44360. BORDER="0"
  44361. CELLPADDING="0"
  44362. CELLSPACING="0"
  44363. CLASS="EXAMPLE"
  44364. ><TR
  44365. ><TD
  44366. ><DIV
  44367. CLASS="example"
  44368. ><A
  44369. NAME="AEN8275"
  44370. ></A
  44371. ><P
  44372. ><B
  44373. >P°φklad 1. <B
  44374. CLASS="function"
  44375. >array_udiff()</B
  44376. > example</B
  44377. ></P
  44378. ><TABLE
  44379. BORDER="0"
  44380. BGCOLOR="#E0E0E0"
  44381. CELLPADDING="5"
  44382. ><TR
  44383. ><TD
  44384. ><PRE
  44385. CLASS="php"
  44386. ><?php
  44387. class cr {
  44388.     var $priv_member;
  44389.     function cr($val) {
  44390.         $this->priv_member = $val;
  44391.     }
  44392.     function comp_func_cr($a, $b) {
  44393.         if ($a->priv_member === $b->priv_member) return 0;
  44394.         return ($a->priv_member > $b->priv_member)? 1:-1;
  44395.     }
  44396. }
  44397. $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),);
  44398. $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),);
  44399.  
  44400. $result = array_udiff($a, $b, array("cr", "comp_func_cr"));
  44401. print_r($result);
  44402. ?></PRE
  44403. ></TD
  44404. ></TR
  44405. ></TABLE
  44406. ><P
  44407. >        The result is:
  44408.       </P
  44409. ><TABLE
  44410. BORDER="0"
  44411. BGCOLOR="#E0E0E0"
  44412. CELLPADDING="5"
  44413. ><TR
  44414. ><TD
  44415. ><PRE
  44416. CLASS="screen"
  44417. >Array
  44418. (
  44419.     [0.5] => cr Object
  44420.         (
  44421.             [priv_member:private] => 12
  44422.         )
  44423.  
  44424.     [0] => cr Object
  44425.         (
  44426.             [priv_member:private] => 23
  44427.         )
  44428.  
  44429. )</PRE
  44430. ></TD
  44431. ></TR
  44432. ></TABLE
  44433. ></DIV
  44434. ></TD
  44435. ></TR
  44436. ></TABLE
  44437. >
  44438.     </P
  44439. ><DIV
  44440. CLASS="note"
  44441. ><BLOCKQUOTE
  44442. CLASS="note"
  44443. ><P
  44444. ><B
  44445. >Poznßmka: </B
  44446. >
  44447.       Two elements are considered equal if and only if
  44448.       <TT
  44449. CLASS="literal"
  44450. >(string) $elem1 === (string) $elem2</TT
  44451. >. In words:
  44452.       when the string representation is the same.
  44453.      </P
  44454. ></BLOCKQUOTE
  44455. ></DIV
  44456. ><DIV
  44457. CLASS="note"
  44458. ><BLOCKQUOTE
  44459. CLASS="note"
  44460. ><P
  44461. ><B
  44462. >Poznßmka: </B
  44463. >
  44464.       Please note that this function only checks one dimension of a n-dimensional
  44465.       array. Of course you can check deeper dimensions by using
  44466.       <TT
  44467. CLASS="literal"
  44468. >array_udiff($array1[0], $array2[0], "data_compare_func");</TT
  44469. >.
  44470.      </P
  44471. ></BLOCKQUOTE
  44472. ></DIV
  44473. ><P
  44474. >      See also
  44475.      <A
  44476. HREF="#function.array-diff"
  44477. ><B
  44478. CLASS="function"
  44479. >array_diff()</B
  44480. ></A
  44481. >,
  44482.      <A
  44483. HREF="#function.array-diff-assoc"
  44484. ><B
  44485. CLASS="function"
  44486. >array_diff_assoc()</B
  44487. ></A
  44488. >,
  44489.      <A
  44490. HREF="#function.array-diff-uassoc"
  44491. ><B
  44492. CLASS="function"
  44493. >array_diff_uassoc()</B
  44494. ></A
  44495. >,
  44496.      <A
  44497. HREF="#function.array-udiff-assoc"
  44498. ><B
  44499. CLASS="function"
  44500. >array_udiff_assoc()</B
  44501. ></A
  44502. >, 
  44503.      <A
  44504. HREF="#function.array-udiff-uassoc"
  44505. ><B
  44506. CLASS="function"
  44507. >array_udiff_uassoc()</B
  44508. ></A
  44509. >, 
  44510.      <A
  44511. HREF="#function.array-intersect"
  44512. ><B
  44513. CLASS="function"
  44514. >array_intersect()</B
  44515. ></A
  44516. >,  
  44517.      <A
  44518. HREF="#function.array-intersect-assoc"
  44519. ><B
  44520. CLASS="function"
  44521. >array_intersect_assoc()</B
  44522. ></A
  44523. >,
  44524.      <B
  44525. CLASS="function"
  44526. >array_uintersect()</B
  44527. >,  
  44528.      <B
  44529. CLASS="function"
  44530. >array_uintersect_assoc()</B
  44531. > and 
  44532.      <B
  44533. CLASS="function"
  44534. >array_uintersect_uassoc()</B
  44535. >.
  44536.     </P
  44537. ></DIV
  44538. ><H1
  44539. ><A
  44540. NAME="function.array-unique"
  44541. ></A
  44542. >array_unique</H1
  44543. ><DIV
  44544. CLASS="refnamediv"
  44545. ><A
  44546. NAME="AEN8299"
  44547. ></A
  44548. ><P
  44549. >    (PHP 4 >= 4.0.1)</P
  44550. >array_unique -- Odstranit z pole duplicitnφ hodnoty</DIV
  44551. ><DIV
  44552. CLASS="refsect1"
  44553. ><A
  44554. NAME="AEN8302"
  44555. ></A
  44556. ><H2
  44557. >Popis</H2
  44558. >array <B
  44559. CLASS="methodname"
  44560. >array_unique</B
  44561. > ( array array)<BR
  44562. ></BR
  44563. ><P
  44564. >      <B
  44565. CLASS="function"
  44566. >array_unique()</B
  44567. > p°ijφmß pole <TT
  44568. CLASS="parameter"
  44569. ><I
  44570. >array</I
  44571. ></TT
  44572. >
  44573.      a vracφ novΘ pole bez duplicitnφch hodnot. KlφΦe jsou zachovßny.
  44574.     </P
  44575. ><P
  44576. >      <TABLE
  44577. WIDTH="100%"
  44578. BORDER="0"
  44579. CELLPADDING="0"
  44580. CELLSPACING="0"
  44581. CLASS="EXAMPLE"
  44582. ><TR
  44583. ><TD
  44584. ><DIV
  44585. CLASS="example"
  44586. ><A
  44587. NAME="AEN8314"
  44588. ></A
  44589. ><P
  44590. ><B
  44591. >P°φklad 1. Ukßzka <B
  44592. CLASS="function"
  44593. >array_unique()</B
  44594. ></B
  44595. ></P
  44596. ><TABLE
  44597. BORDER="0"
  44598. BGCOLOR="#E0E0E0"
  44599. CELLPADDING="5"
  44600. ><TR
  44601. ><TD
  44602. ><PRE
  44603. CLASS="php"
  44604. >$input = array ("a" => "green", "red", "b" => "green", "blue", "red");
  44605. $result = array_unique ($input);</PRE
  44606. ></TD
  44607. ></TR
  44608. ></TABLE
  44609. ></DIV
  44610. ></TD
  44611. ></TR
  44612. ></TABLE
  44613. >
  44614.     </P
  44615. ><P
  44616. >      <TT
  44617. CLASS="varname"
  44618. >$result</TT
  44619. > te∩ obsahuje <TT
  44620. CLASS="literal"
  44621. >array ("a" =>
  44622.      "green", "red", "blue");</TT
  44623. >.
  44624.     </P
  44625. ></DIV
  44626. ><H1
  44627. ><A
  44628. NAME="function.array-unshift"
  44629. ></A
  44630. >array_unshift</H1
  44631. ><DIV
  44632. CLASS="refnamediv"
  44633. ><A
  44634. NAME="AEN8322"
  44635. ></A
  44636. ><P
  44637. >    (PHP 4 )</P
  44638. >array_unshift -- P°ipojit jeden nebo vφce prvk∙ na zaΦßtek pole</DIV
  44639. ><DIV
  44640. CLASS="refsect1"
  44641. ><A
  44642. NAME="AEN8325"
  44643. ></A
  44644. ><H2
  44645. >Popis</H2
  44646. >int <B
  44647. CLASS="methodname"
  44648. >array_unshift</B
  44649. > ( array array, mixed var [, mixed ...])<BR
  44650. ></BR
  44651. ><P
  44652. >      <B
  44653. CLASS="function"
  44654. >array_unshift()</B
  44655. > p°ipojφ p°edanΘ prvky na zaΦßtek
  44656.      <TT
  44657. CLASS="parameter"
  44658. ><I
  44659. >array</I
  44660. ></TT
  44661. >. V╣echny prvky jsou p°idßny jako celek, Φili
  44662.      p°idanΘ prvky si zachovßvajφ po°adφ.
  44663.     </P
  44664. ><P
  44665. >      vracφ nov² poΦet prvk∙ v <TT
  44666. CLASS="parameter"
  44667. ><I
  44668. >array</I
  44669. ></TT
  44670. >.
  44671.     </P
  44672. ><P
  44673. >      <TABLE
  44674. WIDTH="100%"
  44675. BORDER="0"
  44676. CELLPADDING="0"
  44677. CELLSPACING="0"
  44678. CLASS="EXAMPLE"
  44679. ><TR
  44680. ><TD
  44681. ><DIV
  44682. CLASS="example"
  44683. ><A
  44684. NAME="AEN8345"
  44685. ></A
  44686. ><P
  44687. ><B
  44688. >P°φklad 1. Ukßzka <B
  44689. CLASS="function"
  44690. >array_unshift()</B
  44691. ></B
  44692. ></P
  44693. ><TABLE
  44694. BORDER="0"
  44695. BGCOLOR="#E0E0E0"
  44696. CELLPADDING="5"
  44697. ><TR
  44698. ><TD
  44699. ><PRE
  44700. CLASS="php"
  44701. >$queue = array ("p1", "p3");
  44702. array_unshift ($queue, "p4", "p5", "p6");</PRE
  44703. ></TD
  44704. ></TR
  44705. ></TABLE
  44706. ></DIV
  44707. ></TD
  44708. ></TR
  44709. ></TABLE
  44710. >
  44711.     </P
  44712. ><P
  44713. >      <TT
  44714. CLASS="varname"
  44715. >$queue</TT
  44716. > bude mφt 5 prvk∙: "p4", "p5", "p6", "p1" a "p3".
  44717.     </P
  44718. ><P
  44719. >      Viz takΘ: <A
  44720. HREF="#function.array-shift"
  44721. ><B
  44722. CLASS="function"
  44723. >array_shift()</B
  44724. ></A
  44725. >,
  44726.      <A
  44727. HREF="#function.array-push"
  44728. ><B
  44729. CLASS="function"
  44730. >array_push()</B
  44731. ></A
  44732. > a
  44733.      <A
  44734. HREF="#function.array-pop"
  44735. ><B
  44736. CLASS="function"
  44737. >array_pop()</B
  44738. ></A
  44739. >.
  44740.     </P
  44741. ></DIV
  44742. ><H1
  44743. ><A
  44744. NAME="function.array-values"
  44745. ></A
  44746. >array_values</H1
  44747. ><DIV
  44748. CLASS="refnamediv"
  44749. ><A
  44750. NAME="AEN8356"
  44751. ></A
  44752. ><P
  44753. >    (PHP 4 )</P
  44754. >array_values -- Vrßtit v╣echny hodnoty v poli</DIV
  44755. ><DIV
  44756. CLASS="refsect1"
  44757. ><A
  44758. NAME="AEN8359"
  44759. ></A
  44760. ><H2
  44761. >Popis</H2
  44762. >array <B
  44763. CLASS="methodname"
  44764. >array_values</B
  44765. > ( array input)<BR
  44766. ></BR
  44767. ><P
  44768. >      <B
  44769. CLASS="function"
  44770. >array_values()</B
  44771. > vracφ v╣echny hodnoty pole
  44772.      <TT
  44773. CLASS="parameter"
  44774. ><I
  44775. >input</I
  44776. ></TT
  44777. >.
  44778.     </P
  44779. ><P
  44780. >      <TABLE
  44781. WIDTH="100%"
  44782. BORDER="0"
  44783. CELLPADDING="0"
  44784. CELLSPACING="0"
  44785. CLASS="EXAMPLE"
  44786. ><TR
  44787. ><TD
  44788. ><DIV
  44789. CLASS="example"
  44790. ><A
  44791. NAME="AEN8371"
  44792. ></A
  44793. ><P
  44794. ><B
  44795. >P°φklad 1. Ukßzka <B
  44796. CLASS="function"
  44797. >array_values()</B
  44798. ></B
  44799. ></P
  44800. ><TABLE
  44801. BORDER="0"
  44802. BGCOLOR="#E0E0E0"
  44803. CELLPADDING="5"
  44804. ><TR
  44805. ><TD
  44806. ><PRE
  44807. CLASS="php"
  44808. >$array = array ("size" => "XL", "color" => "gold");
  44809. array_values ($array);    // vrßtφ array ("XL", "gold")</PRE
  44810. ></TD
  44811. ></TR
  44812. ></TABLE
  44813. ></DIV
  44814. ></TD
  44815. ></TR
  44816. ></TABLE
  44817. >
  44818.     </P
  44819. ><DIV
  44820. CLASS="note"
  44821. ><BLOCKQUOTE
  44822. CLASS="note"
  44823. ><P
  44824. ><B
  44825. >Poznßmka: </B
  44826. >
  44827.       Tato funkce byla p°idßna v PHP 4, nßsleduje implementace pro ty, kdo stßle
  44828.       pou╛φvajφ PHP 3.
  44829.       <TABLE
  44830. WIDTH="100%"
  44831. BORDER="0"
  44832. CELLPADDING="0"
  44833. CELLSPACING="0"
  44834. CLASS="EXAMPLE"
  44835. ><TR
  44836. ><TD
  44837. ><DIV
  44838. CLASS="example"
  44839. ><A
  44840. NAME="AEN8377"
  44841. ></A
  44842. ><P
  44843. ><B
  44844. >P°φklad 2. 
  44845.         Implementace <B
  44846. CLASS="function"
  44847. >array_values()</B
  44848. > pro u╛ivatele PHP 3
  44849.        </B
  44850. ></P
  44851. ><TABLE
  44852. BORDER="0"
  44853. BGCOLOR="#E0E0E0"
  44854. CELLPADDING="5"
  44855. ><TR
  44856. ><TD
  44857. ><PRE
  44858. CLASS="php"
  44859. >function array_values ($arr) {
  44860.     $t = array();
  44861.     while (list($k, $v) = each ($arr)) {
  44862.         $t[] = $v;
  44863.         return $t;
  44864.     }
  44865. }</PRE
  44866. ></TD
  44867. ></TR
  44868. ></TABLE
  44869. ></DIV
  44870. ></TD
  44871. ></TR
  44872. ></TABLE
  44873. >
  44874.      </P
  44875. ></BLOCKQUOTE
  44876. ></DIV
  44877. ></DIV
  44878. ><H1
  44879. ><A
  44880. NAME="function.array-walk"
  44881. ></A
  44882. >array_walk</H1
  44883. ><DIV
  44884. CLASS="refnamediv"
  44885. ><A
  44886. NAME="AEN8382"
  44887. ></A
  44888. ><P
  44889. >    (PHP 3>= 3.0.3, PHP 4 )</P
  44890. >array_walk -- Pou╛φt u╛ivatelskou funkci na v╣echny prvky pole</DIV
  44891. ><DIV
  44892. CLASS="refsect1"
  44893. ><A
  44894. NAME="AEN8385"
  44895. ></A
  44896. ><H2
  44897. >Popis</H2
  44898. >int <B
  44899. CLASS="methodname"
  44900. >array_walk</B
  44901. > ( array arr, string func, mixed userdata)<BR
  44902. ></BR
  44903. ><P
  44904. >      Aplikuje funkci <TT
  44905. CLASS="parameter"
  44906. ><I
  44907. >func</I
  44908. ></TT
  44909. > na v╣echny prvky pole
  44910.      <TT
  44911. CLASS="parameter"
  44912. ><I
  44913. >arr</I
  44914. ></TT
  44915. >. Funkci <TT
  44916. CLASS="parameter"
  44917. ><I
  44918. >func</I
  44919. ></TT
  44920. > se jako prvnφ
  44921.      argument p°edß hodnota a jako druh² klφΦ. Pokud je p°φtomen argument
  44922.      <TT
  44923. CLASS="parameter"
  44924. ><I
  44925. >userdata</I
  44926. ></TT
  44927. >, bude u╛ivatelskΘ funkci p°edßn jako
  44928.      t°etφ argument.
  44929.     </P
  44930. ><P
  44931. >      Pokud <TT
  44932. CLASS="parameter"
  44933. ><I
  44934. >func</I
  44935. ></TT
  44936. > vy╛aduje vφce ne╛ dva nebo t°i argumenty
  44937.      (v zßvislosti na <TT
  44938. CLASS="parameter"
  44939. ><I
  44940. >userdata</I
  44941. ></TT
  44942. >), pro ka╛dΘ volßnφ
  44943.      <TT
  44944. CLASS="parameter"
  44945. ><I
  44946. >func</I
  44947. ></TT
  44948. > z <B
  44949. CLASS="function"
  44950. >array_walk()</B
  44951. > se vygeneruje
  44952.      varovßnφ. Tato varovßnφ se dajφ potlaΦit p°idßnφm znaku '@' p°ed
  44953.      volßnφ <B
  44954. CLASS="function"
  44955. >array_walk()</B
  44956. > nebo pomocφ
  44957.      <A
  44958. HREF="#function.error-reporting"
  44959. ><B
  44960. CLASS="function"
  44961. >error_reporting()</B
  44962. ></A
  44963. >.
  44964.     </P
  44965. ><DIV
  44966. CLASS="note"
  44967. ><BLOCKQUOTE
  44968. CLASS="note"
  44969. ><P
  44970. ><B
  44971. >Poznßmka: </B
  44972. >
  44973.       Pokud <TT
  44974. CLASS="parameter"
  44975. ><I
  44976. >func</I
  44977. ></TT
  44978. > pot°ebuje pracovat p°φmo s dan²m polem,
  44979.       prvnφ argument <TT
  44980. CLASS="parameter"
  44981. ><I
  44982. >func</I
  44983. ></TT
  44984. > se musφ p°edßvat odkazem.
  44985.       V╣echny zm∞ny t∞chto hodnot se pak promφtnou p°φmo
  44986.       v <TT
  44987. CLASS="parameter"
  44988. ><I
  44989. >arr</I
  44990. ></TT
  44991. >.
  44992.      </P
  44993. ></BLOCKQUOTE
  44994. ></DIV
  44995. ><DIV
  44996. CLASS="note"
  44997. ><BLOCKQUOTE
  44998. CLASS="note"
  44999. ><P
  45000. ><B
  45001. >Poznßmka: </B
  45002. >
  45003.       Druh² a t°etφ argument <TT
  45004. CLASS="parameter"
  45005. ><I
  45006. >func</I
  45007. ></TT
  45008. > byly p°idßny v PHP 4.0.
  45009.      </P
  45010. ><P
  45011. >       V PHP 4 je t°eba volat podle pot°eby <A
  45012. HREF="#function.reset"
  45013. ><B
  45014. CLASS="function"
  45015. >reset()</B
  45016. ></A
  45017. >, proto╛e
  45018.       <B
  45019. CLASS="function"
  45020. >array_walk()</B
  45021. > sama vstupnφ pole neresetuje.
  45022.      </P
  45023. ></BLOCKQUOTE
  45024. ></DIV
  45025. ><P
  45026. >      <TABLE
  45027. WIDTH="100%"
  45028. BORDER="0"
  45029. CELLPADDING="0"
  45030. CELLSPACING="0"
  45031. CLASS="EXAMPLE"
  45032. ><TR
  45033. ><TD
  45034. ><DIV
  45035. CLASS="example"
  45036. ><A
  45037. NAME="AEN8423"
  45038. ></A
  45039. ><P
  45040. ><B
  45041. >P°φklad 1. Ukßzka <B
  45042. CLASS="function"
  45043. >array_walk()</B
  45044. ></B
  45045. ></P
  45046. ><TABLE
  45047. BORDER="0"
  45048. BGCOLOR="#E0E0E0"
  45049. CELLPADDING="5"
  45050. ><TR
  45051. ><TD
  45052. ><PRE
  45053. CLASS="php"
  45054. >$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
  45055.  
  45056. function test_alter (&$item1, $key, $prefix) {
  45057.     $item1 = "$prefix: $item1";
  45058. }
  45059.  
  45060. function test_print ($item2, $key) {
  45061.     echo "$key. $item2<br>\n";
  45062. }
  45063.  
  45064. array_walk ($fruits, 'test_print');
  45065. reset ($fruits);
  45066. array_walk ($fruits, 'test_alter', 'fruit');
  45067. reset ($fruits);
  45068. array_walk ($fruits, 'test_print');</PRE
  45069. ></TD
  45070. ></TR
  45071. ></TABLE
  45072. ></DIV
  45073. ></TD
  45074. ></TR
  45075. ></TABLE
  45076. >
  45077.     </P
  45078. ><P
  45079. >      Viz takΘ: <A
  45080. HREF="#function.each"
  45081. ><B
  45082. CLASS="function"
  45083. >each()</B
  45084. ></A
  45085. > a
  45086.      <A
  45087. HREF="#function.list"
  45088. ><B
  45089. CLASS="function"
  45090. >list()</B
  45091. ></A
  45092. >.
  45093.     </P
  45094. ></DIV
  45095. ><H1
  45096. ><A
  45097. NAME="function.array"
  45098. ></A
  45099. >array</H1
  45100. ><DIV
  45101. CLASS="refnamediv"
  45102. ><A
  45103. NAME="AEN8431"
  45104. ></A
  45105. ><P
  45106. >    (PHP 3, PHP 4 )</P
  45107. >array -- 
  45108.      Vytvo°it pole
  45109.     </DIV
  45110. ><DIV
  45111. CLASS="refsect1"
  45112. ><A
  45113. NAME="AEN8434"
  45114. ></A
  45115. ><H2
  45116. >Popis</H2
  45117. >array <B
  45118. CLASS="methodname"
  45119. >array</B
  45120. > ( [mixed ...])<BR
  45121. ></BR
  45122. ><P
  45123. >      Vracφ pole argument∙. Argument∙m m∙╛e b²t p°i°azen index pomocφ operßtoru
  45124.      <TT
  45125. CLASS="literal"
  45126. >=></TT
  45127. >.
  45128.     </P
  45129. ><P
  45130. >      <DIV
  45131. CLASS="note"
  45132. ><BLOCKQUOTE
  45133. CLASS="note"
  45134. ><P
  45135. ><B
  45136. >Poznßmka: </B
  45137. >
  45138.        <B
  45139. CLASS="function"
  45140. >array()</B
  45141. > je jazykov² konstrukt pou╛φvan² k reprezentaci
  45142.        polφ, nikoliv b∞╛nß funkce.
  45143.       </P
  45144. ></BLOCKQUOTE
  45145. ></DIV
  45146. >
  45147.     </P
  45148. ><P
  45149. >      Syntaxe "index => hodnota", s Φßrko jako odd∞lovaΦem, definuje indexy a
  45150.      hodnoty. Index m∙╛e b²t °et∞zec nebo Φφslo. Pokud se index vynechß,
  45151.      automaticky se generuje Φφseln² index zaΦφnajφcφ na 0. Pokud je index
  45152.      integer, dal╣φ generovan² index bude nejvy╣╣φ celoΦφseln² index + 1. Pozn.:
  45153.      pokud jsou definovßny dva identickΘ indexy, prvnφ se p°epφ╣e poslednφm.
  45154.     </P
  45155. ><P
  45156. >      Nßsledujφcφ ukßzka demonstruje jak vytvo°it dvourozm∞rnΘ pole, jak urΦit
  45157.      klφΦe v asociativnφch polφch, a jak p°eskakovat ΦφselnΘ indexy v normßlnφch
  45158.      polφch.
  45159.      <TABLE
  45160. WIDTH="100%"
  45161. BORDER="0"
  45162. CELLPADDING="0"
  45163. CELLSPACING="0"
  45164. CLASS="EXAMPLE"
  45165. ><TR
  45166. ><TD
  45167. ><DIV
  45168. CLASS="example"
  45169. ><A
  45170. NAME="AEN8450"
  45171. ></A
  45172. ><P
  45173. ><B
  45174. >P°φklad 1. Ukßzka <B
  45175. CLASS="function"
  45176. >array()</B
  45177. ></B
  45178. ></P
  45179. ><TABLE
  45180. BORDER="0"
  45181. BGCOLOR="#E0E0E0"
  45182. CELLPADDING="5"
  45183. ><TR
  45184. ><TD
  45185. ><PRE
  45186. CLASS="php"
  45187. >$fruits = array (
  45188.     "fruits"  => array ("a"=>"orange", "b"=>"banana", "c"=>"apple"),
  45189.     "numbers" => array (1, 2, 3, 4, 5, 6),
  45190.     "holes"   => array ("first", 5 => "second", "third")
  45191. );</PRE
  45192. ></TD
  45193. ></TR
  45194. ></TABLE
  45195. ></DIV
  45196. ></TD
  45197. ></TR
  45198. ></TABLE
  45199. >
  45200.     </P
  45201. ><P
  45202. >      <TABLE
  45203. WIDTH="100%"
  45204. BORDER="0"
  45205. CELLPADDING="0"
  45206. CELLSPACING="0"
  45207. CLASS="EXAMPLE"
  45208. ><TR
  45209. ><TD
  45210. ><DIV
  45211. CLASS="example"
  45212. ><A
  45213. NAME="AEN8455"
  45214. ></A
  45215. ><P
  45216. ><B
  45217. >P°φklad 2. Automatick² index a <B
  45218. CLASS="function"
  45219. >array()</B
  45220. ></B
  45221. ></P
  45222. ><TABLE
  45223. BORDER="0"
  45224. BGCOLOR="#E0E0E0"
  45225. CELLPADDING="5"
  45226. ><TR
  45227. ><TD
  45228. ><PRE
  45229. CLASS="php"
  45230. >$array = array( 1, 1, 1, 1,  1, 8=>1,  4=>1, 19, 3=>13);
  45231. print_r($array);</PRE
  45232. ></TD
  45233. ></TR
  45234. ></TABLE
  45235. ></DIV
  45236. ></TD
  45237. ></TR
  45238. ></TABLE
  45239. >
  45240.      v²stup bude nßsledujφcφ:
  45241.      <DIV
  45242. CLASS="informalexample"
  45243. ><A
  45244. NAME="AEN8459"
  45245. ></A
  45246. ><P
  45247. ></P
  45248. ><TABLE
  45249. BORDER="0"
  45250. BGCOLOR="#E0E0E0"
  45251. CELLPADDING="5"
  45252. ><TR
  45253. ><TD
  45254. ><PRE
  45255. CLASS="programlisting"
  45256. >Array
  45257. (
  45258.     [0] => 1
  45259.     [1] => 1
  45260.     [2] => 1
  45261.     [3] => 13
  45262.     [4] => 1
  45263.     [8] => 1
  45264.     [9] => 19
  45265. )</PRE
  45266. ></TD
  45267. ></TR
  45268. ></TABLE
  45269. ><P
  45270. ></P
  45271. ></DIV
  45272. >
  45273.      Index 3 je definovßn dvakrßt, a podr╛φ si poslednφ hodnotu 13. Index 4 je
  45274.      definovßn po indexu 8 a dal╣φ generovan² index (hodnota 19) je 9, proto╛e
  45275.      nejvy╣╣φ index byl 8.
  45276.     </P
  45277. ><P
  45278. >      Tato ukßzka vytvo°φ pole ΦφslovanΘ od 1.
  45279.      <TABLE
  45280. WIDTH="100%"
  45281. BORDER="0"
  45282. CELLPADDING="0"
  45283. CELLSPACING="0"
  45284. CLASS="EXAMPLE"
  45285. ><TR
  45286. ><TD
  45287. ><DIV
  45288. CLASS="example"
  45289. ><A
  45290. NAME="AEN8462"
  45291. ></A
  45292. ><P
  45293. ><B
  45294. >P°φklad 3. Index zaΦφnajφcφ 1 s <B
  45295. CLASS="function"
  45296. >array()</B
  45297. ></B
  45298. ></P
  45299. ><TABLE
  45300. BORDER="0"
  45301. BGCOLOR="#E0E0E0"
  45302. CELLPADDING="5"
  45303. ><TR
  45304. ><TD
  45305. ><PRE
  45306. CLASS="php"
  45307. >$firstquarter  = array(1 => 'January', 'February', 'March');
  45308.         print_r($firstquarter);</PRE
  45309. ></TD
  45310. ></TR
  45311. ></TABLE
  45312. ></DIV
  45313. ></TD
  45314. ></TR
  45315. ></TABLE
  45316. >
  45317.      toto bude v²stup:
  45318.      <DIV
  45319. CLASS="informalexample"
  45320. ><A
  45321. NAME="AEN8466"
  45322. ></A
  45323. ><P
  45324. ></P
  45325. ><TABLE
  45326. BORDER="0"
  45327. BGCOLOR="#E0E0E0"
  45328. CELLPADDING="5"
  45329. ><TR
  45330. ><TD
  45331. ><PRE
  45332. CLASS="programlisting"
  45333. >Array
  45334. (
  45335.     [1] => 'January'
  45336.     [2] => 'February'
  45337.     [3] => 'March'
  45338. )</PRE
  45339. ></TD
  45340. ></TR
  45341. ></TABLE
  45342. ><P
  45343. ></P
  45344. ></DIV
  45345. >
  45346.     </P
  45347. ><P
  45348. >      Viz takΘ: <A
  45349. HREF="#function.list"
  45350. ><B
  45351. CLASS="function"
  45352. >list()</B
  45353. ></A
  45354. >.
  45355.     </P
  45356. ></DIV
  45357. ><H1
  45358. ><A
  45359. NAME="function.arsort"
  45360. ></A
  45361. >arsort</H1
  45362. ><DIV
  45363. CLASS="refnamediv"
  45364. ><A
  45365. NAME="AEN8471"
  45366. ></A
  45367. ><P
  45368. >    (PHP 3, PHP 4 )</P
  45369. >arsort -- T°φdit pole sestupn∞ se zachovßnφm klφΦ∙
  45370.     </DIV
  45371. ><DIV
  45372. CLASS="refsect1"
  45373. ><A
  45374. NAME="AEN8474"
  45375. ></A
  45376. ><H2
  45377. >Popis</H2
  45378. >void <B
  45379. CLASS="methodname"
  45380. >arsort</B
  45381. > ( array array [, int sort_flags])<BR
  45382. ></BR
  45383. ><P
  45384. >      <B
  45385. CLASS="function"
  45386. >arsort()</B
  45387. > t°φdφ pole tak, ╛e indexy pole si zachovßvajφ
  45388.      korelace s prvky, se kter²mi jsou asociovßny. Toto je u╛iteΦnΘ hlavn∞ p°i
  45389.      t°φd∞nφ asociativnφch polφ, kde je po°adφ prvk∙ signifikantnφ.
  45390.      <TABLE
  45391. WIDTH="100%"
  45392. BORDER="0"
  45393. CELLPADDING="0"
  45394. CELLSPACING="0"
  45395. CLASS="EXAMPLE"
  45396. ><TR
  45397. ><TD
  45398. ><DIV
  45399. CLASS="example"
  45400. ><A
  45401. NAME="AEN8487"
  45402. ></A
  45403. ><P
  45404. ><B
  45405. >P°φklad 1. Ukßzka <B
  45406. CLASS="function"
  45407. >arsort()</B
  45408. ></B
  45409. ></P
  45410. ><TABLE
  45411. BORDER="0"
  45412. BGCOLOR="#E0E0E0"
  45413. CELLPADDING="5"
  45414. ><TR
  45415. ><TD
  45416. ><PRE
  45417. CLASS="php"
  45418. >$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
  45419. arsort ($fruits);
  45420. reset ($fruits);
  45421. while (list ($key, $val) = each ($fruits)) {
  45422.     echo "$key = $val\n";
  45423. }</PRE
  45424. ></TD
  45425. ></TR
  45426. ></TABLE
  45427. ></DIV
  45428. ></TD
  45429. ></TR
  45430. ></TABLE
  45431. >
  45432.     </P
  45433. ><P
  45434. >      Tato ukßzka zobrazφ:
  45435.     </P
  45436. ><P
  45437. >      <DIV
  45438. CLASS="informalexample"
  45439. ><A
  45440. NAME="AEN8493"
  45441. ></A
  45442. ><P
  45443. ></P
  45444. ><TABLE
  45445. BORDER="0"
  45446. BGCOLOR="#E0E0E0"
  45447. CELLPADDING="5"
  45448. ><TR
  45449. ><TD
  45450. ><PRE
  45451. CLASS="programlisting"
  45452. >fruits[a] = orange
  45453. fruits[d] = lemon
  45454. fruits[b] = banana
  45455. fruits[c] = apple</PRE
  45456. ></TD
  45457. ></TR
  45458. ></TABLE
  45459. ><P
  45460. ></P
  45461. ></DIV
  45462. >
  45463.     </P
  45464. ><P
  45465. >      Ovoce bylo sestupn∞ set°φd∞no podle abecedy, a indexy asociovanΘ s
  45466.      jednotliv²mi prvky byly zachovßny.
  45467.     </P
  45468. ><P
  45469. >      Chovßnφ t°φd∞nφ m∙╛ete upravit pomocφ volitelnΘho argumentu
  45470.      <TT
  45471. CLASS="parameter"
  45472. ><I
  45473. >sort_flags</I
  45474. ></TT
  45475. >, detaily viz <A
  45476. HREF="#function.sort"
  45477. ><B
  45478. CLASS="function"
  45479. >sort()</B
  45480. ></A
  45481. >.
  45482.     </P
  45483. ><P
  45484. >      Viz takΘ: <A
  45485. HREF="#function.asort"
  45486. ><B
  45487. CLASS="function"
  45488. >asort()</B
  45489. ></A
  45490. >,
  45491.      <A
  45492. HREF="#function.rsort"
  45493. ><B
  45494. CLASS="function"
  45495. >rsort()</B
  45496. ></A
  45497. >,
  45498.      <A
  45499. HREF="#function.ksort"
  45500. ><B
  45501. CLASS="function"
  45502. >ksort()</B
  45503. ></A
  45504. > a
  45505.      <A
  45506. HREF="#function.sort"
  45507. ><B
  45508. CLASS="function"
  45509. >sort()</B
  45510. ></A
  45511. >.
  45512.     </P
  45513. ></DIV
  45514. ><H1
  45515. ><A
  45516. NAME="function.asort"
  45517. ></A
  45518. >asort</H1
  45519. ><DIV
  45520. CLASS="refnamediv"
  45521. ><A
  45522. NAME="AEN8505"
  45523. ></A
  45524. ><P
  45525. >    (PHP 3, PHP 4 )</P
  45526. >asort -- T°φdit pole se zachovßnφm index∙</DIV
  45527. ><DIV
  45528. CLASS="refsect1"
  45529. ><A
  45530. NAME="AEN8508"
  45531. ></A
  45532. ><H2
  45533. >Popis</H2
  45534. >void <B
  45535. CLASS="methodname"
  45536. >asort</B
  45537. > ( array array [, int sort_flags])<BR
  45538. ></BR
  45539. ><P
  45540. >      <B
  45541. CLASS="function"
  45542. >asort()</B
  45543. > t°φdφ pole tak, ╛e si indexy zachovajφ corelace
  45544.      s prvky, se kter²mi jsou spojeny. To je u╛iteΦnΘ hlavn∞ p°i t°φd∞nφ
  45545.      asociativnφch polφ, u kter²ch je po°adφ prvk∙ signifikantnφ.
  45546.      <TABLE
  45547. WIDTH="100%"
  45548. BORDER="0"
  45549. CELLPADDING="0"
  45550. CELLSPACING="0"
  45551. CLASS="EXAMPLE"
  45552. ><TR
  45553. ><TD
  45554. ><DIV
  45555. CLASS="example"
  45556. ><A
  45557. NAME="AEN8521"
  45558. ></A
  45559. ><P
  45560. ><B
  45561. >P°φklad 1. Ukßzka <B
  45562. CLASS="function"
  45563. >asort()</B
  45564. ></B
  45565. ></P
  45566. ><TABLE
  45567. BORDER="0"
  45568. BGCOLOR="#E0E0E0"
  45569. CELLPADDING="5"
  45570. ><TR
  45571. ><TD
  45572. ><PRE
  45573. CLASS="php"
  45574. >$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
  45575. asort ($fruits);
  45576. reset ($fruits);
  45577. while (list ($key, $val) = each ($fruits)) {
  45578.     echo "$key = $val\n";
  45579. }</PRE
  45580. ></TD
  45581. ></TR
  45582. ></TABLE
  45583. ></DIV
  45584. ></TD
  45585. ></TR
  45586. ></TABLE
  45587. >
  45588.     </P
  45589. ><P
  45590. >      Tato ukßzka zobrazφ:
  45591.     </P
  45592. ><P
  45593. >      <DIV
  45594. CLASS="informalexample"
  45595. ><A
  45596. NAME="AEN8527"
  45597. ></A
  45598. ><P
  45599. ></P
  45600. ><TABLE
  45601. BORDER="0"
  45602. BGCOLOR="#E0E0E0"
  45603. CELLPADDING="5"
  45604. ><TR
  45605. ><TD
  45606. ><PRE
  45607. CLASS="programlisting"
  45608. >fruits[c] = apple
  45609. fruits[b] = banana
  45610. fruits[d] = lemon
  45611. fruits[a] = orange</PRE
  45612. ></TD
  45613. ></TR
  45614. ></TABLE
  45615. ><P
  45616. ></P
  45617. ></DIV
  45618. >
  45619.     </P
  45620. ><P
  45621. >      Ovoce bylo set°φd∞no podle abecedy a indexy spojenΘ s jednotliv²mi
  45622.      prvky byly zachovßny.
  45623.     </P
  45624. ><P
  45625. >      Chovßnφ t°φd∞nφ m∙╛ete upravit pomocφ volitelnΘho argumentu
  45626.      <TT
  45627. CLASS="parameter"
  45628. ><I
  45629. >sort_flags</I
  45630. ></TT
  45631. >, detaily viz <A
  45632. HREF="#function.sort"
  45633. ><B
  45634. CLASS="function"
  45635. >sort()</B
  45636. ></A
  45637. >.
  45638.     </P
  45639. ><P
  45640. >      Viz takΘ: <A
  45641. HREF="#function.arsort"
  45642. ><B
  45643. CLASS="function"
  45644. >arsort()</B
  45645. ></A
  45646. >,
  45647.      <A
  45648. HREF="#function.rsort"
  45649. ><B
  45650. CLASS="function"
  45651. >rsort()</B
  45652. ></A
  45653. >,
  45654.      <A
  45655. HREF="#function.ksort"
  45656. ><B
  45657. CLASS="function"
  45658. >ksort()</B
  45659. ></A
  45660. > a
  45661.      <A
  45662. HREF="#function.sort"
  45663. ><B
  45664. CLASS="function"
  45665. >sort()</B
  45666. ></A
  45667. >.
  45668.     </P
  45669. ></DIV
  45670. ><H1
  45671. ><A
  45672. NAME="function.compact"
  45673. ></A
  45674. >compact</H1
  45675. ><DIV
  45676. CLASS="refnamediv"
  45677. ><A
  45678. NAME="AEN8539"
  45679. ></A
  45680. ><P
  45681. >    (PHP 4 )</P
  45682. >compact -- Vytvo°it pole obsahujφcφ prom∞nnΘ a jejich hodnoty</DIV
  45683. ><DIV
  45684. CLASS="refsect1"
  45685. ><A
  45686. NAME="AEN8542"
  45687. ></A
  45688. ><H2
  45689. >Popis</H2
  45690. >array <B
  45691. CLASS="methodname"
  45692. >compact</B
  45693. > ( mixed varname [, mixed ...])<BR
  45694. ></BR
  45695. ><P
  45696. >      <B
  45697. CLASS="function"
  45698. >compact()</B
  45699. > p°ijφmß prom∞nn² poΦet argument∙. Ka╛d²
  45700.      argument m∙╛e b²t bu∩ °et∞zec obsahujφcφ nßzev prom∞nnΘ nebo pole nßzv∙
  45701.      prom∞nn²ch. Toto pole m∙╛e takΘ obsahovat pole nßzv∙ prom∞nn²ch∙;
  45702.      <B
  45703. CLASS="function"
  45704. >compact()</B
  45705. > je rekurzivn∞ zpracuje.
  45706.     </P
  45707. ><P
  45708. >      Pro ka╛d² z °et∞zc∙ <B
  45709. CLASS="function"
  45710. >compact()</B
  45711. > vyhledß v aktivnφ symbolovΘ
  45712.      tabulce prom∞nnou tohoto jmΘna a p°idß ji do v²slednΘho pole tak, ╛e nßzev
  45713.      tΘto prom∞nnΘ se stane klφΦem a obsah tΘto prom∞nnΘ hodnotou tohoto klφΦe.
  45714.      StruΦn∞ °eΦeno, d∞lß prav² opak toho, co <A
  45715. HREF="#function.extract"
  45716. ><B
  45717. CLASS="function"
  45718. >extract()</B
  45719. ></A
  45720. >.
  45721.      Vracφ pole obsahujφcφ v╣echny tyto prom∞nnΘ.
  45722.     </P
  45723. ><P
  45724. >      ╪et∞zce, kterΘ neobsahujφ nßzvy platn²ch prom∞nn²ch se p°eskoΦφ.
  45725.     </P
  45726. ><P
  45727. >      <TABLE
  45728. WIDTH="100%"
  45729. BORDER="0"
  45730. CELLPADDING="0"
  45731. CELLSPACING="0"
  45732. CLASS="EXAMPLE"
  45733. ><TR
  45734. ><TD
  45735. ><DIV
  45736. CLASS="example"
  45737. ><A
  45738. NAME="AEN8561"
  45739. ></A
  45740. ><P
  45741. ><B
  45742. >P°φklad 1. Ukßzka <B
  45743. CLASS="function"
  45744. >compact()</B
  45745. ></B
  45746. ></P
  45747. ><TABLE
  45748. BORDER="0"
  45749. BGCOLOR="#E0E0E0"
  45750. CELLPADDING="5"
  45751. ><TR
  45752. ><TD
  45753. ><PRE
  45754. CLASS="php"
  45755. >$city = "San Francisco";
  45756. $state = "CA";
  45757. $event = "SIGGRAPH";
  45758.  
  45759. $location_vars = array ("city", "state");
  45760.  
  45761. $result = compact ("event", "nothing_here", $location_vars);</PRE
  45762. ></TD
  45763. ></TR
  45764. ></TABLE
  45765. ><P
  45766. >        <TT
  45767. CLASS="varname"
  45768. >$result</TT
  45769. > bude <TT
  45770. CLASS="literal"
  45771. >array ("event"
  45772.        => "SIGGRAPH", "city" => "San Francisco", "state" => "CA")</TT
  45773. >.
  45774.       </P
  45775. ></DIV
  45776. ></TD
  45777. ></TR
  45778. ></TABLE
  45779. >
  45780.     </P
  45781. ><P
  45782. >      Viz takΘ: <A
  45783. HREF="#function.extract"
  45784. ><B
  45785. CLASS="function"
  45786. >extract()</B
  45787. ></A
  45788. >.
  45789.     </P
  45790. ></DIV
  45791. ><H1
  45792. ><A
  45793. NAME="function.count"
  45794. ></A
  45795. >count</H1
  45796. ><DIV
  45797. CLASS="refnamediv"
  45798. ><A
  45799. NAME="AEN8571"
  45800. ></A
  45801. ><P
  45802. >    (PHP 3, PHP 4 )</P
  45803. >count -- SpoΦφtat prvky v prom∞nnΘ</DIV
  45804. ><DIV
  45805. CLASS="refsect1"
  45806. ><A
  45807. NAME="AEN8574"
  45808. ></A
  45809. ><H2
  45810. >Popis</H2
  45811. >int <B
  45812. CLASS="methodname"
  45813. >count</B
  45814. > ( mixed var)<BR
  45815. ></BR
  45816. ><P
  45817. >      Vracφ poΦet prvk∙ v <TT
  45818. CLASS="parameter"
  45819. ><I
  45820. >var</I
  45821. ></TT
  45822. >, kterß je typicky pole
  45823.      (jeliko╛ v╣echno ostatnφ mß jeden prvek).
  45824.     </P
  45825. ><P
  45826. >      Vracφ <TT
  45827. CLASS="literal"
  45828. >1</TT
  45829. >, pokud <TT
  45830. CLASS="parameter"
  45831. ><I
  45832. >var</I
  45833. ></TT
  45834. > nenφ pole.
  45835.     </P
  45836. ><P
  45837. >      Vracφ <TT
  45838. CLASS="literal"
  45839. >0</TT
  45840. >, pokud <TT
  45841. CLASS="parameter"
  45842. ><I
  45843. >var</I
  45844. ></TT
  45845. > nenφ
  45846.      inicializovßna.
  45847.      <DIV
  45848. CLASS="warning"
  45849. ><P
  45850. ></P
  45851. ><TABLE
  45852. CLASS="warning"
  45853. BORDER="1"
  45854. WIDTH="100%"
  45855. ><TR
  45856. ><TD
  45857. ALIGN="CENTER"
  45858. ><B
  45859. >Varovßnφ</B
  45860. ></TD
  45861. ></TR
  45862. ><TR
  45863. ><TD
  45864. ALIGN="LEFT"
  45865. ><P
  45866. >        <B
  45867. CLASS="function"
  45868. >count()</B
  45869. > vracφ <TT
  45870. CLASS="literal"
  45871. >0</TT
  45872. > pro prom∞nnΘ,
  45873.        kterΘ nejsou inicializovßny, ale vracφ takΘ <TT
  45874. CLASS="literal"
  45875. >0</TT
  45876. > pro
  45877.        prom∞nnΘ, kterΘ obsahujφ prßzdnΘ pole. Pokud pot°ebujete zjistit, jestli
  45878.        dotyΦnß prom∞nnß existuje, pou╛ijte <A
  45879. HREF="#function.isset"
  45880. ><B
  45881. CLASS="function"
  45882. >isset()</B
  45883. ></A
  45884. >.
  45885.       </P
  45886. ></TD
  45887. ></TR
  45888. ></TABLE
  45889. ></DIV
  45890. >
  45891.     </P
  45892. ><P
  45893. >      <TABLE
  45894. WIDTH="100%"
  45895. BORDER="0"
  45896. CELLPADDING="0"
  45897. CELLSPACING="0"
  45898. CLASS="EXAMPLE"
  45899. ><TR
  45900. ><TD
  45901. ><DIV
  45902. CLASS="example"
  45903. ><A
  45904. NAME="AEN8597"
  45905. ></A
  45906. ><P
  45907. ><B
  45908. >P°φklad 1. Ukßzka <B
  45909. CLASS="function"
  45910. >count()</B
  45911. ></B
  45912. ></P
  45913. ><TABLE
  45914. BORDER="0"
  45915. BGCOLOR="#E0E0E0"
  45916. CELLPADDING="5"
  45917. ><TR
  45918. ><TD
  45919. ><PRE
  45920. CLASS="php"
  45921. >$a[0] = 1;
  45922. $a[1] = 3;
  45923. $a[2] = 5;
  45924. $result = count ($a);
  45925. //$result == 3</PRE
  45926. ></TD
  45927. ></TR
  45928. ></TABLE
  45929. ></DIV
  45930. ></TD
  45931. ></TR
  45932. ></TABLE
  45933. >
  45934.     </P
  45935. ><P
  45936. >      Viz takΘ: <A
  45937. HREF="#function.sizeof"
  45938. ><B
  45939. CLASS="function"
  45940. >sizeof()</B
  45941. ></A
  45942. >,
  45943.      <A
  45944. HREF="#function.isset"
  45945. ><B
  45946. CLASS="function"
  45947. >isset()</B
  45948. ></A
  45949. > a
  45950.      <A
  45951. HREF="#function.is-array"
  45952. ><B
  45953. CLASS="function"
  45954. >is_array()</B
  45955. ></A
  45956. >.
  45957.     </P
  45958. ></DIV
  45959. ><H1
  45960. ><A
  45961. NAME="function.current"
  45962. ></A
  45963. >current</H1
  45964. ><DIV
  45965. CLASS="refnamediv"
  45966. ><A
  45967. NAME="AEN8606"
  45968. ></A
  45969. ><P
  45970. >    (PHP 3, PHP 4 )</P
  45971. >current -- Vrßtit souΦasn² prvek pole</DIV
  45972. ><DIV
  45973. CLASS="refsect1"
  45974. ><A
  45975. NAME="AEN8609"
  45976. ></A
  45977. ><H2
  45978. >Popis</H2
  45979. >mixed <B
  45980. CLASS="methodname"
  45981. >current</B
  45982. > ( array array)<BR
  45983. ></BR
  45984. ><P
  45985. >      Ka╛dΘ pole mß vnit°nφ ukazatel na jeho "souΦasny" prvek, kter² se
  45986.      inicializuje  na prvnφ prvek vlo╛en² do tohoto pole.
  45987.     </P
  45988. ><P
  45989. >      <B
  45990. CLASS="function"
  45991. >current()</B
  45992. > vracφ prvek, na kter² tento internφ ukazatel
  45993.      prßv∞ ukazuje. Nijak tento ukazatel nem∞nφ. Pokud teto vnit°nφ ukazatel
  45994.      ukazuje za konec seznamu prvk∙, <B
  45995. CLASS="function"
  45996. >current()</B
  45997. > returns
  45998.      <TT
  45999. CLASS="constant"
  46000. ><B
  46001. >FALSE</B
  46002. ></TT
  46003. >.
  46004.      <DIV
  46005. CLASS="warning"
  46006. ><P
  46007. ></P
  46008. ><TABLE
  46009. CLASS="warning"
  46010. BORDER="1"
  46011. WIDTH="100%"
  46012. ><TR
  46013. ><TD
  46014. ALIGN="CENTER"
  46015. ><B
  46016. >Varovßnφ</B
  46017. ></TD
  46018. ></TR
  46019. ><TR
  46020. ><TD
  46021. ALIGN="LEFT"
  46022. ><P
  46023. >        Pokud toto pole obsahuje prßzdnΘ prvky (0 nebo "", prßzdn² °et∞zec), tato
  46024.        funkce pro tyto prvky takΘ vrßtφ <TT
  46025. CLASS="constant"
  46026. ><B
  46027. >FALSE</B
  46028. ></TT
  46029. >. Je proto
  46030.        nemo╛nΘ urΦit pomocφ <B
  46031. CLASS="function"
  46032. >current()</B
  46033. >, jestli jste opravdu na
  46034.        konci pole.
  46035.        To properly traverse an array that may contain empty elements, use the
  46036.        <A
  46037. HREF="#function.each"
  46038. ><B
  46039. CLASS="function"
  46040. >each()</B
  46041. ></A
  46042. > function.
  46043.       </P
  46044. ></TD
  46045. ></TR
  46046. ></TABLE
  46047. ></DIV
  46048. >
  46049.     </P
  46050. ><P
  46051. >      Viz takΘ: <A
  46052. HREF="#function.end"
  46053. ><B
  46054. CLASS="function"
  46055. >end()</B
  46056. ></A
  46057. >,
  46058.      <A
  46059. HREF="#function.next"
  46060. ><B
  46061. CLASS="function"
  46062. >next()</B
  46063. ></A
  46064. >,
  46065.      <A
  46066. HREF="#function.prev"
  46067. ><B
  46068. CLASS="function"
  46069. >prev()</B
  46070. ></A
  46071. > a
  46072.      <A
  46073. HREF="#function.reset"
  46074. ><B
  46075. CLASS="function"
  46076. >reset()</B
  46077. ></A
  46078. >.
  46079.     </P
  46080. ></DIV
  46081. ><H1
  46082. ><A
  46083. NAME="function.each"
  46084. ></A
  46085. >each</H1
  46086. ><DIV
  46087. CLASS="refnamediv"
  46088. ><A
  46089. NAME="AEN8633"
  46090. ></A
  46091. ><P
  46092. >    (PHP 3, PHP 4 )</P
  46093. >each -- 
  46094.      Vracφ dal╣φ klφΦ/hodnota pßr z pole
  46095.     </DIV
  46096. ><DIV
  46097. CLASS="refsect1"
  46098. ><A
  46099. NAME="AEN8636"
  46100. ></A
  46101. ><H2
  46102. >Popis</H2
  46103. >array <B
  46104. CLASS="methodname"
  46105. >each</B
  46106. > ( array array)<BR
  46107. ></BR
  46108. ><P
  46109. >      Vracφ souΦasn² klφΦ/hodnota pßr z pole <TT
  46110. CLASS="parameter"
  46111. ><I
  46112. >array</I
  46113. ></TT
  46114. > a posune
  46115.      internφ ukazatel pole. Tento pßr se vracφ jako pole Φty° prvk∙ s klφΦi
  46116.      <SPAN
  46117. CLASS="emphasis"
  46118. ><I
  46119. CLASS="emphasis"
  46120. >0</I
  46121. ></SPAN
  46122. >, <SPAN
  46123. CLASS="emphasis"
  46124. ><I
  46125. CLASS="emphasis"
  46126. >1</I
  46127. ></SPAN
  46128. >,
  46129.      <SPAN
  46130. CLASS="emphasis"
  46131. ><I
  46132. CLASS="emphasis"
  46133. >key</I
  46134. ></SPAN
  46135. > a
  46136.      <SPAN
  46137. CLASS="emphasis"
  46138. ><I
  46139. CLASS="emphasis"
  46140. >value</I
  46141. ></SPAN
  46142. >. Prvky <SPAN
  46143. CLASS="emphasis"
  46144. ><I
  46145. CLASS="emphasis"
  46146. >0</I
  46147. ></SPAN
  46148. > a
  46149.      <SPAN
  46150. CLASS="emphasis"
  46151. ><I
  46152. CLASS="emphasis"
  46153. >key</I
  46154. ></SPAN
  46155. > obsahujφ nßzev klφΦe tohoto prvku pole a
  46156.      <SPAN
  46157. CLASS="emphasis"
  46158. ><I
  46159. CLASS="emphasis"
  46160. >1</I
  46161. ></SPAN
  46162. > a <SPAN
  46163. CLASS="emphasis"
  46164. ><I
  46165. CLASS="emphasis"
  46166. >value</I
  46167. ></SPAN
  46168. > obsahujφ hodnotu.
  46169.     </P
  46170. ><P
  46171. >      Pokud internφ ukazatel pole ukazuje za konec tohoto pole,
  46172.      <B
  46173. CLASS="function"
  46174. >each()</B
  46175. > vracφ <TT
  46176. CLASS="constant"
  46177. ><B
  46178. >FALSE</B
  46179. ></TT
  46180. >.
  46181.     </P
  46182. ><P
  46183. >      <TABLE
  46184. WIDTH="100%"
  46185. BORDER="0"
  46186. CELLPADDING="0"
  46187. CELLSPACING="0"
  46188. CLASS="EXAMPLE"
  46189. ><TR
  46190. ><TD
  46191. ><DIV
  46192. CLASS="example"
  46193. ><A
  46194. NAME="AEN8658"
  46195. ></A
  46196. ><P
  46197. ><B
  46198. >P°φklad 1. Ukßzky <B
  46199. CLASS="function"
  46200. >each()</B
  46201. ></B
  46202. ></P
  46203. ><TABLE
  46204. BORDER="0"
  46205. BGCOLOR="#E0E0E0"
  46206. CELLPADDING="5"
  46207. ><TR
  46208. ><TD
  46209. ><PRE
  46210. CLASS="php"
  46211. >$foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese");
  46212. $bar = each ($foo);</PRE
  46213. ></TD
  46214. ></TR
  46215. ></TABLE
  46216. ><P
  46217. >        <TT
  46218. CLASS="varname"
  46219. >$bar</TT
  46220. > te∩ obsahuje nßsledujφcφ klφΦ/hodnota pßry:
  46221.        <P
  46222. ></P
  46223. ><UL
  46224. COMPACT="COMPACT"
  46225. ><LI
  46226. ><SPAN
  46227. >0 => 0</SPAN
  46228. ></LI
  46229. ><LI
  46230. ><SPAN
  46231. >1 => 'bob'</SPAN
  46232. ></LI
  46233. ><LI
  46234. ><SPAN
  46235. >key => 0</SPAN
  46236. ></LI
  46237. ><LI
  46238. ><SPAN
  46239. >value => 'bob'</SPAN
  46240. ></LI
  46241. ></UL
  46242. >
  46243.        <TABLE
  46244. BORDER="0"
  46245. BGCOLOR="#E0E0E0"
  46246. CELLPADDING="5"
  46247. ><TR
  46248. ><TD
  46249. ><PRE
  46250. CLASS="php"
  46251. >$foo = array ("Robert" => "Bob", "Seppo" => "Sepi");
  46252. $bar = each ($foo);</PRE
  46253. ></TD
  46254. ></TR
  46255. ></TABLE
  46256. >
  46257.       </P
  46258. ><P
  46259. >        <TT
  46260. CLASS="varname"
  46261. >$bar</TT
  46262. > te∩ obsahuje nßsledujφcφ klφΦ/hodnota pßry:
  46263.        <P
  46264. ></P
  46265. ><UL
  46266. COMPACT="COMPACT"
  46267. ><LI
  46268. ><SPAN
  46269. >0 => 'Robert'</SPAN
  46270. ></LI
  46271. ><LI
  46272. ><SPAN
  46273. >1 => 'Bob'</SPAN
  46274. ></LI
  46275. ><LI
  46276. ><SPAN
  46277. >key => 'Robert'</SPAN
  46278. ></LI
  46279. ><LI
  46280. ><SPAN
  46281. >value => 'Bob'</SPAN
  46282. ></LI
  46283. ></UL
  46284. >
  46285.       </P
  46286. ></DIV
  46287. ></TD
  46288. ></TR
  46289. ></TABLE
  46290. >
  46291.     </P
  46292. ><P
  46293. >      <B
  46294. CLASS="function"
  46295. >each()</B
  46296. > se v∞t╣inou pou╛φva s
  46297.      <A
  46298. HREF="#function.list"
  46299. ><B
  46300. CLASS="function"
  46301. >list()</B
  46302. ></A
  46303. > k pr∙chodu polem, nap°.
  46304.      <TT
  46305. CLASS="varname"
  46306. >$HTTP_POST_VARS</TT
  46307. >:
  46308.      <TABLE
  46309. WIDTH="100%"
  46310. BORDER="0"
  46311. CELLPADDING="0"
  46312. CELLSPACING="0"
  46313. CLASS="EXAMPLE"
  46314. ><TR
  46315. ><TD
  46316. ><DIV
  46317. CLASS="example"
  46318. ><A
  46319. NAME="AEN8689"
  46320. ></A
  46321. ><P
  46322. ><B
  46323. >P°φklad 2. 
  46324.        Pr∙chod <TT
  46325. CLASS="varname"
  46326. >$HTTP_POST_VARS</TT
  46327. > pomocφ
  46328.        <B
  46329. CLASS="function"
  46330. >each()</B
  46331. >
  46332.       </B
  46333. ></P
  46334. ><TABLE
  46335. BORDER="0"
  46336. BGCOLOR="#E0E0E0"
  46337. CELLPADDING="5"
  46338. ><TR
  46339. ><TD
  46340. ><PRE
  46341. CLASS="php"
  46342. >echo "Hodnoty odeslanΘ metodou POST:<br>";
  46343. reset ($HTTP_POST_VARS);
  46344. while (list ($key, $val) = each ($HTTP_POST_VARS)) {
  46345.     echo "$key => $val<br>";
  46346. }</PRE
  46347. ></TD
  46348. ></TR
  46349. ></TABLE
  46350. ></DIV
  46351. ></TD
  46352. ></TR
  46353. ></TABLE
  46354. >
  46355.     </P
  46356. ><P
  46357. >      PotΘ, co prob∞hne <B
  46358. CLASS="function"
  46359. >each()</B
  46360. >, se internφ ukazatel pole posune
  46361.      na dal╣φ prvek pole nebo z∙stane na poslednφm prvku pole, pokud dojde na
  46362.      konec.
  46363.     </P
  46364. ><P
  46365. >      Viz takΘ: <A
  46366. HREF="#function.key"
  46367. ><B
  46368. CLASS="function"
  46369. >key()</B
  46370. ></A
  46371. >,
  46372.      <A
  46373. HREF="#function.list"
  46374. ><B
  46375. CLASS="function"
  46376. >list()</B
  46377. ></A
  46378. >,
  46379.      <A
  46380. HREF="#function.current"
  46381. ><B
  46382. CLASS="function"
  46383. >current()</B
  46384. ></A
  46385. >,
  46386.      <A
  46387. HREF="#function.reset"
  46388. ><B
  46389. CLASS="function"
  46390. >reset()</B
  46391. ></A
  46392. >,
  46393.      <A
  46394. HREF="#function.next"
  46395. ><B
  46396. CLASS="function"
  46397. >next()</B
  46398. ></A
  46399. > a
  46400.      <A
  46401. HREF="#function.prev"
  46402. ><B
  46403. CLASS="function"
  46404. >prev()</B
  46405. ></A
  46406. >.
  46407.     </P
  46408. ></DIV
  46409. ><H1
  46410. ><A
  46411. NAME="function.end"
  46412. ></A
  46413. >end</H1
  46414. ><DIV
  46415. CLASS="refnamediv"
  46416. ><A
  46417. NAME="AEN8704"
  46418. ></A
  46419. ><P
  46420. >    (PHP 3, PHP 4 )</P
  46421. >end -- 
  46422.      Nastavit vnit°nφ ukazatel pole na jeho poslednφ prvek
  46423.     </DIV
  46424. ><DIV
  46425. CLASS="refsect1"
  46426. ><A
  46427. NAME="AEN8707"
  46428. ></A
  46429. ><H2
  46430. >Popis</H2
  46431. >mixed <B
  46432. CLASS="methodname"
  46433. >end</B
  46434. > ( array array)<BR
  46435. ></BR
  46436. ><P
  46437. >      <B
  46438. CLASS="function"
  46439. >end()</B
  46440. > posune vnit°nφ ukazatel pole
  46441.      <TT
  46442. CLASS="parameter"
  46443. ><I
  46444. >array</I
  46445. ></TT
  46446. > na jeho poslednφ prvek a vracφ tento prvek.
  46447.     </P
  46448. ><P
  46449. >      Viz takΘ: <A
  46450. HREF="#function.current"
  46451. ><B
  46452. CLASS="function"
  46453. >current()</B
  46454. ></A
  46455. >,
  46456.      <A
  46457. HREF="#function.each"
  46458. ><B
  46459. CLASS="function"
  46460. >each()</B
  46461. ></A
  46462. >,
  46463.      <B
  46464. CLASS="function"
  46465. >end()</B
  46466. >,
  46467.      <A
  46468. HREF="#function.next"
  46469. ><B
  46470. CLASS="function"
  46471. >next()</B
  46472. ></A
  46473. > a
  46474.      <A
  46475. HREF="#function.reset"
  46476. ><B
  46477. CLASS="function"
  46478. >reset()</B
  46479. ></A
  46480. >.
  46481.     </P
  46482. ></DIV
  46483. ><H1
  46484. ><A
  46485. NAME="function.extract"
  46486. ></A
  46487. >extract</H1
  46488. ><DIV
  46489. CLASS="refnamediv"
  46490. ><A
  46491. NAME="AEN8725"
  46492. ></A
  46493. ><P
  46494. >    (PHP 3>= 3.0.7, PHP 4 )</P
  46495. >extract -- Importovat prom∞nnΘ z pole do symbolovΘ tabulky</DIV
  46496. ><DIV
  46497. CLASS="refsect1"
  46498. ><A
  46499. NAME="AEN8728"
  46500. ></A
  46501. ><H2
  46502. >Popis</H2
  46503. >int <B
  46504. CLASS="methodname"
  46505. >extract</B
  46506. > ( array var_array [, int extract_type [, string prefix]])<BR
  46507. ></BR
  46508. ><P
  46509. >      Tato funkce se pou╛φvß k importu prom∞nn²ch z pole do aktivnφ symbolovΘ
  46510.      tabulky. P°ijφmß pole <TT
  46511. CLASS="parameter"
  46512. ><I
  46513. >var_array</I
  46514. ></TT
  46515. >; z klφΦ∙ vytvß°φ
  46516.      nßzvy prom∞nn²ch a z hodnot hodnoty t∞chto prom∞nn²ch. Vytvß°φ jednu
  46517.      prom∞nnou z ka╛dΘho klφΦ/hodnota pßru (s ohledem na argumenty
  46518.      <TT
  46519. CLASS="parameter"
  46520. ><I
  46521. >extract_type</I
  46522. ></TT
  46523. > a <TT
  46524. CLASS="parameter"
  46525. ><I
  46526. >prefix</I
  46527. ></TT
  46528. >).
  46529.     </P
  46530. ><DIV
  46531. CLASS="note"
  46532. ><BLOCKQUOTE
  46533. CLASS="note"
  46534. ><P
  46535. ><B
  46536. >Poznßmka: </B
  46537. >
  46538.       Od PHP 4.0.5 tato funkce vracφ poΦet extrahovan²ch prom∞nn²ch.
  46539.      </P
  46540. ></BLOCKQUOTE
  46541. ></DIV
  46542. ><P
  46543. >      <B
  46544. CLASS="function"
  46545. >extract()</B
  46546. > ov∞°uje, jestli v╣echny klφΦe tvo°φ platnΘ
  46547.      nßzvy prom∞nn²ch, a takΘ jestli nekolidujφ s prom∞nn²mi existujφcφmi v
  46548.      aktivnφ symbolovΘ tabulce. Zp∙sob, jak²m se naklßdß s neplatn²mi/numerick²mi
  46549.      klφΦi a kolizemi zßvisφ na <TT
  46550. CLASS="parameter"
  46551. ><I
  46552. >extract_type</I
  46553. ></TT
  46554. >. Ten m∙╛e
  46555.      mφt jednu z nßsledujφcφch hodnot.
  46556.      <P
  46557. ></P
  46558. ><DIV
  46559. CLASS="variablelist"
  46560. ><DL
  46561. ><DT
  46562. >EXTR_OVERWRITE</DT
  46563. ><DD
  46564. ><P
  46565. >          Pokud existuje kolize, p°epsat existujφcφ prom∞nnou.
  46566.         </P
  46567. ></DD
  46568. ><DT
  46569. >EXTR_SKIP</DT
  46570. ><DD
  46571. ><P
  46572. >          Pokud existuje kolize, nep°epsat existujφcφ prom∞nnou.
  46573.         </P
  46574. ></DD
  46575. ><DT
  46576. >EXTR_PREFIX_SAME</DT
  46577. ><DD
  46578. ><P
  46579. >          Pokud existuje kolize, p°ed°adit p°ed nßzev novΘ prom∞nnΘ
  46580.         <TT
  46581. CLASS="parameter"
  46582. ><I
  46583. >prefix</I
  46584. ></TT
  46585. >.
  46586.         </P
  46587. ></DD
  46588. ><DT
  46589. >EXTR_PREFIX_ALL</DT
  46590. ><DD
  46591. ><P
  46592. >          Opat°it prefixem <TT
  46593. CLASS="parameter"
  46594. ><I
  46595. >prefix</I
  46596. ></TT
  46597. > v╣echny nßzvy prom∞nn²ch.
  46598.          Od PHP 4.0.5 toto zahrnuje i ΦφselnΘ indexy.
  46599.         </P
  46600. ></DD
  46601. ><DT
  46602. >EXTR_PREFIX_INVALID</DT
  46603. ><DD
  46604. ><P
  46605. >          Prefixem <TT
  46606. CLASS="parameter"
  46607. ><I
  46608. >prefix</I
  46609. ></TT
  46610. > opat°it pouze neplatnΘ/ΦφselnΘ
  46611.          nßzvy prom∞nn²ch. Tento p°φznak byl p°idßn v PHP 4.0.5.
  46612.         </P
  46613. ></DD
  46614. ></DL
  46615. ></DIV
  46616. >
  46617.     </P
  46618. ><P
  46619. >      Defaultnφ <TT
  46620. CLASS="parameter"
  46621. ><I
  46622. >extract_type</I
  46623. ></TT
  46624. > je EXTR_OVERWRITE.
  46625.     </P
  46626. ><P
  46627. >      Pozn.: <TT
  46628. CLASS="parameter"
  46629. ><I
  46630. >prefix</I
  46631. ></TT
  46632. > se vy╛aduje pouze pokud je
  46633.      <TT
  46634. CLASS="parameter"
  46635. ><I
  46636. >extract_type</I
  46637. ></TT
  46638. > EXTR_PREFIX_SAME, EXTR_PREFIX_ALL nebo
  46639.      EXTR_PREFIX_INVALID. Pokud v²sledn² nßzev (vΦ. prefixu) nenφ platn² nßzev
  46640.      prom∞nnΘ, nenaimportuje se do symbolovΘ tabulky.
  46641.     </P
  46642. ><P
  46643. >      <B
  46644. CLASS="function"
  46645. >extract()</B
  46646. > vracφ poΦet prom∞nn²ch ·sp∞╣n∞ naimportovan²ch
  46647.      do symbolovΘ tabulky.
  46648.     </P
  46649. ><P
  46650. >      Mo╛nΘ vyu╛itφ <B
  46651. CLASS="function"
  46652. >extract()</B
  46653. > je import prom∞nn²ch do
  46654.      symbolovΘ tabulky z asociativnφho pole vrßcenΘho
  46655.      <A
  46656. HREF="#function.wddx-deserialize"
  46657. ><B
  46658. CLASS="function"
  46659. >wddx_deserialize()</B
  46660. ></A
  46661. >.
  46662.     </P
  46663. ><P
  46664. >      <TABLE
  46665. WIDTH="100%"
  46666. BORDER="0"
  46667. CELLPADDING="0"
  46668. CELLSPACING="0"
  46669. CLASS="EXAMPLE"
  46670. ><TR
  46671. ><TD
  46672. ><DIV
  46673. CLASS="example"
  46674. ><A
  46675. NAME="AEN8786"
  46676. ></A
  46677. ><P
  46678. ><B
  46679. >P°φklad 1. Ukßzka <B
  46680. CLASS="function"
  46681. >extract()</B
  46682. ></B
  46683. ></P
  46684. ><TABLE
  46685. BORDER="0"
  46686. BGCOLOR="#E0E0E0"
  46687. CELLPADDING="5"
  46688. ><TR
  46689. ><TD
  46690. ><PRE
  46691. CLASS="php"
  46692. ><?php
  46693.  
  46694. /* P°edpoklßdejme, ╛e $var_array je pole vrßcenΘ
  46695.    z wddx_deserialize */
  46696.  
  46697. $size = "large";
  46698. $var_array = array ("color" => "blue",
  46699.                     "size"  => "medium",
  46700.                     "shape" => "sphere");
  46701. extract ($var_array, EXTR_PREFIX_SAME, "wddx");
  46702.  
  46703. print "$color, $size, $shape, $wddx_size\n";
  46704.  
  46705. ?></PRE
  46706. ></TD
  46707. ></TR
  46708. ></TABLE
  46709. ></DIV
  46710. ></TD
  46711. ></TR
  46712. ></TABLE
  46713. >
  46714.     </P
  46715. ><P
  46716. >      V²╣e uvedenß ukßzka vytiskne:
  46717.      <TABLE
  46718. BORDER="0"
  46719. BGCOLOR="#E0E0E0"
  46720. CELLPADDING="5"
  46721. ><TR
  46722. ><TD
  46723. ><PRE
  46724. CLASS="programlisting"
  46725. >blue, large, sphere, medium</PRE
  46726. ></TD
  46727. ></TR
  46728. ></TABLE
  46729. >
  46730.     </P
  46731. ><P
  46732. >      <TT
  46733. CLASS="varname"
  46734. >$size</TT
  46735. > se nep°epsala, proto╛e bylo specifikovßno
  46736.      EXTR_PREFIX_SAME, tudφ╛ se vytvo°ila prom∞nnß <TT
  46737. CLASS="varname"
  46738. >$wddx_size</TT
  46739. >.
  46740.      Pokud by bylo zadßno EXTR_SKIP, nevytvo°ila by se ani
  46741.      <TT
  46742. CLASS="varname"
  46743. >$wddx_size</TT
  46744. >.
  46745.      EXTR_OVERWRITE by zp∙sobilo p°epsßnφ hodnoty <TT
  46746. CLASS="varname"
  46747. >$size</TT
  46748. > na
  46749.      "medium", a EXTR_PREFIX_ALL by vytvo°ilo novΘ prom∞nnΘ pojmenovanΘ
  46750.      <TT
  46751. CLASS="varname"
  46752. >$wddx_color</TT
  46753. >,
  46754.      <TT
  46755. CLASS="varname"
  46756. >$wddx_size</TT
  46757. > a
  46758.      <TT
  46759. CLASS="varname"
  46760. >$wddx_shape</TT
  46761. >.
  46762.     </P
  46763. ><P
  46764. >      U PHP verzφ ni╛╣φch ne╛ 4.0.5 musφte pou╛φt asociativnφ pole.
  46765.     </P
  46766. ><P
  46767. >      Viz takΘ: <A
  46768. HREF="#function.compact"
  46769. ><B
  46770. CLASS="function"
  46771. >compact()</B
  46772. ></A
  46773. >.
  46774.     </P
  46775. ></DIV
  46776. ><H1
  46777. ><A
  46778. NAME="function.in-array"
  46779. ></A
  46780. >in_array</H1
  46781. ><DIV
  46782. CLASS="refnamediv"
  46783. ><A
  46784. NAME="AEN8804"
  46785. ></A
  46786. ><P
  46787. >    (PHP 4 )</P
  46788. >in_array -- Vrßtit <TT
  46789. CLASS="constant"
  46790. ><B
  46791. >TRUE</B
  46792. ></TT
  46793. >, pokud v poli existuje danß hodnota</DIV
  46794. ><DIV
  46795. CLASS="refsect1"
  46796. ><A
  46797. NAME="AEN8808"
  46798. ></A
  46799. ><H2
  46800. >Popis</H2
  46801. >bool <B
  46802. CLASS="methodname"
  46803. >in_array</B
  46804. > ( mixed needle, array haystack, bool strict)<BR
  46805. ></BR
  46806. ><P
  46807. >      Hledß v <TT
  46808. CLASS="parameter"
  46809. ><I
  46810. >haystack</I
  46811. ></TT
  46812. > <TT
  46813. CLASS="parameter"
  46814. ><I
  46815. >needle</I
  46816. ></TT
  46817. >
  46818.      a pokud ji najde, vracφ <TT
  46819. CLASS="constant"
  46820. ><B
  46821. >TRUE</B
  46822. ></TT
  46823. >, jinak
  46824.      <TT
  46825. CLASS="constant"
  46826. ><B
  46827. >FALSE</B
  46828. ></TT
  46829. >.
  46830.     </P
  46831. ><P
  46832. >      Pokud je t°etφ argument <TT
  46833. CLASS="parameter"
  46834. ><I
  46835. >strict</I
  46836. ></TT
  46837. > <TT
  46838. CLASS="constant"
  46839. ><B
  46840. >TRUE</B
  46841. ></TT
  46842. >,
  46843.      <B
  46844. CLASS="function"
  46845. >in_array()</B
  46846. > takΘ kontroluje typ <TT
  46847. CLASS="parameter"
  46848. ><I
  46849. >needle</I
  46850. ></TT
  46851. >
  46852.      v <TT
  46853. CLASS="parameter"
  46854. ><I
  46855. >haystack</I
  46856. ></TT
  46857. >.
  46858.     </P
  46859. ><P
  46860. >      <TABLE
  46861. WIDTH="100%"
  46862. BORDER="0"
  46863. CELLPADDING="0"
  46864. CELLSPACING="0"
  46865. CLASS="EXAMPLE"
  46866. ><TR
  46867. ><TD
  46868. ><DIV
  46869. CLASS="example"
  46870. ><A
  46871. NAME="AEN8834"
  46872. ></A
  46873. ><P
  46874. ><B
  46875. >P°φklad 1. Ukßzka <B
  46876. CLASS="function"
  46877. >in_array()</B
  46878. ></B
  46879. ></P
  46880. ><TABLE
  46881. BORDER="0"
  46882. BGCOLOR="#E0E0E0"
  46883. CELLPADDING="5"
  46884. ><TR
  46885. ><TD
  46886. ><PRE
  46887. CLASS="php"
  46888. >$os = array ("Mac", "NT", "Irix", "Linux");
  46889. if (in_array ("Irix", $os)){
  46890.     print "Got Irix";
  46891.     }</PRE
  46892. ></TD
  46893. ></TR
  46894. ></TABLE
  46895. ></DIV
  46896. ></TD
  46897. ></TR
  46898. ></TABLE
  46899. >
  46900.     </P
  46901. ><P
  46902. >      <TABLE
  46903. WIDTH="100%"
  46904. BORDER="0"
  46905. CELLPADDING="0"
  46906. CELLSPACING="0"
  46907. CLASS="EXAMPLE"
  46908. ><TR
  46909. ><TD
  46910. ><DIV
  46911. CLASS="example"
  46912. ><A
  46913. NAME="AEN8839"
  46914. ></A
  46915. ><P
  46916. ><B
  46917. >P°φklad 2. Ukßzka <B
  46918. CLASS="function"
  46919. >in_array()</B
  46920. > s argumentem <TT
  46921. CLASS="parameter"
  46922. ><I
  46923. >strict</I
  46924. ></TT
  46925. ></B
  46926. ></P
  46927. ><TABLE
  46928. BORDER="0"
  46929. BGCOLOR="#E0E0E0"
  46930. CELLPADDING="5"
  46931. ><TR
  46932. ><TD
  46933. ><PRE
  46934. CLASS="php"
  46935. >// V²stup bude:
  46936.  
  46937. 1.13 found with strict check</PRE
  46938. ></TD
  46939. ></TR
  46940. ></TABLE
  46941. ></DIV
  46942. ></TD
  46943. ></TR
  46944. ></TABLE
  46945. >
  46946.     </P
  46947. ></DIV
  46948. ><H1
  46949. ><A
  46950. NAME="function.key"
  46951. ></A
  46952. >key</H1
  46953. ><DIV
  46954. CLASS="refnamediv"
  46955. ><A
  46956. NAME="AEN8845"
  46957. ></A
  46958. ><P
  46959. >    (PHP 3, PHP 4 )</P
  46960. >key -- Fetch a key from an associative array</DIV
  46961. ><DIV
  46962. CLASS="refsect1"
  46963. ><A
  46964. NAME="AEN8848"
  46965. ></A
  46966. ><H2
  46967. >Popis</H2
  46968. >mixed <B
  46969. CLASS="methodname"
  46970. >key</B
  46971. > ( array array)<BR
  46972. ></BR
  46973. ><P
  46974. >      <B
  46975. CLASS="function"
  46976. >key()</B
  46977. > vracφ index souΦasnΘho prvku pole.
  46978.     </P
  46979. ><P
  46980. >      Viz takΘ: <A
  46981. HREF="#function.current"
  46982. ><B
  46983. CLASS="function"
  46984. >current()</B
  46985. ></A
  46986. > a
  46987.      <A
  46988. HREF="#function.next"
  46989. ><B
  46990. CLASS="function"
  46991. >next()</B
  46992. ></A
  46993. >.
  46994.     </P
  46995. ></DIV
  46996. ><H1
  46997. ><A
  46998. NAME="function.krsort"
  46999. ></A
  47000. >krsort</H1
  47001. ><DIV
  47002. CLASS="refnamediv"
  47003. ><A
  47004. NAME="AEN8862"
  47005. ></A
  47006. ><P
  47007. >    (PHP 3>= 3.0.13, PHP 4 )</P
  47008. >krsort -- T°φdit pole sestupn∞ podle klφΦ∙</DIV
  47009. ><DIV
  47010. CLASS="refsect1"
  47011. ><A
  47012. NAME="AEN8865"
  47013. ></A
  47014. ><H2
  47015. >Popis</H2
  47016. >int <B
  47017. CLASS="methodname"
  47018. >krsort</B
  47019. > ( array array [, int sort_flags])<BR
  47020. ></BR
  47021. ><P
  47022. >      T°φdφ pole sestupn∞ podle klφΦ∙ se zachovßnφ asociacφ index∙. To je
  47023.      u╛iteΦnΘ hlavn∞ p°i prßci s asociativnφmi poli.
  47024.      <TABLE
  47025. WIDTH="100%"
  47026. BORDER="0"
  47027. CELLPADDING="0"
  47028. CELLSPACING="0"
  47029. CLASS="EXAMPLE"
  47030. ><TR
  47031. ><TD
  47032. ><DIV
  47033. CLASS="example"
  47034. ><A
  47035. NAME="AEN8877"
  47036. ></A
  47037. ><P
  47038. ><B
  47039. >P°φklad 1. <B
  47040. CLASS="function"
  47041. >krsort()</B
  47042. > example</B
  47043. ></P
  47044. ><TABLE
  47045. BORDER="0"
  47046. BGCOLOR="#E0E0E0"
  47047. CELLPADDING="5"
  47048. ><TR
  47049. ><TD
  47050. ><PRE
  47051. CLASS="php"
  47052. >$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
  47053. krsort ($fruits);
  47054. reset ($fruits);
  47055. while (list ($key, $val) = each ($fruits)) {
  47056.     echo "$key -> $val\n";
  47057. }</PRE
  47058. ></TD
  47059. ></TR
  47060. ></TABLE
  47061. ></DIV
  47062. ></TD
  47063. ></TR
  47064. ></TABLE
  47065. >
  47066.     </P
  47067. ><P
  47068. >      Tato ukßzka vytiskne:
  47069.     </P
  47070. ><P
  47071. >      <DIV
  47072. CLASS="informalexample"
  47073. ><A
  47074. NAME="AEN8883"
  47075. ></A
  47076. ><P
  47077. ></P
  47078. ><TABLE
  47079. BORDER="0"
  47080. BGCOLOR="#E0E0E0"
  47081. CELLPADDING="5"
  47082. ><TR
  47083. ><TD
  47084. ><PRE
  47085. CLASS="programlisting"
  47086. >fruits[d] = lemon
  47087. fruits[c] = apple
  47088. fruits[b] = banana
  47089. fruits[a] = orange</PRE
  47090. ></TD
  47091. ></TR
  47092. ></TABLE
  47093. ><P
  47094. ></P
  47095. ></DIV
  47096. >
  47097.     </P
  47098. ><P
  47099. >      Vlastnosti t°φd∞nφ lze upravit pomocφ volitelnΘho argumentu
  47100.      <TT
  47101. CLASS="parameter"
  47102. ><I
  47103. >sort_flags</I
  47104. ></TT
  47105. >, detaily viz <A
  47106. HREF="#function.sort"
  47107. ><B
  47108. CLASS="function"
  47109. >sort()</B
  47110. ></A
  47111. >.
  47112.     </P
  47113. ><P
  47114. >      Viz takΘ: <A
  47115. HREF="#function.asort"
  47116. ><B
  47117. CLASS="function"
  47118. >asort()</B
  47119. ></A
  47120. >,
  47121.      <A
  47122. HREF="#function.arsort"
  47123. ><B
  47124. CLASS="function"
  47125. >arsort()</B
  47126. ></A
  47127. >,
  47128.      <A
  47129. HREF="#function.ksort"
  47130. ><B
  47131. CLASS="function"
  47132. >ksort()</B
  47133. ></A
  47134. >,
  47135.      <A
  47136. HREF="#function.sort"
  47137. ><B
  47138. CLASS="function"
  47139. >sort()</B
  47140. ></A
  47141. >,
  47142.      <A
  47143. HREF="#function.natsort"
  47144. ><B
  47145. CLASS="function"
  47146. >natsort()</B
  47147. ></A
  47148. > a
  47149.      <A
  47150. HREF="#function.rsort"
  47151. ><B
  47152. CLASS="function"
  47153. >rsort()</B
  47154. ></A
  47155. >.
  47156.     </P
  47157. ></DIV
  47158. ><H1
  47159. ><A
  47160. NAME="function.ksort"
  47161. ></A
  47162. >ksort</H1
  47163. ><DIV
  47164. CLASS="refnamediv"
  47165. ><A
  47166. NAME="AEN8896"
  47167. ></A
  47168. ><P
  47169. >    (PHP 3, PHP 4 )</P
  47170. >ksort -- T°φdit pole podle klφΦ∙</DIV
  47171. ><DIV
  47172. CLASS="refsect1"
  47173. ><A
  47174. NAME="AEN8899"
  47175. ></A
  47176. ><H2
  47177. >Popis</H2
  47178. >int <B
  47179. CLASS="methodname"
  47180. >ksort</B
  47181. > ( array array [, int sort_flags])<BR
  47182. ></BR
  47183. ><P
  47184. >      T°φdφ pole podle klφΦ∙ se zachovßnφ asociacφ index∙. To je
  47185.      u╛iteΦnΘ hlavn∞ p°i prßci s asociativnφmi poli.
  47186.      <TABLE
  47187. WIDTH="100%"
  47188. BORDER="0"
  47189. CELLPADDING="0"
  47190. CELLSPACING="0"
  47191. CLASS="EXAMPLE"
  47192. ><TR
  47193. ><TD
  47194. ><DIV
  47195. CLASS="example"
  47196. ><A
  47197. NAME="AEN8911"
  47198. ></A
  47199. ><P
  47200. ><B
  47201. >P°φklad 1. <B
  47202. CLASS="function"
  47203. >ksort()</B
  47204. > example</B
  47205. ></P
  47206. ><TABLE
  47207. BORDER="0"
  47208. BGCOLOR="#E0E0E0"
  47209. CELLPADDING="5"
  47210. ><TR
  47211. ><TD
  47212. ><PRE
  47213. CLASS="php"
  47214. >$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
  47215. ksort ($fruits);
  47216. reset ($fruits);
  47217. while (list ($key, $val) = each ($fruits)) {
  47218.     echo "$key -> $val\n";
  47219. }</PRE
  47220. ></TD
  47221. ></TR
  47222. ></TABLE
  47223. ></DIV
  47224. ></TD
  47225. ></TR
  47226. ></TABLE
  47227. >
  47228.     </P
  47229. ><P
  47230. >      Tato ukßzka vytiskne:
  47231.     </P
  47232. ><P
  47233. >      <DIV
  47234. CLASS="informalexample"
  47235. ><A
  47236. NAME="AEN8917"
  47237. ></A
  47238. ><P
  47239. ></P
  47240. ><TABLE
  47241. BORDER="0"
  47242. BGCOLOR="#E0E0E0"
  47243. CELLPADDING="5"
  47244. ><TR
  47245. ><TD
  47246. ><PRE
  47247. CLASS="programlisting"
  47248. >fruits[a] = orange
  47249. fruits[b] = banana
  47250. fruits[c] = apple
  47251. fruits[d] = lemon</PRE
  47252. ></TD
  47253. ></TR
  47254. ></TABLE
  47255. ><P
  47256. ></P
  47257. ></DIV
  47258. >
  47259.     </P
  47260. ><P
  47261. >      Vlastnosti t°φd∞nφ lze upravit pomocφ volitelnΘho argumentu
  47262.      <TT
  47263. CLASS="parameter"
  47264. ><I
  47265. >sort_flags</I
  47266. ></TT
  47267. >, detaily viz <A
  47268. HREF="#function.sort"
  47269. ><B
  47270. CLASS="function"
  47271. >sort()</B
  47272. ></A
  47273. >.
  47274.     </P
  47275. ><P
  47276. >      Viz takΘ: <A
  47277. HREF="#function.asort"
  47278. ><B
  47279. CLASS="function"
  47280. >asort()</B
  47281. ></A
  47282. >,
  47283.      <A
  47284. HREF="#function.arsort"
  47285. ><B
  47286. CLASS="function"
  47287. >arsort()</B
  47288. ></A
  47289. >,
  47290.      <A
  47291. HREF="#function.sort"
  47292. ><B
  47293. CLASS="function"
  47294. >sort()</B
  47295. ></A
  47296. >,
  47297.      <A
  47298. HREF="#function.natsort"
  47299. ><B
  47300. CLASS="function"
  47301. >natsort()</B
  47302. ></A
  47303. > a
  47304.      <A
  47305. HREF="#function.rsort"
  47306. ><B
  47307. CLASS="function"
  47308. >rsort()</B
  47309. ></A
  47310. >.
  47311.     </P
  47312. ><DIV
  47313. CLASS="note"
  47314. ><BLOCKQUOTE
  47315. CLASS="note"
  47316. ><P
  47317. ><B
  47318. >Poznßmka: </B
  47319. >
  47320.       Druh² argument byl p°idßn v PHP 4.
  47321.      </P
  47322. ></BLOCKQUOTE
  47323. ></DIV
  47324. ></DIV
  47325. ><H1
  47326. ><A
  47327. NAME="function.list"
  47328. ></A
  47329. >list</H1
  47330. ><DIV
  47331. CLASS="refnamediv"
  47332. ><A
  47333. NAME="AEN8931"
  47334. ></A
  47335. ><P
  47336. >    (PHP 3, PHP 4 )</P
  47337. >list -- P°i°adit hodnoty p°om∞nn²m jako kdyby byly polem</DIV
  47338. ><DIV
  47339. CLASS="refsect1"
  47340. ><A
  47341. NAME="AEN8934"
  47342. ></A
  47343. ><H2
  47344. >Popis</H2
  47345. >void <B
  47346. CLASS="methodname"
  47347. >list</B
  47348. > ( mixed ...)<BR
  47349. ></BR
  47350. ><P
  47351. >      Stejn∞ jako <A
  47352. HREF="#function.array"
  47353. ><B
  47354. CLASS="function"
  47355. >array()</B
  47356. ></A
  47357. >, <B
  47358. CLASS="function"
  47359. >list()</B
  47360. > vlastn∞
  47361.      nenφ funkce, ale jazykov² konstrukt. Pou╛φvß se k p°i°azenφ hodnot vφce
  47362.      prom∞nn²m v jednΘ operaci.
  47363.      <TABLE
  47364. WIDTH="100%"
  47365. BORDER="0"
  47366. CELLPADDING="0"
  47367. CELLSPACING="0"
  47368. CLASS="EXAMPLE"
  47369. ><TR
  47370. ><TD
  47371. ><DIV
  47372. CLASS="example"
  47373. ><A
  47374. NAME="AEN8945"
  47375. ></A
  47376. ><P
  47377. ><B
  47378. >P°φklad 1. Ukßzka <B
  47379. CLASS="function"
  47380. >list()</B
  47381. ></B
  47382. ></P
  47383. ><TABLE
  47384. BORDER="0"
  47385. BGCOLOR="#E0E0E0"
  47386. CELLPADDING="5"
  47387. ><TR
  47388. ><TD
  47389. ><PRE
  47390. CLASS="php"
  47391. ><table>
  47392.  <tr>
  47393.   <th>Employee name</th>
  47394.   <th>Salary</th>
  47395.  </tr>
  47396.  
  47397. <?php
  47398.  
  47399. $result = mysql ($conn, "SELECT id, name, salary FROM employees");
  47400. while (list ($id, $name, $salary) = mysql_fetch_row ($result)) {
  47401.     print (" <tr>\n".
  47402.            "  <td><a href=\"info.php3?id=$id\">$name</a></td>\n".
  47403.            "  <td>$salary</td>\n".
  47404.            " </tr>\n");
  47405. }
  47406.  
  47407. ?>
  47408.  
  47409. </table></PRE
  47410. ></TD
  47411. ></TR
  47412. ></TABLE
  47413. ></DIV
  47414. ></TD
  47415. ></TR
  47416. ></TABLE
  47417. >
  47418.     </P
  47419. ><P
  47420. >      Viz takΘ: <A
  47421. HREF="#function.each"
  47422. ><B
  47423. CLASS="function"
  47424. >each()</B
  47425. ></A
  47426. > a
  47427.      <A
  47428. HREF="#function.array"
  47429. ><B
  47430. CLASS="function"
  47431. >array()</B
  47432. ></A
  47433. >.
  47434.     </P
  47435. ></DIV
  47436. ><H1
  47437. ><A
  47438. NAME="function.natcasesort"
  47439. ></A
  47440. >natcasesort</H1
  47441. ><DIV
  47442. CLASS="refnamediv"
  47443. ><A
  47444. NAME="AEN8953"
  47445. ></A
  47446. ><P
  47447. >    (PHP 4 )</P
  47448. >natcasesort -- 
  47449.      T°φdit pole s vyu╛itφm algoritmu "p°irozenΘho t°φd∞nφ" (case-insensitive)
  47450.     </DIV
  47451. ><DIV
  47452. CLASS="refsect1"
  47453. ><A
  47454. NAME="AEN8956"
  47455. ></A
  47456. ><H2
  47457. >Popis</H2
  47458. >void <B
  47459. CLASS="methodname"
  47460. >natcasesort</B
  47461. > ( array array)<BR
  47462. ></BR
  47463. ><P
  47464. >      Tato funkce implementuje srovnßvacφ algoritmus kter² t°φdφ alfanumerickΘ
  47465.      °et∞zce stejn²m zp∙sobem jako Φlov∞k, toto se popisuje jako "p°irozenΘ
  47466.      t°φd∞nφ".
  47467.      </P
  47468. ><P
  47469. >      <B
  47470. CLASS="function"
  47471. >natcasesort()</B
  47472. > je case-insensitive verze
  47473.      <A
  47474. HREF="#function.natsort"
  47475. ><B
  47476. CLASS="function"
  47477. >natsort()</B
  47478. ></A
  47479. >.  Ukßzka rozdφlu mezi tφmto algoritmem
  47480.      a b∞╛n²m poΦφtaΦov²m t°φd∞nφm °et∞zc∙ viz <A
  47481. HREF="#function.natsort"
  47482. ><B
  47483. CLASS="function"
  47484. >natsort()</B
  47485. ></A
  47486. >.
  47487.     </P
  47488. ><P
  47489. >      Vφce informacφ viz strßnka Martina Poola <A
  47490. HREF="http://www.naturalordersort.org/"
  47491. TARGET="_top"
  47492. >Natural Order String Comparison</A
  47493. >.
  47494.     </P
  47495. ><P
  47496. >      Viz takΘ: <A
  47497. HREF="#function.sort"
  47498. ><B
  47499. CLASS="function"
  47500. >sort()</B
  47501. ></A
  47502. >,
  47503.      <A
  47504. HREF="#function.natsort"
  47505. ><B
  47506. CLASS="function"
  47507. >natsort()</B
  47508. ></A
  47509. >,
  47510.      <A
  47511. HREF="#function.strnatcmp"
  47512. ><B
  47513. CLASS="function"
  47514. >strnatcmp()</B
  47515. ></A
  47516. > and
  47517.      <A
  47518. HREF="#function.strnatcasecmp"
  47519. ><B
  47520. CLASS="function"
  47521. >strnatcasecmp()</B
  47522. ></A
  47523. >.
  47524.     </P
  47525. ></DIV
  47526. ><H1
  47527. ><A
  47528. NAME="function.natsort"
  47529. ></A
  47530. >natsort</H1
  47531. ><DIV
  47532. CLASS="refnamediv"
  47533. ><A
  47534. NAME="AEN8977"
  47535. ></A
  47536. ><P
  47537. >    (PHP 4 )</P
  47538. >natsort -- 
  47539.      T°φdit pole s vyu╛itφm algoritmu "p°irozenΘho t°φd∞nφ"
  47540.     </DIV
  47541. ><DIV
  47542. CLASS="refsect1"
  47543. ><A
  47544. NAME="AEN8980"
  47545. ></A
  47546. ><H2
  47547. >Popis</H2
  47548. >void <B
  47549. CLASS="methodname"
  47550. >natsort</B
  47551. > ( array array)<BR
  47552. ></BR
  47553. ><P
  47554. >      Tato funkce implementuje srovnßvacφ algoritmus kter² t°φdφ alfanumerickΘ
  47555.      °et∞zce stejn²m zp∙sobem jako Φlov∞k, toto se popisuje jako "p°irozenΘ
  47556.      t°φd∞nφ". Ukßzka rozdφlu m∞zi tφmto algoritmem a b∞╛n²mi poΦφtaΦov²mi
  47557.      algoritmy pro °azenφ °et∞zc∙ (nap°. <A
  47558. HREF="#function.sort"
  47559. ><B
  47560. CLASS="function"
  47561. >sort()</B
  47562. ></A
  47563. >):
  47564.     </P
  47565. ><P
  47566. >      <TABLE
  47567. WIDTH="100%"
  47568. BORDER="0"
  47569. CELLPADDING="0"
  47570. CELLSPACING="0"
  47571. CLASS="EXAMPLE"
  47572. ><TR
  47573. ><TD
  47574. ><DIV
  47575. CLASS="example"
  47576. ><A
  47577. NAME="AEN8991"
  47578. ></A
  47579. ><P
  47580. ><B
  47581. >P°φklad 1. Ukßzka <B
  47582. CLASS="function"
  47583. >natsort()</B
  47584. ></B
  47585. ></P
  47586. ><TABLE
  47587. BORDER="0"
  47588. BGCOLOR="#E0E0E0"
  47589. CELLPADDING="5"
  47590. ><TR
  47591. ><TD
  47592. ><PRE
  47593. CLASS="php"
  47594. >$array1 = $array2 = array ("img12.png","img10.png","img2.png","img1.png");
  47595.  
  47596. sort($array1);
  47597. echo "Standardnφ t°φd∞nφ\n";
  47598. print_r($array1);
  47599.  
  47600. natsort($array2);
  47601. echo "\nP°irozenΘ t°φd∞nφ\n";
  47602. print_r($array2);</PRE
  47603. ></TD
  47604. ></TR
  47605. ></TABLE
  47606. ></DIV
  47607. ></TD
  47608. ></TR
  47609. ></TABLE
  47610. >
  47611.     </P
  47612. ><P
  47613. >      V²╣e uveden² k≤d vygeneruje nßsledujφcφ v²stup:
  47614.     </P
  47615. ><P
  47616. >      <DIV
  47617. CLASS="informalexample"
  47618. ><A
  47619. NAME="AEN8997"
  47620. ></A
  47621. ><P
  47622. ></P
  47623. ><TABLE
  47624. BORDER="0"
  47625. BGCOLOR="#E0E0E0"
  47626. CELLPADDING="5"
  47627. ><TR
  47628. ><TD
  47629. ><PRE
  47630. CLASS="programlisting"
  47631. >Standardnφ t°φd∞nφ
  47632. Array
  47633. (
  47634.     [0] => img1.png
  47635.     [1] => img10.png
  47636.     [2] => img12.png
  47637.     [3] => img2.png
  47638. )
  47639.  
  47640. P°irozenΘ t°φd∞nφ
  47641. Array
  47642. (
  47643.     [3] => img1.png
  47644.     [2] => img2.png
  47645.     [1] => img10.png
  47646.     [0] => img12.png
  47647. )</PRE
  47648. ></TD
  47649. ></TR
  47650. ></TABLE
  47651. ><P
  47652. ></P
  47653. ></DIV
  47654. >
  47655.      Vφce informacφ viz strßnka Martina Poola <A
  47656. HREF="http://www.naturalordersort.org/"
  47657. TARGET="_top"
  47658. >Natural Order String Comparison</A
  47659. >.
  47660.     </P
  47661. ><P
  47662. >      Viz takΘ: <A
  47663. HREF="#function.natcasesort"
  47664. ><B
  47665. CLASS="function"
  47666. >natcasesort()</B
  47667. ></A
  47668. >,
  47669.      <A
  47670. HREF="#function.strnatcmp"
  47671. ><B
  47672. CLASS="function"
  47673. >strnatcmp()</B
  47674. ></A
  47675. > a
  47676.      <A
  47677. HREF="#function.strnatcasecmp"
  47678. ><B
  47679. CLASS="function"
  47680. >strnatcasecmp()</B
  47681. ></A
  47682. >.
  47683.     </P
  47684. ></DIV
  47685. ><H1
  47686. ><A
  47687. NAME="function.next"
  47688. ></A
  47689. >next</H1
  47690. ><DIV
  47691. CLASS="refnamediv"
  47692. ><A
  47693. NAME="AEN9005"
  47694. ></A
  47695. ><P
  47696. >    (PHP 3, PHP 4 )</P
  47697. >next -- Posunout internφ ukazatel pole</DIV
  47698. ><DIV
  47699. CLASS="refsect1"
  47700. ><A
  47701. NAME="AEN9008"
  47702. ></A
  47703. ><H2
  47704. >Popis</H2
  47705. >mixed <B
  47706. CLASS="methodname"
  47707. >next</B
  47708. > ( array array)<BR
  47709. ></BR
  47710. ><P
  47711. >      Vracφ dal╣φ prvek pole nebo <TT
  47712. CLASS="constant"
  47713. ><B
  47714. >FALSE</B
  47715. ></TT
  47716. >, pokud prvky do╣ly.
  47717.     </P
  47718. ><P
  47719. >      <B
  47720. CLASS="function"
  47721. >next()</B
  47722. > se chovß jako <A
  47723. HREF="#function.current"
  47724. ><B
  47725. CLASS="function"
  47726. >current()</B
  47727. ></A
  47728. >, s jednφm
  47729.      rozdφlem: posouvß internφ ukazatel pole o jeden prvek a vracφ prvek, na kter²
  47730.      tento ukazatel ukazuje po posunu. To znamenß, ╛e vracφ dal╣φ prvek pole
  47731.      a posouvß internφ ukazatel o jeden. Pokud by ukazatel po psunu ukazoval
  47732.      mimo pole, <B
  47733. CLASS="function"
  47734. >next()</B
  47735. > vracφ <TT
  47736. CLASS="constant"
  47737. ><B
  47738. >FALSE</B
  47739. ></TT
  47740. >.
  47741.      <DIV
  47742. CLASS="warning"
  47743. ><P
  47744. ></P
  47745. ><TABLE
  47746. CLASS="warning"
  47747. BORDER="1"
  47748. WIDTH="100%"
  47749. ><TR
  47750. ><TD
  47751. ALIGN="CENTER"
  47752. ><B
  47753. >Varovßnφ</B
  47754. ></TD
  47755. ></TR
  47756. ><TR
  47757. ><TD
  47758. ALIGN="LEFT"
  47759. ><P
  47760. >        Pokud toto pole obsahuje prßzdnΘ prvky, nebo prvky, jejich╛ index je 0,
  47761.        tato funkce vrßtφ <TT
  47762. CLASS="constant"
  47763. ><B
  47764. >FALSE</B
  47765. ></TT
  47766. > i pro tyto prvky. Ke sprßvnΘmu
  47767.        pr∙chodu polem, kterΘ m∙╛e obsahovat prßzdnΘ prvky nebo prvky s indexem 0
  47768.        pou╛ijte <A
  47769. HREF="#function.each"
  47770. ><B
  47771. CLASS="function"
  47772. >each()</B
  47773. ></A
  47774. >.
  47775.       </P
  47776. ></TD
  47777. ></TR
  47778. ></TABLE
  47779. ></DIV
  47780. >
  47781.     </P
  47782. ><P
  47783. >      Viz takΘ:
  47784.      <A
  47785. HREF="#function.current"
  47786. ><B
  47787. CLASS="function"
  47788. >current()</B
  47789. ></A
  47790. >,
  47791.      <A
  47792. HREF="#function.end"
  47793. ><B
  47794. CLASS="function"
  47795. >end()</B
  47796. ></A
  47797. >,
  47798.      <A
  47799. HREF="#function.prev"
  47800. ><B
  47801. CLASS="function"
  47802. >prev()</B
  47803. ></A
  47804. > a
  47805.      <A
  47806. HREF="#function.reset"
  47807. ><B
  47808. CLASS="function"
  47809. >reset()</B
  47810. ></A
  47811. >.
  47812.     </P
  47813. ></DIV
  47814. ><H1
  47815. ><A
  47816. NAME="function.pos"
  47817. ></A
  47818. >pos</H1
  47819. ><DIV
  47820. CLASS="refnamediv"
  47821. ><A
  47822. NAME="AEN9033"
  47823. ></A
  47824. ><P
  47825. >    (PHP 3, PHP 4 )</P
  47826. >pos -- Zφskat souΦasn² prvek pole</DIV
  47827. ><DIV
  47828. CLASS="refsect1"
  47829. ><A
  47830. NAME="AEN9036"
  47831. ></A
  47832. ><H2
  47833. >Popis</H2
  47834. >mixed <B
  47835. CLASS="methodname"
  47836. >pos</B
  47837. > ( array array)<BR
  47838. ></BR
  47839. ><P
  47840. >      Toto je alias k <A
  47841. HREF="#function.current"
  47842. ><B
  47843. CLASS="function"
  47844. >current()</B
  47845. ></A
  47846. >.
  47847.     </P
  47848. ><P
  47849. >      Viz takΘ: <A
  47850. HREF="#function.end"
  47851. ><B
  47852. CLASS="function"
  47853. >end()</B
  47854. ></A
  47855. >,
  47856.      <A
  47857. HREF="#function.next"
  47858. ><B
  47859. CLASS="function"
  47860. >next()</B
  47861. ></A
  47862. >,
  47863.      <A
  47864. HREF="#function.prev"
  47865. ><B
  47866. CLASS="function"
  47867. >prev()</B
  47868. ></A
  47869. > a
  47870.      <A
  47871. HREF="#function.reset"
  47872. ><B
  47873. CLASS="function"
  47874. >reset()</B
  47875. ></A
  47876. >.
  47877.     </P
  47878. ></DIV
  47879. ><H1
  47880. ><A
  47881. NAME="function.prev"
  47882. ></A
  47883. >prev</H1
  47884. ><DIV
  47885. CLASS="refnamediv"
  47886. ><A
  47887. NAME="AEN9052"
  47888. ></A
  47889. ><P
  47890. >    (PHP 3, PHP 4 )</P
  47891. >prev -- Rewind internφ ukazatel pole</DIV
  47892. ><DIV
  47893. CLASS="refsect1"
  47894. ><A
  47895. NAME="AEN9055"
  47896. ></A
  47897. ><H2
  47898. >Popis</H2
  47899. >mixed <B
  47900. CLASS="methodname"
  47901. >prev</B
  47902. > ( array array)<BR
  47903. ></BR
  47904. ><P
  47905. >      Vracφ prvek pole p°ed tφm prvkem, na kter² ukazuje internφ ukazatel pole,
  47906.      nebo <TT
  47907. CLASS="constant"
  47908. ><B
  47909. >FALSE</B
  47910. ></TT
  47911. >, pokud prvky do╣ly.
  47912.      <DIV
  47913. CLASS="warning"
  47914. ><P
  47915. ></P
  47916. ><TABLE
  47917. CLASS="warning"
  47918. BORDER="1"
  47919. WIDTH="100%"
  47920. ><TR
  47921. ><TD
  47922. ALIGN="CENTER"
  47923. ><B
  47924. >Varovßnφ</B
  47925. ></TD
  47926. ></TR
  47927. ><TR
  47928. ><TD
  47929. ALIGN="LEFT"
  47930. ><P
  47931. >        Pokud toto pole obsahuje prßzdnΘ prvky, tato funkce vrßtφ
  47932.        <TT
  47933. CLASS="constant"
  47934. ><B
  47935. >FALSE</B
  47936. ></TT
  47937. > i pro tyto prvky. Ke sprßvnΘmu pr∙chodu polem,
  47938.        kterΘ m∙╛e obsahovat prßzdnΘ prvky pou╛ijte <A
  47939. HREF="#function.each"
  47940. ><B
  47941. CLASS="function"
  47942. >each()</B
  47943. ></A
  47944. >.
  47945.       </P
  47946. ></TD
  47947. ></TR
  47948. ></TABLE
  47949. ></DIV
  47950. >
  47951.     </P
  47952. ><P
  47953. >      <B
  47954. CLASS="function"
  47955. >prev()</B
  47956. > se chovß stejn∞ jako <A
  47957. HREF="#function.next"
  47958. ><B
  47959. CLASS="function"
  47960. >next()</B
  47961. ></A
  47962. >,
  47963.      ale posouvß internφ ukazatel pole o jedno mφsto zpßtky mφsto dop°edu.
  47964.     </P
  47965. ><P
  47966. >      Viz takΘ: <A
  47967. HREF="#function.current"
  47968. ><B
  47969. CLASS="function"
  47970. >current()</B
  47971. ></A
  47972. >,
  47973.      <A
  47974. HREF="#function.end"
  47975. ><B
  47976. CLASS="function"
  47977. >end()</B
  47978. ></A
  47979. >,
  47980.      <A
  47981. HREF="#function.next"
  47982. ><B
  47983. CLASS="function"
  47984. >next()</B
  47985. ></A
  47986. > a
  47987.      <A
  47988. HREF="#function.reset"
  47989. ><B
  47990. CLASS="function"
  47991. >reset()</B
  47992. ></A
  47993. >.
  47994.     </P
  47995. ></DIV
  47996. ><H1
  47997. ><A
  47998. NAME="function.range"
  47999. ></A
  48000. >range</H1
  48001. ><DIV
  48002. CLASS="refnamediv"
  48003. ><A
  48004. NAME="AEN9078"
  48005. ></A
  48006. ><P
  48007. >    (PHP 3>= 3.0.8, PHP 4 )</P
  48008. >range -- Vytvo°it pole obsahujφcφ rozsah integer∙</DIV
  48009. ><DIV
  48010. CLASS="refsect1"
  48011. ><A
  48012. NAME="AEN9081"
  48013. ></A
  48014. ><H2
  48015. >Popis</H2
  48016. >array <B
  48017. CLASS="methodname"
  48018. >range</B
  48019. > ( int low, int high)<BR
  48020. ></BR
  48021. ><P
  48022. >      <B
  48023. CLASS="function"
  48024. >range()</B
  48025. > vracφ pole integer∙ od
  48026.      <TT
  48027. CLASS="parameter"
  48028. ><I
  48029. >low</I
  48030. ></TT
  48031. > po <TT
  48032. CLASS="parameter"
  48033. ><I
  48034. >high</I
  48035. ></TT
  48036. > vΦetn∞.
  48037.     </P
  48038. ><P
  48039. >      Ukßzka pou╛itφ viz <A
  48040. HREF="#function.shuffle"
  48041. ><B
  48042. CLASS="function"
  48043. >shuffle()</B
  48044. ></A
  48045. >.
  48046.     </P
  48047. ></DIV
  48048. ><H1
  48049. ><A
  48050. NAME="function.reset"
  48051. ></A
  48052. >reset</H1
  48053. ><DIV
  48054. CLASS="refnamediv"
  48055. ><A
  48056. NAME="AEN9099"
  48057. ></A
  48058. ><P
  48059. >    (PHP 3, PHP 4 )</P
  48060. >reset -- Nastavit internφ ukazatel pole na jeho prvnφ prvek</DIV
  48061. ><DIV
  48062. CLASS="refsect1"
  48063. ><A
  48064. NAME="AEN9102"
  48065. ></A
  48066. ><H2
  48067. >Popis</H2
  48068. >mixed <B
  48069. CLASS="methodname"
  48070. >reset</B
  48071. > ( array array)<BR
  48072. ></BR
  48073. ><P
  48074. >      <B
  48075. CLASS="function"
  48076. >reset()</B
  48077. > p°etoΦφ internφ ukazatel pole
  48078.      <TT
  48079. CLASS="parameter"
  48080. ><I
  48081. >array</I
  48082. ></TT
  48083. > na jeho prvnφ prvek.
  48084.     </P
  48085. ><P
  48086. >      <B
  48087. CLASS="function"
  48088. >reset()</B
  48089. > vracφ hodnotu prvnφho prvku pole.
  48090.     </P
  48091. ><P
  48092. >      Viz takΘ: <A
  48093. HREF="#function.current"
  48094. ><B
  48095. CLASS="function"
  48096. >current()</B
  48097. ></A
  48098. >,
  48099.      <A
  48100. HREF="#function.each"
  48101. ><B
  48102. CLASS="function"
  48103. >each()</B
  48104. ></A
  48105. >,
  48106.      <A
  48107. HREF="#function.next"
  48108. ><B
  48109. CLASS="function"
  48110. >next()</B
  48111. ></A
  48112. > a
  48113.      <A
  48114. HREF="#function.prev"
  48115. ><B
  48116. CLASS="function"
  48117. >prev()</B
  48118. ></A
  48119. >.
  48120.     </P
  48121. ></DIV
  48122. ><H1
  48123. ><A
  48124. NAME="function.rsort"
  48125. ></A
  48126. >rsort</H1
  48127. ><DIV
  48128. CLASS="refnamediv"
  48129. ><A
  48130. NAME="AEN9121"
  48131. ></A
  48132. ><P
  48133. >    (PHP 3, PHP 4 )</P
  48134. >rsort -- T°φdit pole sestupn∞</DIV
  48135. ><DIV
  48136. CLASS="refsect1"
  48137. ><A
  48138. NAME="AEN9124"
  48139. ></A
  48140. ><H2
  48141. >Popis</H2
  48142. >void <B
  48143. CLASS="methodname"
  48144. >rsort</B
  48145. > ( array array [, int sort_flags])<BR
  48146. ></BR
  48147. ><P
  48148. >      Tato funkce sestupn∞ t°φdφ pole.
  48149.      <TABLE
  48150. WIDTH="100%"
  48151. BORDER="0"
  48152. CELLPADDING="0"
  48153. CELLSPACING="0"
  48154. CLASS="EXAMPLE"
  48155. ><TR
  48156. ><TD
  48157. ><DIV
  48158. CLASS="example"
  48159. ><A
  48160. NAME="AEN9136"
  48161. ></A
  48162. ><P
  48163. ><B
  48164. >P°φklad 1. Ukßzka <B
  48165. CLASS="function"
  48166. >rsort()</B
  48167. ></B
  48168. ></P
  48169. ><TABLE
  48170. BORDER="0"
  48171. BGCOLOR="#E0E0E0"
  48172. CELLPADDING="5"
  48173. ><TR
  48174. ><TD
  48175. ><PRE
  48176. CLASS="php"
  48177. >$fruits = array ("lemon", "orange", "banana", "apple");
  48178. rsort ($fruits);
  48179. reset ($fruits);
  48180. while (list ($key, $val) = each ($fruits)) {
  48181.     echo "$key -> $val\n";
  48182. }</PRE
  48183. ></TD
  48184. ></TR
  48185. ></TABLE
  48186. ></DIV
  48187. ></TD
  48188. ></TR
  48189. ></TABLE
  48190. >
  48191.     </P
  48192. ><P
  48193. >      Tato ukßzka zobrazφ:
  48194.     </P
  48195. ><P
  48196. >      <DIV
  48197. CLASS="informalexample"
  48198. ><A
  48199. NAME="AEN9142"
  48200. ></A
  48201. ><P
  48202. ></P
  48203. ><TABLE
  48204. BORDER="0"
  48205. BGCOLOR="#E0E0E0"
  48206. CELLPADDING="5"
  48207. ><TR
  48208. ><TD
  48209. ><PRE
  48210. CLASS="programlisting"
  48211. >fruits[0] = orange
  48212. fruits[1] = lemon
  48213. fruits[2] = banana
  48214. fruits[3] = apple</PRE
  48215. ></TD
  48216. ></TR
  48217. ></TABLE
  48218. ><P
  48219. ></P
  48220. ></DIV
  48221. >
  48222.     </P
  48223. ><P
  48224. >      Ovoce bylo set°φd∞no podle abecedy sestupn∞.
  48225.     </P
  48226. ><P
  48227. >      Vlastnosti t°φd∞nφ lze upravit pomocφ volitelnΘho argumentu
  48228.      <TT
  48229. CLASS="parameter"
  48230. ><I
  48231. >sort_flags</I
  48232. ></TT
  48233. >, detaily viz <A
  48234. HREF="#function.sort"
  48235. ><B
  48236. CLASS="function"
  48237. >sort()</B
  48238. ></A
  48239. >.
  48240.     </P
  48241. ><P
  48242. >      Viz takΘ: <A
  48243. HREF="#function.arsort"
  48244. ><B
  48245. CLASS="function"
  48246. >arsort()</B
  48247. ></A
  48248. >,
  48249.      <A
  48250. HREF="#function.asort"
  48251. ><B
  48252. CLASS="function"
  48253. >asort()</B
  48254. ></A
  48255. >,
  48256.      <A
  48257. HREF="#function.ksort"
  48258. ><B
  48259. CLASS="function"
  48260. >ksort()</B
  48261. ></A
  48262. >,
  48263.      <A
  48264. HREF="#function.sort"
  48265. ><B
  48266. CLASS="function"
  48267. >sort()</B
  48268. ></A
  48269. > a
  48270.      <A
  48271. HREF="#function.usort"
  48272. ><B
  48273. CLASS="function"
  48274. >usort()</B
  48275. ></A
  48276. >.
  48277.     </P
  48278. ></DIV
  48279. ><H1
  48280. ><A
  48281. NAME="function.shuffle"
  48282. ></A
  48283. >shuffle</H1
  48284. ><DIV
  48285. CLASS="refnamediv"
  48286. ><A
  48287. NAME="AEN9155"
  48288. ></A
  48289. ><P
  48290. >    (PHP 3>= 3.0.8, PHP 4 )</P
  48291. >shuffle -- Zamφchat pole</DIV
  48292. ><DIV
  48293. CLASS="refsect1"
  48294. ><A
  48295. NAME="AEN9158"
  48296. ></A
  48297. ><H2
  48298. >Popis</H2
  48299. >void <B
  48300. CLASS="methodname"
  48301. >shuffle</B
  48302. > ( array array)<BR
  48303. ></BR
  48304. ><P
  48305. >      <B
  48306. CLASS="function"
  48307. >shuffle()</B
  48308. > zamφchß (nßhodn∞ zm∞nφ po°adφ prvk∙) pole.
  48309.      Musφte inicializovat generßtor nßhodn²ch Φφsel pomocφ
  48310.      <A
  48311. HREF="#function.srand"
  48312. ><B
  48313. CLASS="function"
  48314. >srand()</B
  48315. ></A
  48316. >.
  48317.      <TABLE
  48318. WIDTH="100%"
  48319. BORDER="0"
  48320. CELLPADDING="0"
  48321. CELLSPACING="0"
  48322. CLASS="EXAMPLE"
  48323. ><TR
  48324. ><TD
  48325. ><DIV
  48326. CLASS="example"
  48327. ><A
  48328. NAME="AEN9169"
  48329. ></A
  48330. ><P
  48331. ><B
  48332. >P°φklad 1. Ukßzka <B
  48333. CLASS="function"
  48334. >shuffle()</B
  48335. ></B
  48336. ></P
  48337. ><TABLE
  48338. BORDER="0"
  48339. BGCOLOR="#E0E0E0"
  48340. CELLPADDING="5"
  48341. ><TR
  48342. ><TD
  48343. ><PRE
  48344. CLASS="php"
  48345. >$numbers = range (1,20);
  48346. srand ((double)microtime()*1000000);
  48347. shuffle ($numbers);
  48348. while (list (, $number) = each ($numbers)) {
  48349.     echo "$number ";
  48350. }</PRE
  48351. ></TD
  48352. ></TR
  48353. ></TABLE
  48354. ></DIV
  48355. ></TD
  48356. ></TR
  48357. ></TABLE
  48358. >
  48359.     </P
  48360. ><P
  48361. >      Viz takΘ: <A
  48362. HREF="#function.arsort"
  48363. ><B
  48364. CLASS="function"
  48365. >arsort()</B
  48366. ></A
  48367. >,
  48368.      <A
  48369. HREF="#function.asort"
  48370. ><B
  48371. CLASS="function"
  48372. >asort()</B
  48373. ></A
  48374. >,
  48375.      <A
  48376. HREF="#function.ksort"
  48377. ><B
  48378. CLASS="function"
  48379. >ksort()</B
  48380. ></A
  48381. >,
  48382.      <A
  48383. HREF="#function.rsort"
  48384. ><B
  48385. CLASS="function"
  48386. >rsort()</B
  48387. ></A
  48388. >,
  48389.      <A
  48390. HREF="#function.sort"
  48391. ><B
  48392. CLASS="function"
  48393. >sort()</B
  48394. ></A
  48395. > a
  48396.      <A
  48397. HREF="#function.usort"
  48398. ><B
  48399. CLASS="function"
  48400. >usort()</B
  48401. ></A
  48402. >.
  48403.     </P
  48404. ></DIV
  48405. ><H1
  48406. ><A
  48407. NAME="function.sizeof"
  48408. ></A
  48409. >sizeof</H1
  48410. ><DIV
  48411. CLASS="refnamediv"
  48412. ><A
  48413. NAME="AEN9181"
  48414. ></A
  48415. ><P
  48416. >    (PHP 3, PHP 4 )</P
  48417. >sizeof -- Zjistit poΦet prvk∙ v poli</DIV
  48418. ><DIV
  48419. CLASS="refsect1"
  48420. ><A
  48421. NAME="AEN9184"
  48422. ></A
  48423. ><H2
  48424. >Popis</H2
  48425. >int <B
  48426. CLASS="methodname"
  48427. >sizeof</B
  48428. > ( array array)<BR
  48429. ></BR
  48430. ><P
  48431. >      Vracφ poΦet prvk∙ v poli.
  48432.     </P
  48433. ><P
  48434. >      Viz takΘ: <A
  48435. HREF="#function.count"
  48436. ><B
  48437. CLASS="function"
  48438. >count()</B
  48439. ></A
  48440. >.
  48441.     </P
  48442. ></DIV
  48443. ><H1
  48444. ><A
  48445. NAME="function.sort"
  48446. ></A
  48447. >sort</H1
  48448. ><DIV
  48449. CLASS="refnamediv"
  48450. ><A
  48451. NAME="AEN9196"
  48452. ></A
  48453. ><P
  48454. >    (PHP 3, PHP 4 )</P
  48455. >sort -- T°φdit pole</DIV
  48456. ><DIV
  48457. CLASS="refsect1"
  48458. ><A
  48459. NAME="AEN9199"
  48460. ></A
  48461. ><H2
  48462. >Popis</H2
  48463. >void <B
  48464. CLASS="methodname"
  48465. >sort</B
  48466. > ( array array [, int sort_flags])<BR
  48467. ></BR
  48468. ><P
  48469. >      <B
  48470. CLASS="function"
  48471. >sort()</B
  48472. > t°φdφ pole. Prvky se uspo°ßdajφ od nejmen╣φho
  48473.      k nejv∞t╣φmu.
  48474.      <TABLE
  48475. WIDTH="100%"
  48476. BORDER="0"
  48477. CELLPADDING="0"
  48478. CELLSPACING="0"
  48479. CLASS="EXAMPLE"
  48480. ><TR
  48481. ><TD
  48482. ><DIV
  48483. CLASS="example"
  48484. ><A
  48485. NAME="AEN9212"
  48486. ></A
  48487. ><P
  48488. ><B
  48489. >P°φklad 1. Ukßzka <B
  48490. CLASS="function"
  48491. >sort()</B
  48492. ></B
  48493. ></P
  48494. ><TABLE
  48495. BORDER="0"
  48496. BGCOLOR="#E0E0E0"
  48497. CELLPADDING="5"
  48498. ><TR
  48499. ><TD
  48500. ><PRE
  48501. CLASS="php"
  48502. ><?php
  48503.  
  48504. $fruits = array ("lemon", "orange", "banana", "apple");
  48505. sort ($fruits);
  48506. reset ($fruits);
  48507. while (list ($key, $val) = each ($fruits)) {
  48508.     echo "fruits[".$key."] = ".$val;
  48509. }
  48510.  
  48511. ?></PRE
  48512. ></TD
  48513. ></TR
  48514. ></TABLE
  48515. ></DIV
  48516. ></TD
  48517. ></TR
  48518. ></TABLE
  48519. >
  48520.     </P
  48521. ><P
  48522. >      Tato ukßzka zobrazφ:
  48523.     </P
  48524. ><P
  48525. >      <DIV
  48526. CLASS="informalexample"
  48527. ><A
  48528. NAME="AEN9218"
  48529. ></A
  48530. ><P
  48531. ></P
  48532. ><TABLE
  48533. BORDER="0"
  48534. BGCOLOR="#E0E0E0"
  48535. CELLPADDING="5"
  48536. ><TR
  48537. ><TD
  48538. ><PRE
  48539. CLASS="programlisting"
  48540. >fruits[0] = apple
  48541. fruits[1] = banana
  48542. fruits[2] = lemon
  48543. fruits[3] = orange</PRE
  48544. ></TD
  48545. ></TR
  48546. ></TABLE
  48547. ><P
  48548. ></P
  48549. ></DIV
  48550. >
  48551.     </P
  48552. ><P
  48553. >      Ovoce bylo se°azeno podle abecedy.
  48554.     </P
  48555. ><P
  48556. >      Vlastnosti t°φd∞nφ lze upravit pomocφ volitelnΘho argumentu
  48557.      <TT
  48558. CLASS="parameter"
  48559. ><I
  48560. >sort_flags</I
  48561. ></TT
  48562. >, kter² m∙╛e nab²vat t∞chto hodnot:
  48563.     </P
  48564. ><P
  48565. >      Typy t°φd∞nφ:
  48566.      <P
  48567. ></P
  48568. ><UL
  48569. ><LI
  48570. ><P
  48571. >SORT_REGULAR - normßlnφ porovnßvßnφ</P
  48572. ></LI
  48573. ><LI
  48574. ><P
  48575. >SORT_NUMERIC - numerickΘ porovnßvßnφ</P
  48576. ></LI
  48577. ><LI
  48578. ><P
  48579. >SORT_STRING - textovΘ porovnßvßnφ</P
  48580. ></LI
  48581. ></UL
  48582. >
  48583.     </P
  48584. ><P
  48585. >      Viz takΘ: <A
  48586. HREF="#function.arsort"
  48587. ><B
  48588. CLASS="function"
  48589. >arsort()</B
  48590. ></A
  48591. >,
  48592.      <A
  48593. HREF="#function.asort"
  48594. ><B
  48595. CLASS="function"
  48596. >asort()</B
  48597. ></A
  48598. >,
  48599.      <A
  48600. HREF="#function.ksort"
  48601. ><B
  48602. CLASS="function"
  48603. >ksort()</B
  48604. ></A
  48605. >,
  48606.      <A
  48607. HREF="#function.natsort"
  48608. ><B
  48609. CLASS="function"
  48610. >natsort()</B
  48611. ></A
  48612. >,
  48613.      <A
  48614. HREF="#function.natcasesort"
  48615. ><B
  48616. CLASS="function"
  48617. >natcasesort()</B
  48618. ></A
  48619. >,
  48620.      <A
  48621. HREF="#function.rsort"
  48622. ><B
  48623. CLASS="function"
  48624. >rsort()</B
  48625. ></A
  48626. >,
  48627.      <A
  48628. HREF="#function.usort"
  48629. ><B
  48630. CLASS="function"
  48631. >usort()</B
  48632. ></A
  48633. >,
  48634.      <A
  48635. HREF="#function.array-multisort"
  48636. ><B
  48637. CLASS="function"
  48638. >array_multisort()</B
  48639. ></A
  48640. > a
  48641.      <A
  48642. HREF="#function.uksort"
  48643. ><B
  48644. CLASS="function"
  48645. >uksort()</B
  48646. ></A
  48647. >.
  48648.     </P
  48649. ><DIV
  48650. CLASS="note"
  48651. ><BLOCKQUOTE
  48652. CLASS="note"
  48653. ><P
  48654. ><B
  48655. >Poznßmka: </B
  48656. >
  48657.       Druh² argument byl p°idßn v PHP 4.
  48658.      </P
  48659. ></BLOCKQUOTE
  48660. ></DIV
  48661. ></DIV
  48662. ><H1
  48663. ><A
  48664. NAME="function.uasort"
  48665. ></A
  48666. >uasort</H1
  48667. ><DIV
  48668. CLASS="refnamediv"
  48669. ><A
  48670. NAME="AEN9244"
  48671. ></A
  48672. ><P
  48673. >    (PHP 3>= 3.0.4, PHP 4 )</P
  48674. >uasort -- 
  48675.      T°φdit pole pomocφ u╛ivatelsky definovanΘ porovnßvacφ funkce se zachovßnφm
  48676.      klφΦ∙
  48677.     </DIV
  48678. ><DIV
  48679. CLASS="refsect1"
  48680. ><A
  48681. NAME="AEN9247"
  48682. ></A
  48683. ><H2
  48684. >Popis</H2
  48685. >void <B
  48686. CLASS="methodname"
  48687. >uasort</B
  48688. > ( array array, function cmp_function)<BR
  48689. ></BR
  48690. ><P
  48691. >      Tato funkce t°φdφ pole tak, ╛e si indexy uchovßvajφ spojenφ s hodnotami.
  48692.      To je u╛iteΦnΘ hlavn∞ p°i t°φd∞nφ asociativnφch polφ, kde je d∙le╛itΘ
  48693.      po°adφ prvk∙. Srovnßvacφ funkce je u╛ivatelsky definovßna.
  48694.     </P
  48695. ><DIV
  48696. CLASS="note"
  48697. ><BLOCKQUOTE
  48698. CLASS="note"
  48699. ><P
  48700. ><B
  48701. >Poznßmka: </B
  48702. >
  48703.       Ukßzky u╛ivatelsky definovan²ch porovnßvacφch funkcφ viz
  48704.       <A
  48705. HREF="#function.usort"
  48706. ><B
  48707. CLASS="function"
  48708. >usort()</B
  48709. ></A
  48710. > a <A
  48711. HREF="#function.uksort"
  48712. ><B
  48713. CLASS="function"
  48714. >uksort()</B
  48715. ></A
  48716. >.
  48717.      </P
  48718. ></BLOCKQUOTE
  48719. ></DIV
  48720. ><P
  48721. >      Viz takΘ: <A
  48722. HREF="#function.usort"
  48723. ><B
  48724. CLASS="function"
  48725. >usort()</B
  48726. ></A
  48727. >,
  48728.      <A
  48729. HREF="#function.uksort"
  48730. ><B
  48731. CLASS="function"
  48732. >uksort()</B
  48733. ></A
  48734. >,
  48735.      <A
  48736. HREF="#function.sort"
  48737. ><B
  48738. CLASS="function"
  48739. >sort()</B
  48740. ></A
  48741. >,
  48742.      <A
  48743. HREF="#function.asort"
  48744. ><B
  48745. CLASS="function"
  48746. >asort()</B
  48747. ></A
  48748. >,
  48749.      <A
  48750. HREF="#function.arsort"
  48751. ><B
  48752. CLASS="function"
  48753. >arsort()</B
  48754. ></A
  48755. >,
  48756.      <A
  48757. HREF="#function.ksort"
  48758. ><B
  48759. CLASS="function"
  48760. >ksort()</B
  48761. ></A
  48762. > a
  48763.      <A
  48764. HREF="#function.rsort"
  48765. ><B
  48766. CLASS="function"
  48767. >rsort()</B
  48768. ></A
  48769. >.
  48770.     </P
  48771. ></DIV
  48772. ><H1
  48773. ><A
  48774. NAME="function.uksort"
  48775. ></A
  48776. >uksort</H1
  48777. ><DIV
  48778. CLASS="refnamediv"
  48779. ><A
  48780. NAME="AEN9272"
  48781. ></A
  48782. ><P
  48783. >    (PHP 3>= 3.0.4, PHP 4 )</P
  48784. >uksort -- 
  48785.      T°φdit pole podle klφΦ∙ pomocφ u╛ivatelsky definovane porovnßvacφ funkce
  48786.     </DIV
  48787. ><DIV
  48788. CLASS="refsect1"
  48789. ><A
  48790. NAME="AEN9275"
  48791. ></A
  48792. ><H2
  48793. >Popis</H2
  48794. >void <B
  48795. CLASS="methodname"
  48796. >uksort</B
  48797. > ( array array, function cmp_function)<BR
  48798. ></BR
  48799. ><P
  48800. >      Tato funkce t°φdφ pole podle klφΦ∙ pomocφ u╛ivatelsky definovanΘ
  48801.      porovnßvacφ funkce. Pokud pot°ebujete t°φdit pole podle komplikovan∞j╣φch
  48802.      kritΘriφ, m∞li byste pou╛φt tuto funkci.
  48803.     </P
  48804. ><P
  48805. >      <TABLE
  48806. WIDTH="100%"
  48807. BORDER="0"
  48808. CELLPADDING="0"
  48809. CELLSPACING="0"
  48810. CLASS="EXAMPLE"
  48811. ><TR
  48812. ><TD
  48813. ><DIV
  48814. CLASS="example"
  48815. ><A
  48816. NAME="AEN9288"
  48817. ></A
  48818. ><P
  48819. ><B
  48820. >P°φklad 1. Ukßzka <B
  48821. CLASS="function"
  48822. >uksort()</B
  48823. ></B
  48824. ></P
  48825. ><TABLE
  48826. BORDER="0"
  48827. BGCOLOR="#E0E0E0"
  48828. CELLPADDING="5"
  48829. ><TR
  48830. ><TD
  48831. ><PRE
  48832. CLASS="php"
  48833. >function cmp ($a, $b) {
  48834.     if ($a == $b) return 0;
  48835.     return ($a > $b) ? -1 : 1;
  48836. }
  48837.  
  48838. $a = array (4 => "four", 3 => "three", 20 => "twenty", 10 => "ten");
  48839.  
  48840. uksort ($a, "cmp");
  48841.  
  48842. while (list ($key, $value) = each ($a)) {
  48843.     echo "$key: $value\n";
  48844. }</PRE
  48845. ></TD
  48846. ></TR
  48847. ></TABLE
  48848. ></DIV
  48849. ></TD
  48850. ></TR
  48851. ></TABLE
  48852. >
  48853.     </P
  48854. ><P
  48855. >      Tato ukßzka zobrazφ:
  48856.     </P
  48857. ><P
  48858. >      <DIV
  48859. CLASS="informalexample"
  48860. ><A
  48861. NAME="AEN9294"
  48862. ></A
  48863. ><P
  48864. ></P
  48865. ><TABLE
  48866. BORDER="0"
  48867. BGCOLOR="#E0E0E0"
  48868. CELLPADDING="5"
  48869. ><TR
  48870. ><TD
  48871. ><PRE
  48872. CLASS="programlisting"
  48873. >20: twenty
  48874. 10: ten
  48875. 4: four
  48876. 3: three</PRE
  48877. ></TD
  48878. ></TR
  48879. ></TABLE
  48880. ><P
  48881. ></P
  48882. ></DIV
  48883. >
  48884.     </P
  48885. ><P
  48886. >      Viz takΘ: <A
  48887. HREF="#function.usort"
  48888. ><B
  48889. CLASS="function"
  48890. >usort()</B
  48891. ></A
  48892. >,
  48893.      <A
  48894. HREF="#function.uasort"
  48895. ><B
  48896. CLASS="function"
  48897. >uasort()</B
  48898. ></A
  48899. >,
  48900.      <A
  48901. HREF="#function.sort"
  48902. ><B
  48903. CLASS="function"
  48904. >sort()</B
  48905. ></A
  48906. >,
  48907.      <A
  48908. HREF="#function.asort"
  48909. ><B
  48910. CLASS="function"
  48911. >asort()</B
  48912. ></A
  48913. >,
  48914.      <A
  48915. HREF="#function.arsort"
  48916. ><B
  48917. CLASS="function"
  48918. >arsort()</B
  48919. ></A
  48920. >,
  48921.      <A
  48922. HREF="#function.ksort"
  48923. ><B
  48924. CLASS="function"
  48925. >ksort()</B
  48926. ></A
  48927. >,
  48928.      <A
  48929. HREF="#function.natsort"
  48930. ><B
  48931. CLASS="function"
  48932. >natsort()</B
  48933. ></A
  48934. > a
  48935.      <A
  48936. HREF="#function.rsort"
  48937. ><B
  48938. CLASS="function"
  48939. >rsort()</B
  48940. ></A
  48941. >.
  48942.     </P
  48943. ></DIV
  48944. ><H1
  48945. ><A
  48946. NAME="function.usort"
  48947. ></A
  48948. >usort</H1
  48949. ><DIV
  48950. CLASS="refnamediv"
  48951. ><A
  48952. NAME="AEN9306"
  48953. ></A
  48954. ><P
  48955. >    (PHP 3>= 3.0.3, PHP 4 )</P
  48956. >usort -- 
  48957.      T°φdit pole podle hodnot pomocφ u╛ivatelsky definovanΘ porovnßvacφ funkce
  48958.     </DIV
  48959. ><DIV
  48960. CLASS="refsect1"
  48961. ><A
  48962. NAME="AEN9309"
  48963. ></A
  48964. ><H2
  48965. >Popis</H2
  48966. >void <B
  48967. CLASS="methodname"
  48968. >usort</B
  48969. > ( array array, string cmp_function)<BR
  48970. ></BR
  48971. ><P
  48972. >      Tato funkce t°φdφ pole podle hodnot pomocφ u╛ivatelsky definovanΘ
  48973.      porovnßvacφ funkce. Pokud pot°ebujete t°φdit pole podle komplikovan∞j╣φch
  48974.      kritΘriφ, m∞li byste pou╛φt tuto funkci.
  48975.     </P
  48976. ><P
  48977. >      Porovnßvacφ funkce musφ vrace integer men╣φ ne╛ 0, 0, a v∞t╣φ ne╛ 0, pokud
  48978.      je prvnφ argument men╣φ ne╛, stejn², nebo v∞t╣φ ne╛ druh² argument. Pokud
  48979.      jsou dv∞ porovnßvanΘ hodnoty stejnΘ, jejich po°adφ v t°φd∞nΘm poli je
  48980.      nedefinovßno.
  48981.     </P
  48982. ><P
  48983. >      <TABLE
  48984. WIDTH="100%"
  48985. BORDER="0"
  48986. CELLPADDING="0"
  48987. CELLSPACING="0"
  48988. CLASS="EXAMPLE"
  48989. ><TR
  48990. ><TD
  48991. ><DIV
  48992. CLASS="example"
  48993. ><A
  48994. NAME="AEN9323"
  48995. ></A
  48996. ><P
  48997. ><B
  48998. >P°φklad 1. Ukßzka <B
  48999. CLASS="function"
  49000. >usort()</B
  49001. ></B
  49002. ></P
  49003. ><TABLE
  49004. BORDER="0"
  49005. BGCOLOR="#E0E0E0"
  49006. CELLPADDING="5"
  49007. ><TR
  49008. ><TD
  49009. ><PRE
  49010. CLASS="php"
  49011. >function cmp ($a, $b) {
  49012.     if ($a == $b) return 0;
  49013.     return ($a > $b) ? -1 : 1;
  49014. }
  49015.  
  49016. $a = array (3, 2, 5, 6, 1);
  49017.  
  49018. usort ($a, "cmp");
  49019.  
  49020. while (list ($key, $value) = each ($a)) {
  49021.     echo "$key: $value\n";
  49022. }</PRE
  49023. ></TD
  49024. ></TR
  49025. ></TABLE
  49026. ></DIV
  49027. ></TD
  49028. ></TR
  49029. ></TABLE
  49030. >
  49031.     </P
  49032. ><P
  49033. >      Tato ukßzka zobrazφ:
  49034.     </P
  49035. ><P
  49036. >      <DIV
  49037. CLASS="informalexample"
  49038. ><A
  49039. NAME="AEN9329"
  49040. ></A
  49041. ><P
  49042. ></P
  49043. ><TABLE
  49044. BORDER="0"
  49045. BGCOLOR="#E0E0E0"
  49046. CELLPADDING="5"
  49047. ><TR
  49048. ><TD
  49049. ><PRE
  49050. CLASS="programlisting"
  49051. >0: 6
  49052. 1: 5
  49053. 2: 3
  49054. 3: 2
  49055. 4: 1</PRE
  49056. ></TD
  49057. ></TR
  49058. ></TABLE
  49059. ><P
  49060. ></P
  49061. ></DIV
  49062. >
  49063.     </P
  49064. ><DIV
  49065. CLASS="note"
  49066. ><BLOCKQUOTE
  49067. CLASS="note"
  49068. ><P
  49069. ><B
  49070. >Poznßmka: </B
  49071. >
  49072.       V tomto jednoduchΘm p°φpad∞ by pochopiteln∞ bylo vhodn∞j╣φ pou╛φt
  49073.       <A
  49074. HREF="#function.rsort"
  49075. ><B
  49076. CLASS="function"
  49077. >rsort()</B
  49078. ></A
  49079. >.
  49080.      </P
  49081. ></BLOCKQUOTE
  49082. ></DIV
  49083. ><P
  49084. >      <TABLE
  49085. WIDTH="100%"
  49086. BORDER="0"
  49087. CELLPADDING="0"
  49088. CELLSPACING="0"
  49089. CLASS="EXAMPLE"
  49090. ><TR
  49091. ><TD
  49092. ><DIV
  49093. CLASS="example"
  49094. ><A
  49095. NAME="AEN9335"
  49096. ></A
  49097. ><P
  49098. ><B
  49099. >P°φklad 2. 
  49100.        Ukßzka <B
  49101. CLASS="function"
  49102. >usort()</B
  49103. > s vφcerozm∞rn²m polem
  49104.       </B
  49105. ></P
  49106. ><TABLE
  49107. BORDER="0"
  49108. BGCOLOR="#E0E0E0"
  49109. CELLPADDING="5"
  49110. ><TR
  49111. ><TD
  49112. ><PRE
  49113. CLASS="php"
  49114. >function cmp ($a, $b) {
  49115.     return strcmp($a["fruit"],$b["fruit"]);
  49116. }
  49117.  
  49118. $fruits[0]["fruit"] = "lemons";
  49119. $fruits[1]["fruit"] = "apples";
  49120. $fruits[2]["fruit"] = "grapes";
  49121.  
  49122. usort($fruits, "cmp");
  49123.  
  49124. while (list ($key, $value) = each ($fruits)) {
  49125.     echo "\$fruits[$key]: " . $value["fruit"] . "\n";
  49126. }</PRE
  49127. ></TD
  49128. ></TR
  49129. ></TABLE
  49130. ></DIV
  49131. ></TD
  49132. ></TR
  49133. ></TABLE
  49134. >
  49135.     </P
  49136. ><P
  49137. >      P°i t°φd∞nφ vφcerozm∞rnΘho pole $a a $b obsahujφ reference na prvnφ index
  49138.      pole.
  49139.     </P
  49140. ><P
  49141. >      Tato ukßzka zobrazφ:
  49142.     </P
  49143. ><P
  49144. >      <DIV
  49145. CLASS="informalexample"
  49146. ><A
  49147. NAME="AEN9342"
  49148. ></A
  49149. ><P
  49150. ></P
  49151. ><TABLE
  49152. BORDER="0"
  49153. BGCOLOR="#E0E0E0"
  49154. CELLPADDING="5"
  49155. ><TR
  49156. ><TD
  49157. ><PRE
  49158. CLASS="programlisting"
  49159. >$fruits[0]: apples
  49160. $fruits[1]: grapes
  49161. $fruits[2]: lemons</PRE
  49162. ></TD
  49163. ></TR
  49164. ></TABLE
  49165. ><P
  49166. ></P
  49167. ></DIV
  49168. >
  49169.     </P
  49170. ><P
  49171. >      <DIV
  49172. CLASS="warning"
  49173. ><P
  49174. ></P
  49175. ><TABLE
  49176. CLASS="warning"
  49177. BORDER="1"
  49178. WIDTH="100%"
  49179. ><TR
  49180. ><TD
  49181. ALIGN="CENTER"
  49182. ><B
  49183. >Varovßnφ</B
  49184. ></TD
  49185. ></TR
  49186. ><TR
  49187. ><TD
  49188. ALIGN="LEFT"
  49189. ><P
  49190. >        Pou╛itß quicksort funkce v n∞kter²ch C knihovnßch (nap°. na systΘmech
  49191.        Solaris) m∙╛e zp∙sobit zhroucenφ PHP, pokud porovnßvacφ funkce nevracφ
  49192.        konsistentnφ hodnoty.
  49193.       </P
  49194. ></TD
  49195. ></TR
  49196. ></TABLE
  49197. ></DIV
  49198. >
  49199.     </P
  49200. ><P
  49201. >      Viz takΘ: <A
  49202. HREF="#function.uasort"
  49203. ><B
  49204. CLASS="function"
  49205. >uasort()</B
  49206. ></A
  49207. >,
  49208.      <A
  49209. HREF="#function.uksort"
  49210. ><B
  49211. CLASS="function"
  49212. >uksort()</B
  49213. ></A
  49214. >,
  49215.      <A
  49216. HREF="#function.sort"
  49217. ><B
  49218. CLASS="function"
  49219. >sort()</B
  49220. ></A
  49221. >,
  49222.      <A
  49223. HREF="#function.asort"
  49224. ><B
  49225. CLASS="function"
  49226. >asort()</B
  49227. ></A
  49228. >,
  49229.      <A
  49230. HREF="#function.arsort"
  49231. ><B
  49232. CLASS="function"
  49233. >arsort()</B
  49234. ></A
  49235. >,
  49236.      <A
  49237. HREF="#function.ksort"
  49238. ><B
  49239. CLASS="function"
  49240. >ksort()</B
  49241. ></A
  49242. >,
  49243.      <A
  49244. HREF="#function.natsort"
  49245. ><B
  49246. CLASS="function"
  49247. >natsort()</B
  49248. ></A
  49249. > a
  49250.      <A
  49251. HREF="#function.rsort"
  49252. ><B
  49253. CLASS="function"
  49254. >rsort()</B
  49255. ></A
  49256. >.
  49257.     </P
  49258. ></DIV
  49259. ></DIV
  49260. ><DIV
  49261. CLASS="reference"
  49262. ><A
  49263. NAME="ref.aspell"
  49264. ></A
  49265. ><DIV
  49266. CLASS="TITLEPAGE"
  49267. ><H1
  49268. CLASS="title"
  49269. >III. Aspell funkce [zastaralΘ]</H1
  49270. ><DIV
  49271. CLASS="PARTINTRO"
  49272. ><A
  49273. NAME="AEN9359"
  49274. ></A
  49275. ><DIV
  49276. CLASS="section"
  49277. ><H1
  49278. CLASS="section"
  49279. ><A
  49280. NAME="aspell.intro"
  49281. ></A
  49282. >┌vod</H1
  49283. ><P
  49284. >     <B
  49285. CLASS="function"
  49286. >aspell()</B
  49287. > funkce umo╛≥ujφ ov∞°it hlßskovßnφ slova
  49288.     a nabφdnout mo╛nΘ opravy.
  49289.     </P
  49290. ><DIV
  49291. CLASS="note"
  49292. ><BLOCKQUOTE
  49293. CLASS="note"
  49294. ><P
  49295. ><B
  49296. >Poznßmka: </B
  49297. >
  49298.      Toto roz╣φ°enφ bylo z PHP odebrßno a od PHP 4.3.0 nenφ
  49299.      k dispozici. Pokud chcete v PHP pou╛φt kontrolu hlßskovßnφ, pou╛ijte
  49300.      mφsto toho <A
  49301. HREF="#ref.pspell"
  49302. >pspell</A
  49303. >. Vyu╛φvß pspell
  49304.      knihovnu, a pracuje s nov∞j╣φmi verzemi aspellu.
  49305.     </P
  49306. ></BLOCKQUOTE
  49307. ></DIV
  49308. ></DIV
  49309. ><DIV
  49310. CLASS="section"
  49311. ><HR><H1
  49312. CLASS="section"
  49313. ><A
  49314. NAME="aspell.requirements"
  49315. ></A
  49316. >Po╛adavky</H1
  49317. ><P
  49318. >      Roz╣φ°enφ aspell funguje pouze s velmi star²mi (do p°ibli╛n∞ .27.*) verzemi
  49319.      aspell knihovny. Tento modul, ani tyto verze aspell knihovny u╛ nejsou
  49320.      podporovßny. Budete pot°ebovat knihovnu aspell dostupnou
  49321.      na: <A
  49322. HREF="http://aspell.sourceforge.net/"
  49323. TARGET="_top"
  49324. >http://aspell.sourceforge.net/</A
  49325. >.
  49326.     </P
  49327. ></DIV
  49328. ><DIV
  49329. CLASS="section"
  49330. ><HR><H1
  49331. CLASS="section"
  49332. ><A
  49333. NAME="aspell.installation"
  49334. ></A
  49335. >Instalace</H1
  49336. ><P
  49337. >   In PHP 4, these functions are only available if <TT
  49338. CLASS="literal"
  49339. >PHP</TT
  49340. > was
  49341.   configured with <TT
  49342. CLASS="option"
  49343. >--with-aspell=[DIR]</TT
  49344. >.
  49345.  </P
  49346. ></DIV
  49347. ><DIV
  49348. CLASS="section"
  49349. ><HR><H1
  49350. CLASS="section"
  49351. ><A
  49352. NAME="aspell.seealso"
  49353. ></A
  49354. >Viz takΘ</H1
  49355. ><P
  49356. >      Viz takΘ <A
  49357. HREF="#ref.pspell"
  49358. >pspell</A
  49359. >.
  49360.     </P
  49361. ></DIV
  49362. ></DIV
  49363. ><DIV
  49364. CLASS="TOC"
  49365. ><DL
  49366. ><DT
  49367. ><B
  49368. >Obsah</B
  49369. ></DT
  49370. ><DT
  49371. ><A
  49372. HREF="#function.aspell-check-raw"
  49373. >aspell_check_raw</A
  49374. > -- 
  49375.     Zkontrolovat slovo beze zm∞ny velikosti pφsmen nebo pokus∙ o o°ezßnφ
  49376.     </DT
  49377. ><DT
  49378. ><A
  49379. HREF="#function.aspell-check"
  49380. >aspell_check</A
  49381. > -- Zkontrolovat slovo</DT
  49382. ><DT
  49383. ><A
  49384. HREF="#function.aspell-new"
  49385. >aspell_new</A
  49386. > -- NaΦφst nov² slovnφk</DT
  49387. ><DT
  49388. ><A
  49389. HREF="#function.aspell-suggest"
  49390. >aspell_suggest</A
  49391. > -- Nabφdnout mo╛nΘ hlßskovßnφ slova</DT
  49392. ></DL
  49393. ></DIV
  49394. ></DIV
  49395. ><H1
  49396. ><A
  49397. NAME="function.aspell-check-raw"
  49398. ></A
  49399. >aspell_check_raw</H1
  49400. ><DIV
  49401. CLASS="refnamediv"
  49402. ><A
  49403. NAME="AEN9381"
  49404. ></A
  49405. ><P
  49406. >    (PHP 3>= 3.0.7, PHP 4  <= 4.2.3)</P
  49407. >aspell_check_raw -- 
  49408.     Zkontrolovat slovo beze zm∞ny velikosti pφsmen nebo pokus∙ o o°ezßnφ
  49409.     </DIV
  49410. ><DIV
  49411. CLASS="refsect1"
  49412. ><A
  49413. NAME="AEN9384"
  49414. ></A
  49415. ><H2
  49416. >Popis</H2
  49417. >boolean <B
  49418. CLASS="methodname"
  49419. >aspell_check_raw</B
  49420. > ( int dictionary_link, string word)<BR
  49421. ></BR
  49422. ><P
  49423. >      <B
  49424. CLASS="function"
  49425. >aspell_check_raw()</B
  49426. > zkontroluje hlßskovßnφ slova beze
  49427.      zm∞n velikosti pφsmen nebo pokus∙ ho jak²mkoliv zp∙sobem o°ezat, a vrßtφ
  49428.      <TT
  49429. CLASS="constant"
  49430. ><B
  49431. >TRUE</B
  49432. ></TT
  49433. >, pokud je hlßskovßnφ sprßvnΘ, a
  49434.      <TT
  49435. CLASS="constant"
  49436. ><B
  49437. >FALSE</B
  49438. ></TT
  49439. >, pokud nenφ.
  49440.     </P
  49441. ><P
  49442. >      <TABLE
  49443. WIDTH="100%"
  49444. BORDER="0"
  49445. CELLPADDING="0"
  49446. CELLSPACING="0"
  49447. CLASS="EXAMPLE"
  49448. ><TR
  49449. ><TD
  49450. ><DIV
  49451. CLASS="example"
  49452. ><A
  49453. NAME="AEN9400"
  49454. ></A
  49455. ><P
  49456. ><B
  49457. >P°φklad 1. <B
  49458. CLASS="function"
  49459. >aspell_check_raw()</B
  49460. ></B
  49461. ></P
  49462. ><TABLE
  49463. BORDER="0"
  49464. BGCOLOR="#E0E0E0"
  49465. CELLPADDING="5"
  49466. ><TR
  49467. ><TD
  49468. ><PRE
  49469. CLASS="php"
  49470. >$aspell_link=aspell_new ("english");
  49471. if (aspell_check_raw ($aspell_link, "test")) {
  49472.     echo "Toto je platnΘ hlßskovßnφ";
  49473. } else {
  49474.     echo "Pardon, ╣patnΘ hlßskovßnφ";
  49475. }</PRE
  49476. ></TD
  49477. ></TR
  49478. ></TABLE
  49479. ></DIV
  49480. ></TD
  49481. ></TR
  49482. ></TABLE
  49483. >
  49484.     </P
  49485. ></DIV
  49486. ><H1
  49487. ><A
  49488. NAME="function.aspell-check"
  49489. ></A
  49490. >aspell_check</H1
  49491. ><DIV
  49492. CLASS="refnamediv"
  49493. ><A
  49494. NAME="AEN9405"
  49495. ></A
  49496. ><P
  49497. >    (PHP 3>= 3.0.7, PHP 4  <= 4.2.3)</P
  49498. >aspell_check -- Zkontrolovat slovo</DIV
  49499. ><DIV
  49500. CLASS="refsect1"
  49501. ><A
  49502. NAME="AEN9408"
  49503. ></A
  49504. ><H2
  49505. >Popis</H2
  49506. >boolean <B
  49507. CLASS="methodname"
  49508. >aspell_check</B
  49509. > ( int dictionary_link, string word)<BR
  49510. ></BR
  49511. ><P
  49512. >      <B
  49513. CLASS="function"
  49514. >aspell_check()</B
  49515. > zkontroluje hlßskovßnφ slova a
  49516.      vrßtφ <TT
  49517. CLASS="constant"
  49518. ><B
  49519. >TRUE</B
  49520. ></TT
  49521. >, pokud je hlßskovßnφ sprßvnΘ, a
  49522.      <TT
  49523. CLASS="constant"
  49524. ><B
  49525. >FALSE</B
  49526. ></TT
  49527. >, pokud nenφ.
  49528.     </P
  49529. ><P
  49530. >      <TABLE
  49531. WIDTH="100%"
  49532. BORDER="0"
  49533. CELLPADDING="0"
  49534. CELLSPACING="0"
  49535. CLASS="EXAMPLE"
  49536. ><TR
  49537. ><TD
  49538. ><DIV
  49539. CLASS="example"
  49540. ><A
  49541. NAME="AEN9424"
  49542. ></A
  49543. ><P
  49544. ><B
  49545. >P°φklad 1. <B
  49546. CLASS="function"
  49547. >aspell_check()</B
  49548. ></B
  49549. ></P
  49550. ><TABLE
  49551. BORDER="0"
  49552. BGCOLOR="#E0E0E0"
  49553. CELLPADDING="5"
  49554. ><TR
  49555. ><TD
  49556. ><PRE
  49557. CLASS="programlisting"
  49558. >$aspell_link=aspell_new ("english");
  49559. if (aspell_check ($aspell_link, "testt")) {
  49560.     echo "Toto je platnΘ hlßskovßnφ";
  49561. } else {
  49562.     echo "Pardon, ╣patnΘ hlßskovßnφ";
  49563. }</PRE
  49564. ></TD
  49565. ></TR
  49566. ></TABLE
  49567. ></DIV
  49568. ></TD
  49569. ></TR
  49570. ></TABLE
  49571. >
  49572.     </P
  49573. ></DIV
  49574. ><H1
  49575. ><A
  49576. NAME="function.aspell-new"
  49577. ></A
  49578. >aspell_new</H1
  49579. ><DIV
  49580. CLASS="refnamediv"
  49581. ><A
  49582. NAME="AEN9429"
  49583. ></A
  49584. ><P
  49585. >    (PHP 3>= 3.0.7, PHP 4  <= 4.2.3)</P
  49586. >aspell_new -- NaΦφst nov² slovnφk</DIV
  49587. ><DIV
  49588. CLASS="refsect1"
  49589. ><A
  49590. NAME="AEN9432"
  49591. ></A
  49592. ><H2
  49593. >Popis</H2
  49594. >int <B
  49595. CLASS="methodname"
  49596. >aspell_new</B
  49597. > ( string master, string personal)<BR
  49598. ></BR
  49599. ><P
  49600. >      <B
  49601. CLASS="function"
  49602. >aspell_new()</B
  49603. > otev°e nov² slovnφk, a vrßtφ identifikßtor
  49604.      spojenφ na tento slovnφk vyu╛iteln² s dal╣φmi aspell funkcemi.
  49605.     </P
  49606. ><P
  49607. >      <TABLE
  49608. WIDTH="100%"
  49609. BORDER="0"
  49610. CELLPADDING="0"
  49611. CELLSPACING="0"
  49612. CLASS="EXAMPLE"
  49613. ><TR
  49614. ><TD
  49615. ><DIV
  49616. CLASS="example"
  49617. ><A
  49618. NAME="AEN9446"
  49619. ></A
  49620. ><P
  49621. ><B
  49622. >P°φklad 1. <B
  49623. CLASS="function"
  49624. >aspell_new()</B
  49625. ></B
  49626. ></P
  49627. ><TABLE
  49628. BORDER="0"
  49629. BGCOLOR="#E0E0E0"
  49630. CELLPADDING="5"
  49631. ><TR
  49632. ><TD
  49633. ><PRE
  49634. CLASS="php"
  49635. >$aspell_link=aspell_new ("english");</PRE
  49636. ></TD
  49637. ></TR
  49638. ></TABLE
  49639. ></DIV
  49640. ></TD
  49641. ></TR
  49642. ></TABLE
  49643. >
  49644.     </P
  49645. ></DIV
  49646. ><H1
  49647. ><A
  49648. NAME="function.aspell-suggest"
  49649. ></A
  49650. >aspell_suggest</H1
  49651. ><DIV
  49652. CLASS="refnamediv"
  49653. ><A
  49654. NAME="AEN9451"
  49655. ></A
  49656. ><P
  49657. >    (PHP 3>= 3.0.7, PHP 4  <= 4.2.3)</P
  49658. >aspell_suggest -- Nabφdnout mo╛nΘ hlßskovßnφ slova</DIV
  49659. ><DIV
  49660. CLASS="refsect1"
  49661. ><A
  49662. NAME="AEN9454"
  49663. ></A
  49664. ><H2
  49665. >Popis</H2
  49666. >array <B
  49667. CLASS="methodname"
  49668. >aspell_suggest</B
  49669. > ( int dictionary_link, string word)<BR
  49670. ></BR
  49671. ><P
  49672. >      <B
  49673. CLASS="function"
  49674. >aspell_suggest()</B
  49675. > vrßtφ pole mo╛n²ch hlßskovßnφ
  49676.      danΘho slova.
  49677.     </P
  49678. ><P
  49679. >      <TABLE
  49680. WIDTH="100%"
  49681. BORDER="0"
  49682. CELLPADDING="0"
  49683. CELLSPACING="0"
  49684. CLASS="EXAMPLE"
  49685. ><TR
  49686. ><TD
  49687. ><DIV
  49688. CLASS="example"
  49689. ><A
  49690. NAME="AEN9468"
  49691. ></A
  49692. ><P
  49693. ><B
  49694. >P°φklad 1. <B
  49695. CLASS="function"
  49696. >aspell_suggest()</B
  49697. ></B
  49698. ></P
  49699. ><TABLE
  49700. BORDER="0"
  49701. BGCOLOR="#E0E0E0"
  49702. CELLPADDING="5"
  49703. ><TR
  49704. ><TD
  49705. ><PRE
  49706. CLASS="php"
  49707. >$aspell_link=aspell_new ("english");
  49708.  
  49709. if (!aspell_check ($aspell_link, "test")) {
  49710.     $suggestions=aspell_suggest ($aspell_link, "test");
  49711.  
  49712.     for ($i=0; $i < count ($suggestions); $i++) {
  49713.         echo "Mo╛nΘ hlßskovßnφ: " . $suggestions[$i] . "<br>";
  49714.     }
  49715. }</PRE
  49716. ></TD
  49717. ></TR
  49718. ></TABLE
  49719. ></DIV
  49720. ></TD
  49721. ></TR
  49722. ></TABLE
  49723. >
  49724.     </P
  49725. ></DIV
  49726. ></DIV
  49727. ><DIV
  49728. CLASS="reference"
  49729. ><A
  49730. NAME="ref.bc"
  49731. ></A
  49732. ><DIV
  49733. CLASS="TITLEPAGE"
  49734. ><H1
  49735. CLASS="title"
  49736. >IV. BCMath funkce pro v²poΦty s libovolnou p°esnostφ</H1
  49737. ><DIV
  49738. CLASS="PARTINTRO"
  49739. ><A
  49740. NAME="AEN9475"
  49741. ></A
  49742. ><DIV
  49743. CLASS="section"
  49744. ><H1
  49745. CLASS="section"
  49746. ><A
  49747. NAME="bc.intro"
  49748. ></A
  49749. >┌vod</H1
  49750. ><P
  49751. >      Pro prßci s Φφsly libovolnΘ p°esnosti PHP nabφzφ Binary Calculator, kter²
  49752.      podporuje Φφsla libovoln∞ velkß a s libovolnou p°esnostφ, kterß jsou reprezentovßna jako °et∞zce.
  49753.     </P
  49754. ></DIV
  49755. ><DIV
  49756. CLASS="section"
  49757. ><HR><H1
  49758. CLASS="section"
  49759. ><A
  49760. NAME="bc.requirements"
  49761. ></A
  49762. >Po╛adavky</H1
  49763. ><P
  49764. >      Od PHP 4.0.4 je knihovna libbcmath dodßvßna s PHP. Pro toto roz╣φ°enφ tedy
  49765.      nepot°ebujete ╛ßdnΘ externφ knihovny.
  49766.     </P
  49767. ></DIV
  49768. ><DIV
  49769. CLASS="section"
  49770. ><HR><H1
  49771. CLASS="section"
  49772. ><A
  49773. NAME="bc.installation"
  49774. ></A
  49775. >Instalace</H1
  49776. ><P
  49777. >   Tyto funkce jsou v PHP 4 dostupnΘ pouze pokud bylo PHP zkonfigurovßno s volbou
  49778.   <TT
  49779. CLASS="option"
  49780. >--enable-bcmath</TT
  49781. >.
  49782.   V PHP 3 jsou dostupnΘ, pokud nebylo zkonfigurovßno
  49783.   s volbou <TT
  49784. CLASS="option"
  49785. >--disable-bcmath</TT
  49786. >.
  49787.  </P
  49788. ><P
  49789. >Verze <TT
  49790. CLASS="literal"
  49791. >PHP</TT
  49792. > pro Windows
  49793. mß vestav∞nou podporu pro toto roz╣φ°enφ. K pou╛itφ t∞chto funkcφ nenφ t°eba
  49794. naΦφtat ╛ßdnß dal╣φ roz╣φ°enφ.</P
  49795. ></DIV
  49796. ><DIV
  49797. CLASS="section"
  49798. ><HR><H1
  49799. CLASS="section"
  49800. ><A
  49801. NAME="bc.configuration"
  49802. ></A
  49803. >Konfigurace b∞hu</H1
  49804. ><P
  49805. > Chovßnφ t∞chto funkcφ je ovlivn∞no nastavenφm parametr∙ v <TT
  49806. CLASS="filename"
  49807. >php.ini</TT
  49808. >.
  49809. </P
  49810. ><P
  49811. >  <DIV
  49812. CLASS="table"
  49813. ><A
  49814. NAME="AEN9494"
  49815. ></A
  49816. ><P
  49817. ><B
  49818. >Tabulka 1. BC math configuration options</B
  49819. ></P
  49820. ><TABLE
  49821. BORDER="1"
  49822. CLASS="CALSTABLE"
  49823. ><THEAD
  49824. ><TR
  49825. ><TH
  49826. ALIGN="LEFT"
  49827. VALIGN="MIDDLE"
  49828. >Name</TH
  49829. ><TH
  49830. ALIGN="LEFT"
  49831. VALIGN="MIDDLE"
  49832. >Default</TH
  49833. ><TH
  49834. ALIGN="LEFT"
  49835. VALIGN="MIDDLE"
  49836. >Changeable</TH
  49837. ></TR
  49838. ></THEAD
  49839. ><TBODY
  49840. ><TR
  49841. ><TD
  49842. ALIGN="LEFT"
  49843. VALIGN="MIDDLE"
  49844. >bcmath.scale</TD
  49845. ><TD
  49846. ALIGN="LEFT"
  49847. VALIGN="MIDDLE"
  49848. >0</TD
  49849. ><TD
  49850. ALIGN="LEFT"
  49851. VALIGN="MIDDLE"
  49852. >PHP_INI_ALL</TD
  49853. ></TR
  49854. ></TBODY
  49855. ></TABLE
  49856. ></DIV
  49857. >
  49858.   For further details and definition of the PHP_INI_* constants see
  49859.   <A
  49860. HREF="#function.ini-set"
  49861. ><B
  49862. CLASS="function"
  49863. >ini_set()</B
  49864. ></A
  49865. >.
  49866.  </P
  49867. ><P
  49868. >Zde je struΦnΘ vysv∞tlenφ
  49869. konfiguraΦnφch direktiv.</P
  49870. ><P
  49871. >   <P
  49872. ></P
  49873. ><DIV
  49874. CLASS="variablelist"
  49875. ><DL
  49876. ><DT
  49877. ><A
  49878. NAME="ini.bcmath.scale"
  49879. ></A
  49880. ><TT
  49881. CLASS="parameter"
  49882. ><I
  49883. >bcmath.scale</I
  49884. ></TT
  49885. >
  49886.      <A
  49887. HREF="#language.types.integer"
  49888. ><B
  49889. CLASS="type"
  49890. >integer</B
  49891. ></A
  49892. ></DT
  49893. ><DD
  49894. ><P
  49895. >       Number of decimal digits for all bcmath functions.
  49896.      </P
  49897. ></DD
  49898. ></DL
  49899. ></DIV
  49900. >
  49901.  </P
  49902. ></DIV
  49903. ><DIV
  49904. CLASS="section"
  49905. ><HR><H1
  49906. CLASS="section"
  49907. ><A
  49908. NAME="bc.resources"
  49909. ></A
  49910. >Typy prost°edk∙</H1
  49911. ><P
  49912. >Toto roz╣φ°enφ nemß definovßn ╛ßdn² typ prost°edku
  49913. (resource).</P
  49914. ></DIV
  49915. ><DIV
  49916. CLASS="section"
  49917. ><HR><H1
  49918. CLASS="section"
  49919. ><A
  49920. NAME="bc.constants"
  49921. ></A
  49922. >P°eddefinovanΘ konstanty</H1
  49923. ><P
  49924. >Toto roz╣φ°enφ nemß definovßny ╛ßdnΘ
  49925. konstanty.</P
  49926. ></DIV
  49927. ></DIV
  49928. ><DIV
  49929. CLASS="TOC"
  49930. ><DL
  49931. ><DT
  49932. ><B
  49933. >Obsah</B
  49934. ></DT
  49935. ><DT
  49936. ><A
  49937. HREF="#function.bcadd"
  49938. >bcadd</A
  49939. > -- SeΦφst dv∞ Φφsla s libovolnou p°esnostφ</DT
  49940. ><DT
  49941. ><A
  49942. HREF="#function.bccomp"
  49943. >bccomp</A
  49944. > -- Porovnat dv∞ Φφsla s libovolnou p°esnostφ</DT
  49945. ><DT
  49946. ><A
  49947. HREF="#function.bcdiv"
  49948. >bcdiv</A
  49949. > -- D∞lit dv∞ Φφsla s libovolnou p°esnostφ</DT
  49950. ><DT
  49951. ><A
  49952. HREF="#function.bcmod"
  49953. >bcmod</A
  49954. > -- Zφskat modulus Φφsla s libovolnou p°esnostφ</DT
  49955. ><DT
  49956. ><A
  49957. HREF="#function.bcmul"
  49958. >bcmul</A
  49959. > -- Vynßsobit dv∞ Φφsla s libovolnou p°esnostφ</DT
  49960. ><DT
  49961. ><A
  49962. HREF="#function.bcpow"
  49963. >bcpow</A
  49964. > -- 
  49965.     Umocnit jedno Φφslo na jinΘ s libovolnou p°esnostφ
  49966.     </DT
  49967. ><DT
  49968. ><A
  49969. HREF="#function.bcpowmod"
  49970. >bcpowmod</A
  49971. > -- 
  49972.      Raise an arbitrary precision number to another, reduced by a specified modulus.
  49973.     </DT
  49974. ><DT
  49975. ><A
  49976. HREF="#function.bcscale"
  49977. >bcscale</A
  49978. > -- Nastavit v²chozφ ╣kßlu pro v╣echny bc math funkce
  49979.     </DT
  49980. ><DT
  49981. ><A
  49982. HREF="#function.bcsqrt"
  49983. >bcsqrt</A
  49984. > -- 
  49985.     Zφskat druhou odmocninu Φφsla s libovolnou p°esnostφ
  49986.     </DT
  49987. ><DT
  49988. ><A
  49989. HREF="#function.bcsub"
  49990. >bcsub</A
  49991. > -- 
  49992.     OdeΦφst jedno Φφslo od druhΘho s libovolnou p°esnostφ
  49993.     </DT
  49994. ></DL
  49995. ></DIV
  49996. ></DIV
  49997. ><H1
  49998. ><A
  49999. NAME="function.bcadd"
  50000. ></A
  50001. >bcadd</H1
  50002. ><DIV
  50003. CLASS="refnamediv"
  50004. ><A
  50005. NAME="AEN9524"
  50006. ></A
  50007. ><P
  50008. >    (PHP 3, PHP 4 )</P
  50009. >bcadd -- SeΦφst dv∞ Φφsla s libovolnou p°esnostφ</DIV
  50010. ><DIV
  50011. CLASS="refsect1"
  50012. ><A
  50013. NAME="AEN9527"
  50014. ></A
  50015. ><H2
  50016. >Popis</H2
  50017. >string <B
  50018. CLASS="methodname"
  50019. >bcadd</B
  50020. > ( string left operand, string right operand [, int scale])<BR
  50021. ></BR
  50022. ><P
  50023. >      P°iΦte <TT
  50024. CLASS="parameter"
  50025. ><I
  50026. >left operand</I
  50027. ></TT
  50028. > k
  50029.      <TT
  50030. CLASS="parameter"
  50031. ><I
  50032. >right operand</I
  50033. ></TT
  50034. > a vrßtφ souΦet v °et∞zci.
  50035.      Voliteln² argument <TT
  50036. CLASS="parameter"
  50037. ><I
  50038. >scale</I
  50039. ></TT
  50040. > se pou╛φvß k
  50041.      urΦenφ poΦtu desetinn²ch mφst ve v²sledku.
  50042.     </P
  50043. ><P
  50044. >      Viz takΘ <A
  50045. HREF="#function.bcsub"
  50046. ><B
  50047. CLASS="function"
  50048. >bcsub()</B
  50049. ></A
  50050. >.
  50051.     </P
  50052. ></DIV
  50053. ><H1
  50054. ><A
  50055. NAME="function.bccomp"
  50056. ></A
  50057. >bccomp</H1
  50058. ><DIV
  50059. CLASS="refnamediv"
  50060. ><A
  50061. NAME="AEN9548"
  50062. ></A
  50063. ><P
  50064. >    (PHP 3, PHP 4 )</P
  50065. >bccomp -- Porovnat dv∞ Φφsla s libovolnou p°esnostφ</DIV
  50066. ><DIV
  50067. CLASS="refsect1"
  50068. ><A
  50069. NAME="AEN9551"
  50070. ></A
  50071. ><H2
  50072. >Popis</H2
  50073. >int <B
  50074. CLASS="methodname"
  50075. >bccomp</B
  50076. > ( string left operand, string right operand [, int scale])<BR
  50077. ></BR
  50078. ><P
  50079. >     Porovnß <TT
  50080. CLASS="parameter"
  50081. ><I
  50082. >left operand</I
  50083. ></TT
  50084. > s
  50085.      <TT
  50086. CLASS="parameter"
  50087. ><I
  50088. >right operand</I
  50089. ></TT
  50090. > a vrßtφ v²sledek jako integer.
  50091.      Voliteln² argument <TT
  50092. CLASS="parameter"
  50093. ><I
  50094. >scale</I
  50095. ></TT
  50096. > se pou╛φvß k
  50097.      urΦenφ poΦtu desetinn²ch mφst pou╛it²ch p°i porovnßnφ. Nßvratovß hodnota
  50098.      je 0, pokud jsou si oba operandy rovnΘ. Pokud je
  50099.      <TT
  50100. CLASS="parameter"
  50101. ><I
  50102. >left operand</I
  50103. ></TT
  50104. > v∞t╣φ ne╛
  50105.      <TT
  50106. CLASS="parameter"
  50107. ><I
  50108. >right operand</I
  50109. ></TT
  50110. >, nßvratovß hodnota je +1, a pokud je
  50111.      <TT
  50112. CLASS="parameter"
  50113. ><I
  50114. >left operand</I
  50115. ></TT
  50116. > men╣φ ne╛
  50117.      <TT
  50118. CLASS="parameter"
  50119. ><I
  50120. >right operand</I
  50121. ></TT
  50122. >, nßvratovß hodnota je -1.
  50123.     </P
  50124. ></DIV
  50125. ><H1
  50126. ><A
  50127. NAME="function.bcdiv"
  50128. ></A
  50129. >bcdiv</H1
  50130. ><DIV
  50131. CLASS="refnamediv"
  50132. ><A
  50133. NAME="AEN9574"
  50134. ></A
  50135. ><P
  50136. >    (PHP 3, PHP 4 )</P
  50137. >bcdiv -- D∞lit dv∞ Φφsla s libovolnou p°esnostφ</DIV
  50138. ><DIV
  50139. CLASS="refsect1"
  50140. ><A
  50141. NAME="AEN9577"
  50142. ></A
  50143. ><H2
  50144. >Popis</H2
  50145. >string <B
  50146. CLASS="methodname"
  50147. >bcdiv</B
  50148. > ( string left operand, string right operand [, int scale])<BR
  50149. ></BR
  50150. ><P
  50151. >     Vyd∞lφ argument <TT
  50152. CLASS="parameter"
  50153. ><I
  50154. >left operand</I
  50155. ></TT
  50156. > argumentem
  50157.     <TT
  50158. CLASS="parameter"
  50159. ><I
  50160. >right operand</I
  50161. ></TT
  50162. > a vrßtφ v²sledek.
  50163.     Voliteln² argument <TT
  50164. CLASS="parameter"
  50165. ><I
  50166. >scale</I
  50167. ></TT
  50168. > se pou╛φvß k
  50169.     urΦenφ poΦtu desetinn²ch mφst ve v²sledku.
  50170.     </P
  50171. ><P
  50172. >      Viz takΘ <A
  50173. HREF="#function.bcmul"
  50174. ><B
  50175. CLASS="function"
  50176. >bcmul()</B
  50177. ></A
  50178. >.
  50179.     </P
  50180. ></DIV
  50181. ><H1
  50182. ><A
  50183. NAME="function.bcmod"
  50184. ></A
  50185. >bcmod</H1
  50186. ><DIV
  50187. CLASS="refnamediv"
  50188. ><A
  50189. NAME="AEN9598"
  50190. ></A
  50191. ><P
  50192. >    (PHP 3, PHP 4 )</P
  50193. >bcmod -- Zφskat modulus Φφsla s libovolnou p°esnostφ</DIV
  50194. ><DIV
  50195. CLASS="refsect1"
  50196. ><A
  50197. NAME="AEN9601"
  50198. ></A
  50199. ><H2
  50200. >Popis</H2
  50201. >string <B
  50202. CLASS="methodname"
  50203. >bcmod</B
  50204. > ( string left operand, string modulus)<BR
  50205. ></BR
  50206. ><P
  50207. >     Vrßtφ modulus argumentu <TT
  50208. CLASS="parameter"
  50209. ><I
  50210. >left operand</I
  50211. ></TT
  50212. > s pou╛itφm
  50213.     argumentu <TT
  50214. CLASS="parameter"
  50215. ><I
  50216. >modulus</I
  50217. ></TT
  50218. >.
  50219.     </P
  50220. ><P
  50221. >      Viz takΘ <A
  50222. HREF="#function.bcdiv"
  50223. ><B
  50224. CLASS="function"
  50225. >bcdiv()</B
  50226. ></A
  50227. >.
  50228.     </P
  50229. ></DIV
  50230. ><H1
  50231. ><A
  50232. NAME="function.bcmul"
  50233. ></A
  50234. >bcmul</H1
  50235. ><DIV
  50236. CLASS="refnamediv"
  50237. ><A
  50238. NAME="AEN9618"
  50239. ></A
  50240. ><P
  50241. >    (PHP 3, PHP 4 )</P
  50242. >bcmul -- Vynßsobit dv∞ Φφsla s libovolnou p°esnostφ</DIV
  50243. ><DIV
  50244. CLASS="refsect1"
  50245. ><A
  50246. NAME="AEN9621"
  50247. ></A
  50248. ><H2
  50249. >Popis</H2
  50250. >string <B
  50251. CLASS="methodname"
  50252. >bcmul</B
  50253. > ( string left operand, string right operand [, int scale])<BR
  50254. ></BR
  50255. ><P
  50256. >     Vynßsobφ argument <TT
  50257. CLASS="parameter"
  50258. ><I
  50259. >left operand</I
  50260. ></TT
  50261. > argumentem
  50262.     <TT
  50263. CLASS="parameter"
  50264. ><I
  50265. >right operand</I
  50266. ></TT
  50267. > a vrßtφ v²sledek.
  50268.     Voliteln² argument <TT
  50269. CLASS="parameter"
  50270. ><I
  50271. >scale</I
  50272. ></TT
  50273. > se pou╛φvß k
  50274.     urΦenφ poΦtu desetinn²ch mφst ve v²sledku.
  50275.     </P
  50276. ><P
  50277. >      Viz takΘ <A
  50278. HREF="#function.bcdiv"
  50279. ><B
  50280. CLASS="function"
  50281. >bcdiv()</B
  50282. ></A
  50283. >.
  50284.     </P
  50285. ></DIV
  50286. ><H1
  50287. ><A
  50288. NAME="function.bcpow"
  50289. ></A
  50290. >bcpow</H1
  50291. ><DIV
  50292. CLASS="refnamediv"
  50293. ><A
  50294. NAME="AEN9642"
  50295. ></A
  50296. ><P
  50297. >    (PHP 3, PHP 4 )</P
  50298. >bcpow -- 
  50299.     Umocnit jedno Φφslo na jinΘ s libovolnou p°esnostφ
  50300.     </DIV
  50301. ><DIV
  50302. CLASS="refsect1"
  50303. ><A
  50304. NAME="AEN9645"
  50305. ></A
  50306. ><H2
  50307. >Popis</H2
  50308. >string <B
  50309. CLASS="methodname"
  50310. >bcpow</B
  50311. > ( string x, string y [, int scale])<BR
  50312. ></BR
  50313. ><P
  50314. >      Umocnφ <TT
  50315. CLASS="parameter"
  50316. ><I
  50317. >x</I
  50318. ></TT
  50319. > na <TT
  50320. CLASS="parameter"
  50321. ><I
  50322. >y</I
  50323. ></TT
  50324. >.
  50325.      Voliteln² argument <TT
  50326. CLASS="parameter"
  50327. ><I
  50328. >scale</I
  50329. ></TT
  50330. > se pou╛φvß k
  50331.      urΦenφ poΦtu desetinn²ch mφst ve v²sledku.
  50332.     </P
  50333. ><P
  50334. >      Viz takΘ <A
  50335. HREF="#function.bcsqrt"
  50336. ><B
  50337. CLASS="function"
  50338. >bcsqrt()</B
  50339. ></A
  50340. >.
  50341.     </P
  50342. ></DIV
  50343. ><H1
  50344. ><A
  50345. NAME="function.bcpowmod"
  50346. ></A
  50347. >bcpowmod</H1
  50348. ><DIV
  50349. CLASS="refnamediv"
  50350. ><A
  50351. NAME="AEN9666"
  50352. ></A
  50353. ><P
  50354. >    (PHP 5 CVS only)</P
  50355. >bcpowmod -- 
  50356.      Raise an arbitrary precision number to another, reduced by a specified modulus.
  50357.     </DIV
  50358. ><DIV
  50359. CLASS="refsect1"
  50360. ><A
  50361. NAME="AEN9669"
  50362. ></A
  50363. ><H2
  50364. >Description</H2
  50365. >string <B
  50366. CLASS="methodname"
  50367. >bcpowmod</B
  50368. > ( string x, string y, string modulus [, int scale])<BR
  50369. ></BR
  50370. ><P
  50371. >      Use the fast-exponentiation method to raise <TT
  50372. CLASS="parameter"
  50373. ><I
  50374. >x</I
  50375. ></TT
  50376.      to the power <TT
  50377. CLASS="parameter"
  50378. ><I
  50379. >y</I
  50380. ></TT
  50381. > with respect to the modulus
  50382.      <TT
  50383. CLASS="parameter"
  50384. ><I
  50385. >modulus</I
  50386. ></TT
  50387. >.  The optional
  50388.      <TT
  50389. CLASS="parameter"
  50390. ><I
  50391. >scale</I
  50392. ></TT
  50393. > can be used to set the number of
  50394.      digits after the decimal place in the result. 
  50395.     </P
  50396. ><P
  50397. >      The following two statements are functionally identical.  The 
  50398.      <B
  50399. CLASS="function"
  50400. >bcpowmod()</B
  50401. > version however, executes in 
  50402.      less time and can accept larger parameters.
  50403.      <DIV
  50404. CLASS="informalexample"
  50405. ><A
  50406. NAME="AEN9693"
  50407. ></A
  50408. ><P
  50409. ></P
  50410. ><TABLE
  50411. BORDER="0"
  50412. BGCOLOR="#E0E0E0"
  50413. CELLPADDING="5"
  50414. ><TR
  50415. ><TD
  50416. ><PRE
  50417. CLASS="php"
  50418. ><?php
  50419. $a = bcpowmod($x, $y, $mod);
  50420.  
  50421. $b = bcmod(bcpow($x, $y), $mod);
  50422.  
  50423. // $a and $b are equal to each other. 
  50424.  
  50425. ?></PRE
  50426. ></TD
  50427. ></TR
  50428. ></TABLE
  50429. ><P
  50430. ></P
  50431. ></DIV
  50432. >
  50433.     </P
  50434. ><P
  50435. >      <DIV
  50436. CLASS="note"
  50437. ><BLOCKQUOTE
  50438. CLASS="note"
  50439. ><P
  50440. ><B
  50441. >Poznßmka: </B
  50442. >
  50443.        Because this method uses the modulus operation, non-natural numbers
  50444.        may give unexpected results.  A natural number is any positive 
  50445.        non-zero integer.
  50446.       </P
  50447. ></BLOCKQUOTE
  50448. ></DIV
  50449. >
  50450.     </P
  50451. ><P
  50452. >      See also <A
  50453. HREF="#function.bcpow"
  50454. ><B
  50455. CLASS="function"
  50456. >bcpow()</B
  50457. ></A
  50458. >, and
  50459.      <A
  50460. HREF="#function.bcmod"
  50461. ><B
  50462. CLASS="function"
  50463. >bcmod()</B
  50464. ></A
  50465. >.
  50466.     </P
  50467. ></DIV
  50468. ><H1
  50469. ><A
  50470. NAME="function.bcscale"
  50471. ></A
  50472. >bcscale</H1
  50473. ><DIV
  50474. CLASS="refnamediv"
  50475. ><A
  50476. NAME="AEN9702"
  50477. ></A
  50478. ><P
  50479. >    (PHP 3, PHP 4 )</P
  50480. >bcscale -- Nastavit v²chozφ ╣kßlu pro v╣echny bc math funkce
  50481.     </DIV
  50482. ><DIV
  50483. CLASS="refsect1"
  50484. ><A
  50485. NAME="AEN9705"
  50486. ></A
  50487. ><H2
  50488. >Popis</H2
  50489. >string <B
  50490. CLASS="methodname"
  50491. >bcscale</B
  50492. > ( int scale)<BR
  50493. ></BR
  50494. ><P
  50495. >     Tato funkce nastavφ v²chozφ ╣kßlu pro v╣echna nßslednß volßnφ
  50496.     bc math funkcφ, ktera neudßvajφ explicitn∞ ╣kßlu p°esnosti.
  50497.     </P
  50498. ></DIV
  50499. ><H1
  50500. ><A
  50501. NAME="function.bcsqrt"
  50502. ></A
  50503. >bcsqrt</H1
  50504. ><DIV
  50505. CLASS="refnamediv"
  50506. ><A
  50507. NAME="AEN9715"
  50508. ></A
  50509. ><P
  50510. >    (PHP 3, PHP 4 )</P
  50511. >bcsqrt -- 
  50512.     Zφskat druhou odmocninu Φφsla s libovolnou p°esnostφ
  50513.     </DIV
  50514. ><DIV
  50515. CLASS="refsect1"
  50516. ><A
  50517. NAME="AEN9718"
  50518. ></A
  50519. ><H2
  50520. >Popis</H2
  50521. >string <B
  50522. CLASS="methodname"
  50523. >bcsqrt</B
  50524. > ( string operand, int scale)<BR
  50525. ></BR
  50526. ><P
  50527. >     Vrßtφ druhou odmocninu argumentu <TT
  50528. CLASS="parameter"
  50529. ><I
  50530. >operand</I
  50531. ></TT
  50532. >.
  50533.     Voliteln² argument <TT
  50534. CLASS="parameter"
  50535. ><I
  50536. >scale</I
  50537. ></TT
  50538. > se pou╛φvß k
  50539.     urΦenφ poΦtu desetinn²ch mφst ve v²sledku.
  50540.     </P
  50541. ><P
  50542. >     Viz takΘ <A
  50543. HREF="#function.bcpow"
  50544. ><B
  50545. CLASS="function"
  50546. >bcpow()</B
  50547. ></A
  50548. >.
  50549.     </P
  50550. ></DIV
  50551. ><H1
  50552. ><A
  50553. NAME="function.bcsub"
  50554. ></A
  50555. >bcsub</H1
  50556. ><DIV
  50557. CLASS="refnamediv"
  50558. ><A
  50559. NAME="AEN9735"
  50560. ></A
  50561. ><P
  50562. >    (PHP 3, PHP 4 )</P
  50563. >bcsub -- 
  50564.     OdeΦφst jedno Φφslo od druhΘho s libovolnou p°esnostφ
  50565.     </DIV
  50566. ><DIV
  50567. CLASS="refsect1"
  50568. ><A
  50569. NAME="AEN9738"
  50570. ></A
  50571. ><H2
  50572. >Popis</H2
  50573. >string <B
  50574. CLASS="methodname"
  50575. >bcsub</B
  50576. > ( string left operand, string right operand [, int scale])<BR
  50577. ></BR
  50578. ><P
  50579. >     OdeΦte argument <TT
  50580. CLASS="parameter"
  50581. ><I
  50582. >right operand</I
  50583. ></TT
  50584. > od argumentu
  50585.     <TT
  50586. CLASS="parameter"
  50587. ><I
  50588. >left operand</I
  50589. ></TT
  50590. > a vrßtφ v²sledek v °et∞zci.
  50591.     Voliteln² argument <TT
  50592. CLASS="parameter"
  50593. ><I
  50594. >scale</I
  50595. ></TT
  50596. > se pou╛φvß k
  50597.     urΦenφ poΦtu desetinn²ch mφst ve v²sledku.
  50598.     </P
  50599. ><P
  50600. >     Viz takΘ <A
  50601. HREF="#function.bcadd"
  50602. ><B
  50603. CLASS="function"
  50604. >bcadd()</B
  50605. ></A
  50606. >.
  50607.     </P
  50608. ></DIV
  50609. ></DIV
  50610. ><DIV
  50611. CLASS="reference"
  50612. ><A
  50613. NAME="ref.bzip2"
  50614. ></A
  50615. ><DIV
  50616. CLASS="TITLEPAGE"
  50617. ><H1
  50618. CLASS="title"
  50619. >V. Kompresnφ funkce bzip2</H1
  50620. ><DIV
  50621. CLASS="PARTINTRO"
  50622. ><A
  50623. NAME="AEN9761"
  50624. ></A
  50625. ><DIV
  50626. CLASS="section"
  50627. ><H1
  50628. CLASS="section"
  50629. ><A
  50630. NAME="bzip2.intro"
  50631. ></A
  50632. >┌vod</H1
  50633. ><P
  50634. >      Funkce bzip2 se pou╛φvajφ k transparentnφmu Φtenφ a zßpisu soubor∙
  50635.      komprimovan²ch algoritmem bzip2 (.bz2).
  50636.     </P
  50637. ></DIV
  50638. ><DIV
  50639. CLASS="section"
  50640. ><HR><H1
  50641. CLASS="section"
  50642. ><A
  50643. NAME="bzip2.requirements"
  50644. ></A
  50645. >Po╛adavky</H1
  50646. ><P
  50647. >      Tento modul pou╛φvß funkce z knihovny <A
  50648. HREF="http://sources.redhat.com/bzip2/"
  50649. TARGET="_top"
  50650. >bzip2</A
  50651. > od Juliana Sewarda.
  50652.      Tento modul vy╛aduje bzip2/libbzip2 verze >= 1.0.x.
  50653.     </P
  50654. ></DIV
  50655. ><DIV
  50656. CLASS="section"
  50657. ><HR><H1
  50658. CLASS="section"
  50659. ><A
  50660. NAME="bzip2.installation"
  50661. ></A
  50662. >Instalace</H1
  50663. ><P
  50664. >   Podpora bzip2 nenφ v PHP implicitn∞ k dispozici. K aktivaci budete muset
  50665.   p°i kompilaci PHP pou╛φt konfiguraΦnφ volbu
  50666.   <TT
  50667. CLASS="option"
  50668. >--with-bz2[=DIR]</TT
  50669. >.
  50670.  </P
  50671. ></DIV
  50672. ><DIV
  50673. CLASS="section"
  50674. ><HR><H1
  50675. CLASS="section"
  50676. ><A
  50677. NAME="bzip2.configuration"
  50678. ></A
  50679. >Konfigurace b∞hu</H1
  50680. ><P
  50681. >Toto roz╣φ°enφ nemß definovßno ╛ßdnΘ konfiguraΦnφ
  50682. direktivy.</P
  50683. ></DIV
  50684. ><DIV
  50685. CLASS="section"
  50686. ><HR><H1
  50687. CLASS="section"
  50688. ><A
  50689. NAME="bzip2.resources"
  50690. ></A
  50691. >Typy prost°edk∙</H1
  50692. ><P
  50693. >      Toto roz╣φ°enφ definuje jeden typ prost°edku: souborov² ukazatel
  50694.      identifikujφcφ soubor bz2, nad kter²m se pracuje.
  50695.     </P
  50696. ></DIV
  50697. ><DIV
  50698. CLASS="section"
  50699. ><HR><H1
  50700. CLASS="section"
  50701. ><A
  50702. NAME="bzip2.constants"
  50703. ></A
  50704. >P°eddefinovanΘ konstanty</H1
  50705. ><P
  50706. >Toto roz╣φ°enφ nemß definovßny ╛ßdnΘ
  50707. konstanty.</P
  50708. ></DIV
  50709. ><DIV
  50710. CLASS="section"
  50711. ><HR><H1
  50712. CLASS="section"
  50713. ><A
  50714. NAME="bzip2.examples"
  50715. ></A
  50716. >P°φklady</H1
  50717. ><P
  50718. >      Tento p°φklad otev°e doΦasn² soubor a zapφ╣e do n∞j testovacφ °etezec;
  50719.      potom vypφ╣e obsah souboru.
  50720.     </P
  50721. ><TABLE
  50722. WIDTH="100%"
  50723. BORDER="0"
  50724. CELLPADDING="0"
  50725. CELLSPACING="0"
  50726. CLASS="EXAMPLE"
  50727. ><TR
  50728. ><TD
  50729. ><DIV
  50730. CLASS="example"
  50731. ><A
  50732. NAME="AEN9785"
  50733. ></A
  50734. ><P
  50735. ><B
  50736. >P°φklad 1. Mal² p°φklad na bzip2</B
  50737. ></P
  50738. ><TABLE
  50739. BORDER="0"
  50740. BGCOLOR="#E0E0E0"
  50741. CELLPADDING="5"
  50742. ><TR
  50743. ><TD
  50744. ><PRE
  50745. CLASS="php"
  50746. ><?php
  50747.  
  50748. $filename = "/tmp/testfile.bz2";
  50749. $str = "Toto je testovacφ °et∞zec.\n";
  50750.  
  50751. // otev°i soubor pro zßpis
  50752. $bz = bzopen($filename, "w");
  50753.  
  50754. // zapo╣ °et∞zec do souboru
  50755. bzwrite($bz, $str);
  50756.  
  50757. // zav°i soubor
  50758. bzclose($bz);
  50759.  
  50760. // otev°i soubor pro Φtenφ
  50761. $bz = bzopen($filename, "r");
  50762.  
  50763. // p°eΦti 10 znak∙
  50764. print bzread($bz, 10);
  50765.  
  50766. // tiskni dokud nenφ konec souboru (nebo nßsledujφcφ 1024. znak) a zav°i soubor  
  50767. print bzread($bz);
  50768.  
  50769. bzclose($bz);
  50770.  
  50771. ?></PRE
  50772. ></TD
  50773. ></TR
  50774. ></TABLE
  50775. ></DIV
  50776. ></TD
  50777. ></TR
  50778. ></TABLE
  50779. ></DIV
  50780. ></DIV
  50781. ><DIV
  50782. CLASS="TOC"
  50783. ><DL
  50784. ><DT
  50785. ><B
  50786. >Obsah</B
  50787. ></DT
  50788. ><DT
  50789. ><A
  50790. HREF="#function.bzclose"
  50791. >bzclose</A
  50792. > -- Zav°e ukazatel na soubor bzip2</DT
  50793. ><DT
  50794. ><A
  50795. HREF="#function.bzcompress"
  50796. >bzcompress</A
  50797. > -- Zkomprimuje °et∞zec algoritmem bzip2</DT
  50798. ><DT
  50799. ><A
  50800. HREF="#function.bzdecompress"
  50801. >bzdecompress</A
  50802. > -- Dekomprimuje data komprimovanß pomocφ bzip2</DT
  50803. ><DT
  50804. ><A
  50805. HREF="#function.bzerrno"
  50806. >bzerrno</A
  50807. > -- Vracφ Φφslo chyby bzip2</DT
  50808. ><DT
  50809. ><A
  50810. HREF="#function.bzerror"
  50811. >bzerror</A
  50812. > -- Vracφ v poli Φφslo a popis chyby bzip2</DT
  50813. ><DT
  50814. ><A
  50815. HREF="#function.bzerrstr"
  50816. >bzerrstr</A
  50817. > -- Vracφ popis chyby bzip2</DT
  50818. ><DT
  50819. ><A
  50820. HREF="#function.bzflush"
  50821. >bzflush</A
  50822. > -- Vynutφ zßpis v╣ech bufferovan²ch dat</DT
  50823. ><DT
  50824. ><A
  50825. HREF="#function.bzopen"
  50826. >bzopen</A
  50827. > -- Otev°e soubor komprimovan² pomocφ bzip2</DT
  50828. ><DT
  50829. ><A
  50830. HREF="#function.bzread"
  50831. >bzread</A
  50832. > -- Binßrn∞ bezpeΦnΘ Φtenφ ze souboru bzip2</DT
  50833. ><DT
  50834. ><A
  50835. HREF="#function.bzwrite"
  50836. >bzwrite</A
  50837. > -- Binßrn∞ bezpeΦn² zßpis do souboru bzip2</DT
  50838. ></DL
  50839. ></DIV
  50840. ></DIV
  50841. ><H1
  50842. ><A
  50843. NAME="function.bzclose"
  50844. ></A
  50845. >bzclose</H1
  50846. ><DIV
  50847. CLASS="refnamediv"
  50848. ><A
  50849. NAME="AEN9789"
  50850. ></A
  50851. ><P
  50852. >    (4.0.4 - 4.3.2 only)</P
  50853. >bzclose -- Zav°e ukazatel na soubor bzip2</DIV
  50854. ><DIV
  50855. CLASS="refsect1"
  50856. ><A
  50857. NAME="AEN9792"
  50858. ></A
  50859. ><H2
  50860. >Popis</H2
  50861. >int <B
  50862. CLASS="methodname"
  50863. >bzclose</B
  50864. > ( resource bz)<BR
  50865. ></BR
  50866. ><P
  50867. >      Zav°e soubor bzip2 odkazovan² ukazatelem <TT
  50868. CLASS="parameter"
  50869. ><I
  50870. >bz</I
  50871. ></TT
  50872. >.
  50873.     </P
  50874. ><P
  50875. >      Vracφ <TT
  50876. CLASS="constant"
  50877. ><B
  50878. >TRUE</B
  50879. ></TT
  50880. > p°i ·sp∞chu, <TT
  50881. CLASS="constant"
  50882. ><B
  50883. >FALSE</B
  50884. ></TT
  50885. > p°i selhßnφ.
  50886.     </P
  50887. ><P
  50888. >      Ukazatel na soubor musφ b²t platn² a musφ ukazovat na soubor ·sp∞╣n∞
  50889.      otev°en² pomocφ <A
  50890. HREF="#function.bzopen"
  50891. ><B
  50892. CLASS="function"
  50893. >bzopen()</B
  50894. ></A
  50895. >.
  50896.     </P
  50897. ><P
  50898. >      Viz takΘ <A
  50899. HREF="#function.bzopen"
  50900. ><B
  50901. CLASS="function"
  50902. >bzopen()</B
  50903. ></A
  50904. >.
  50905.     </P
  50906. ></DIV
  50907. ><H1
  50908. ><A
  50909. NAME="function.bzcompress"
  50910. ></A
  50911. >bzcompress</H1
  50912. ><DIV
  50913. CLASS="refnamediv"
  50914. ><A
  50915. NAME="AEN9810"
  50916. ></A
  50917. ><P
  50918. >    (4.0.4 - 4.3.2 only)</P
  50919. >bzcompress -- Zkomprimuje °et∞zec algoritmem bzip2</DIV
  50920. ><DIV
  50921. CLASS="refsect1"
  50922. ><A
  50923. NAME="AEN9813"
  50924. ></A
  50925. ><H2
  50926. >Popis</H2
  50927. >string <B
  50928. CLASS="methodname"
  50929. >bzcompress</B
  50930. > ( string source [, int blocksize [, int workfactor]])<BR
  50931. ></BR
  50932. ><P
  50933. >      <B
  50934. CLASS="function"
  50935. >bzcompress()</B
  50936. > komprimuje °et∞zec
  50937.      <TT
  50938. CLASS="parameter"
  50939. ><I
  50940. >source</I
  50941. ></TT
  50942. > a vracφ ho ve form∞ dat zφskan²ch
  50943.      pomocφ algoritmu bzip2.
  50944.     </P
  50945. ><P
  50946. >      Nepovinn² parametr <TT
  50947. CLASS="parameter"
  50948. ><I
  50949. >blocksize</I
  50950. ></TT
  50951. > specifikuje velikost
  50952.      bloku pou╛itou p°i komprimaci; m∞lo by to b²t Φφslo od 1 do 9, kde
  50953.      9 znamenß nej·Φinn∞j╣φ kompresi, ale s v∞t╣φmi nßroky na pot°ebnΘ
  50954.      prost°edky. Implicitnφ hodnota <TT
  50955. CLASS="parameter"
  50956. ><I
  50957. >blocksize</I
  50958. ></TT
  50959. > je 4.
  50960.     </P
  50961. ><P
  50962. >      Nepovinn² parametr <TT
  50963. CLASS="parameter"
  50964. ><I
  50965. >workfactor</I
  50966. ></TT
  50967. > urΦuje, jak se
  50968.      kompresnφ mechanismus chovß v p°φpad∞ nejhor╣φch, velmi se opakujφcφch,
  50969.      vstupnßch dat. M∙╛e nab²vat hodnot mezi 0 a 250; 0 p°edstavuje specißlnφ
  50970.      p°φpad, 30 je implicitnφ hodnota. Generovan² v²stup je bez ohledu na
  50971.      <TT
  50972. CLASS="parameter"
  50973. ><I
  50974. >workfactor</I
  50975. ></TT
  50976. > v╛dy stejn².
  50977.     </P
  50978. ><P
  50979. >      <TABLE
  50980. WIDTH="100%"
  50981. BORDER="0"
  50982. CELLPADDING="0"
  50983. CELLSPACING="0"
  50984. CLASS="EXAMPLE"
  50985. ><TR
  50986. ><TD
  50987. ><DIV
  50988. CLASS="example"
  50989. ><A
  50990. NAME="AEN9837"
  50991. ></A
  50992. ><P
  50993. ><B
  50994. >P°φklad 1. <B
  50995. CLASS="function"
  50996. >bzcompress()</B
  50997. > P°φklad</B
  50998. ></P
  50999. ><TABLE
  51000. BORDER="0"
  51001. BGCOLOR="#E0E0E0"
  51002. CELLPADDING="5"
  51003. ><TR
  51004. ><TD
  51005. ><PRE
  51006. CLASS="php"
  51007. ><?php
  51008. $str = "zku╣ebnφ data";
  51009. $bzstr = bzcompress($str, 9);
  51010. echo $bzstr;
  51011. ?></PRE
  51012. ></TD
  51013. ></TR
  51014. ></TABLE
  51015. ></DIV
  51016. ></TD
  51017. ></TR
  51018. ></TABLE
  51019. >
  51020.     </P
  51021. ><P
  51022. >      Viz takΘ <A
  51023. HREF="#function.bzdecompress"
  51024. ><B
  51025. CLASS="function"
  51026. >bzdecompress()</B
  51027. ></A
  51028. >.
  51029.     </P
  51030. ></DIV
  51031. ><H1
  51032. ><A
  51033. NAME="function.bzdecompress"
  51034. ></A
  51035. >bzdecompress</H1
  51036. ><DIV
  51037. CLASS="refnamediv"
  51038. ><A
  51039. NAME="AEN9844"
  51040. ></A
  51041. ><P
  51042. >    (4.0.4 - 4.3.2 only)</P
  51043. >bzdecompress -- Dekomprimuje data komprimovanß pomocφ bzip2</DIV
  51044. ><DIV
  51045. CLASS="refsect1"
  51046. ><A
  51047. NAME="AEN9847"
  51048. ></A
  51049. ><H2
  51050. >Popis</H2
  51051. >string <B
  51052. CLASS="methodname"
  51053. >bzdecompress</B
  51054. > ( string source [, int small])<BR
  51055. ></BR
  51056. ><P
  51057. >      <B
  51058. CLASS="function"
  51059. >bzdecompress()</B
  51060. > dekomprimuje °et∞zec
  51061.      <TT
  51062. CLASS="parameter"
  51063. ><I
  51064. >source</I
  51065. ></TT
  51066. > obsahujφcφ data komprimovanß pomocφ
  51067.      algoritmu bzip2, a vracφ je. Pokud mß nepovinn² parametr
  51068.      <TT
  51069. CLASS="parameter"
  51070. ><I
  51071. >small</I
  51072. ></TT
  51073. > hodnotu <TT
  51074. CLASS="constant"
  51075. ><B
  51076. >TRUE</B
  51077. ></TT
  51078. >, pou╛ije se alternativnφ
  51079.      dekompresnφ algoritmus s ni╛╣φmi nßroky na pam∞╗ (maximßlnφ pam∞tovΘ
  51080.      po╛adavky klesnou na cca 2300 KB), ale zhruba poloviΦnφ rychlostφ.
  51081.      Vφce informacφ najdete v
  51082.      <A
  51083. HREF="http://sources.redhat.com/bzip2/"
  51084. TARGET="_top"
  51085. >dokumentaci k bzip2</A
  51086. >.
  51087.     </P
  51088. ><P
  51089. >      <TABLE
  51090. WIDTH="100%"
  51091. BORDER="0"
  51092. CELLPADDING="0"
  51093. CELLSPACING="0"
  51094. CLASS="EXAMPLE"
  51095. ><TR
  51096. ><TD
  51097. ><DIV
  51098. CLASS="example"
  51099. ><A
  51100. NAME="AEN9865"
  51101. ></A
  51102. ><P
  51103. ><B
  51104. >P°φklad 1. <B
  51105. CLASS="function"
  51106. >bzdecompress()</B
  51107. ></B
  51108. ></P
  51109. ><TABLE
  51110. BORDER="0"
  51111. BGCOLOR="#E0E0E0"
  51112. CELLPADDING="5"
  51113. ><TR
  51114. ><TD
  51115. ><PRE
  51116. CLASS="php"
  51117. ><?php
  51118. $start_str = "Tohle nenφ up°φmn² obliΦej?";
  51119. $bzstr = bzcompress($start_str);
  51120.  
  51121. echo "Komprimovan² °et∞zec: ";
  51122. echo $bzstr;
  51123. echo "\n<br>\n";
  51124.  
  51125. $str = bzdecompress($bzstr);
  51126. echo "Dekomprimovan² °etezec: ";
  51127. echo $str;
  51128. echo "\n<br>\n";
  51129. ?></PRE
  51130. ></TD
  51131. ></TR
  51132. ></TABLE
  51133. ></DIV
  51134. ></TD
  51135. ></TR
  51136. ></TABLE
  51137. >
  51138.     </P
  51139. ><P
  51140. >      Viz takΘ <A
  51141. HREF="#function.bzcompress"
  51142. ><B
  51143. CLASS="function"
  51144. >bzcompress()</B
  51145. ></A
  51146. >.
  51147.     </P
  51148. ></DIV
  51149. ><H1
  51150. ><A
  51151. NAME="function.bzerrno"
  51152. ></A
  51153. >bzerrno</H1
  51154. ><DIV
  51155. CLASS="refnamediv"
  51156. ><A
  51157. NAME="AEN9872"
  51158. ></A
  51159. ><P
  51160. >    (4.0.4 - 4.3.2 only)</P
  51161. >bzerrno -- Vracφ Φφslo chyby bzip2</DIV
  51162. ><DIV
  51163. CLASS="refsect1"
  51164. ><A
  51165. NAME="AEN9875"
  51166. ></A
  51167. ><H2
  51168. >Popis</H2
  51169. >int <B
  51170. CLASS="methodname"
  51171. >bzerrno</B
  51172. > ( resource bz)<BR
  51173. ></BR
  51174. ><P
  51175. >      Vracφ chybovΘ Φφslo jakΘkoli chyby bzip2 podle souborovΘho ukazatele
  51176.      <TT
  51177. CLASS="parameter"
  51178. ><I
  51179. >bz</I
  51180. ></TT
  51181. >.
  51182.     </P
  51183. ><P
  51184. >      Vuz takΘ <A
  51185. HREF="#function.bzerror"
  51186. ><B
  51187. CLASS="function"
  51188. >bzerror()</B
  51189. ></A
  51190. > a <A
  51191. HREF="#function.bzerrstr"
  51192. ><B
  51193. CLASS="function"
  51194. >bzerrstr()</B
  51195. ></A
  51196. >.
  51197.     </P
  51198. ></DIV
  51199. ><H1
  51200. ><A
  51201. NAME="function.bzerror"
  51202. ></A
  51203. >bzerror</H1
  51204. ><DIV
  51205. CLASS="refnamediv"
  51206. ><A
  51207. NAME="AEN9889"
  51208. ></A
  51209. ><P
  51210. >    (4.0.4 - 4.3.2 only)</P
  51211. >bzerror -- Vracφ v poli Φφslo a popis chyby bzip2</DIV
  51212. ><DIV
  51213. CLASS="refsect1"
  51214. ><A
  51215. NAME="AEN9892"
  51216. ></A
  51217. ><H2
  51218. >Popis</H2
  51219. >array <B
  51220. CLASS="methodname"
  51221. >bzerror</B
  51222. > ( resource bz)<BR
  51223. ></BR
  51224. ><P
  51225. >      Vracφ Φφslo chyby a chybov² °et∞zec (popis) v asociativnφm poli pro
  51226.      jakoukoli chybu bzip2 podle souborovΘho ukazatele
  51227.      <TT
  51228. CLASS="parameter"
  51229. ><I
  51230. >bz</I
  51231. ></TT
  51232. >.
  51233.     </P
  51234. ><P
  51235. >      <TABLE
  51236. WIDTH="100%"
  51237. BORDER="0"
  51238. CELLPADDING="0"
  51239. CELLSPACING="0"
  51240. CLASS="EXAMPLE"
  51241. ><TR
  51242. ><TD
  51243. ><DIV
  51244. CLASS="example"
  51245. ><A
  51246. NAME="AEN9903"
  51247. ></A
  51248. ><P
  51249. ><B
  51250. >P°φklad 1. P°φklad - <B
  51251. CLASS="function"
  51252. >bzerror()</B
  51253. ></B
  51254. ></P
  51255. ><TABLE
  51256. BORDER="0"
  51257. BGCOLOR="#E0E0E0"
  51258. CELLPADDING="5"
  51259. ><TR
  51260. ><TD
  51261. ><PRE
  51262. CLASS="php"
  51263. ><?php
  51264. $error = bzerror($bz);
  51265.  
  51266. echo $error["errno"];
  51267. echo $error["errstr"];
  51268. ?></PRE
  51269. ></TD
  51270. ></TR
  51271. ></TABLE
  51272. ></DIV
  51273. ></TD
  51274. ></TR
  51275. ></TABLE
  51276. >
  51277.     </P
  51278. ><P
  51279. >      Viz takΘ <A
  51280. HREF="#function.bzerrno"
  51281. ><B
  51282. CLASS="function"
  51283. >bzerrno()</B
  51284. ></A
  51285. > a <A
  51286. HREF="#function.bzerrstr"
  51287. ><B
  51288. CLASS="function"
  51289. >bzerrstr()</B
  51290. ></A
  51291. >.
  51292.     </P
  51293. ></DIV
  51294. ><H1
  51295. ><A
  51296. NAME="function.bzerrstr"
  51297. ></A
  51298. >bzerrstr</H1
  51299. ><DIV
  51300. CLASS="refnamediv"
  51301. ><A
  51302. NAME="AEN9911"
  51303. ></A
  51304. ><P
  51305. >    (4.0.4 - 4.3.2 only)</P
  51306. >bzerrstr -- Vracφ popis chyby bzip2</DIV
  51307. ><DIV
  51308. CLASS="refsect1"
  51309. ><A
  51310. NAME="AEN9914"
  51311. ></A
  51312. ><H2
  51313. >Popis</H2
  51314. >string <B
  51315. CLASS="methodname"
  51316. >bzerrstr</B
  51317. > ( resource bz)<BR
  51318. ></BR
  51319. ><P
  51320. >      Vracφ chybov² °et∞zec (popis) pro jakoukoli chybu bzip2 podle souborovΘho
  51321.      ukazatele <TT
  51322. CLASS="parameter"
  51323. ><I
  51324. >bz</I
  51325. ></TT
  51326. >.
  51327.     </P
  51328. ><P
  51329. >      Viz takΘ <A
  51330. HREF="#function.bzerrno"
  51331. ><B
  51332. CLASS="function"
  51333. >bzerrno()</B
  51334. ></A
  51335. > a <A
  51336. HREF="#function.bzerror"
  51337. ><B
  51338. CLASS="function"
  51339. >bzerror()</B
  51340. ></A
  51341. >.
  51342.     </P
  51343. ></DIV
  51344. ><H1
  51345. ><A
  51346. NAME="function.bzflush"
  51347. ></A
  51348. >bzflush</H1
  51349. ><DIV
  51350. CLASS="refnamediv"
  51351. ><A
  51352. NAME="AEN9928"
  51353. ></A
  51354. ><P
  51355. >    (4.0.4 - 4.3.2 only)</P
  51356. >bzflush -- Vynutφ zßpis v╣ech bufferovan²ch dat</DIV
  51357. ><DIV
  51358. CLASS="refsect1"
  51359. ><A
  51360. NAME="AEN9931"
  51361. ></A
  51362. ><H2
  51363. >Popis</H2
  51364. >int <B
  51365. CLASS="methodname"
  51366. >bzflush</B
  51367. > ( resource bz)<BR
  51368. ></BR
  51369. ><P
  51370. >      Vynutφ zßpis v╣ech bufferovan²ch dat pro souborov² ukazatel
  51371.      <TT
  51372. CLASS="parameter"
  51373. ><I
  51374. >bz</I
  51375. ></TT
  51376. >.
  51377.     </P
  51378. ><P
  51379. >      Vracφ <TT
  51380. CLASS="constant"
  51381. ><B
  51382. >TRUE</B
  51383. ></TT
  51384. > p°i ·sp∞chu, <TT
  51385. CLASS="constant"
  51386. ><B
  51387. >FALSE</B
  51388. ></TT
  51389. > p°i selhßnφ.
  51390.     </P
  51391. ><P
  51392. >      Viz takΘ <A
  51393. HREF="#function.bzread"
  51394. ><B
  51395. CLASS="function"
  51396. >bzread()</B
  51397. ></A
  51398. > a <A
  51399. HREF="#function.bzwrite"
  51400. ><B
  51401. CLASS="function"
  51402. >bzwrite()</B
  51403. ></A
  51404. >.
  51405.     </P
  51406. ></DIV
  51407. ><H1
  51408. ><A
  51409. NAME="function.bzopen"
  51410. ></A
  51411. >bzopen</H1
  51412. ><DIV
  51413. CLASS="refnamediv"
  51414. ><A
  51415. NAME="AEN9948"
  51416. ></A
  51417. ><P
  51418. >    (4.0.4 - 4.3.2 only)</P
  51419. >bzopen -- Otev°e soubor komprimovan² pomocφ bzip2</DIV
  51420. ><DIV
  51421. CLASS="refsect1"
  51422. ><A
  51423. NAME="AEN9951"
  51424. ></A
  51425. ><H2
  51426. >Popis</H2
  51427. >resource <B
  51428. CLASS="methodname"
  51429. >bzopen</B
  51430. > ( string filename, string mode)<BR
  51431. ></BR
  51432. ><P
  51433. >      Otev°e soubor bzip2 (.bz2) pro Φtenφ nebo zßpis.
  51434.      <TT
  51435. CLASS="parameter"
  51436. ><I
  51437. >filename</I
  51438. ></TT
  51439. > je nßzev otvφranΘho souboru.
  51440.      Parametr <TT
  51441. CLASS="parameter"
  51442. ><I
  51443. >mode</I
  51444. ></TT
  51445. > mß podobn² v²znam jako u funkce
  51446.      <A
  51447. HREF="#function.fopen"
  51448. ><B
  51449. CLASS="function"
  51450. >fopen()</B
  51451. ></A
  51452. > (`r' pro Φtenφ, `w' pro zßpis atd.).
  51453.     </P
  51454. ><P
  51455. >      Pokud otvφrßnφ sel╛e, vracφ funkce <TT
  51456. CLASS="constant"
  51457. ><B
  51458. >FALSE</B
  51459. ></TT
  51460. >, jinak vracφ ukazatel
  51461.      (deskriptor) na nov∞ otev°en² soubor.
  51462.     </P
  51463. ><P
  51464. >      <TABLE
  51465. WIDTH="100%"
  51466. BORDER="0"
  51467. CELLPADDING="0"
  51468. CELLSPACING="0"
  51469. CLASS="EXAMPLE"
  51470. ><TR
  51471. ><TD
  51472. ><DIV
  51473. CLASS="example"
  51474. ><A
  51475. NAME="AEN9969"
  51476. ></A
  51477. ><P
  51478. ><B
  51479. >P°φklad 1. P°φklad - <B
  51480. CLASS="function"
  51481. >bzopen()</B
  51482. ></B
  51483. ></P
  51484. ><TABLE
  51485. BORDER="0"
  51486. BGCOLOR="#E0E0E0"
  51487. CELLPADDING="5"
  51488. ><TR
  51489. ><TD
  51490. ><PRE
  51491. CLASS="php"
  51492. ><?php
  51493. $bz = bzopen("/tmp/foo.bz2", "r");
  51494. $decompressed_file = '';
  51495. while (!feof($bz)) {
  51496.     $decompressed_file .= bzread($bz, 4096);
  51497. }
  51498. bzclose($bz);
  51499.  
  51500. echo "Obsah souboru /tmp/foo.bz2 je: ";
  51501. echo "\n<br>\n";
  51502. echo $decompressed_file;
  51503. ?></PRE
  51504. ></TD
  51505. ></TR
  51506. ></TABLE
  51507. ></DIV
  51508. ></TD
  51509. ></TR
  51510. ></TABLE
  51511. >
  51512.     </P
  51513. ><P
  51514. >      Viz takΘ <A
  51515. HREF="#function.bzclose"
  51516. ><B
  51517. CLASS="function"
  51518. >bzclose()</B
  51519. ></A
  51520. >.
  51521.     </P
  51522. ></DIV
  51523. ><H1
  51524. ><A
  51525. NAME="function.bzread"
  51526. ></A
  51527. >bzread</H1
  51528. ><DIV
  51529. CLASS="refnamediv"
  51530. ><A
  51531. NAME="AEN9976"
  51532. ></A
  51533. ><P
  51534. >    (4.0.4 - 4.3.2 only)</P
  51535. >bzread -- Binßrn∞ bezpeΦnΘ Φtenφ ze souboru bzip2</DIV
  51536. ><DIV
  51537. CLASS="refsect1"
  51538. ><A
  51539. NAME="AEN9979"
  51540. ></A
  51541. ><H2
  51542. >Popis</H2
  51543. >string <B
  51544. CLASS="methodname"
  51545. >bzread</B
  51546. > ( resource bz [, int length])<BR
  51547. ></BR
  51548. ><P
  51549. >      <B
  51550. CLASS="function"
  51551. >bzread()</B
  51552. > p°eΦte nejv²╣e <TT
  51553. CLASS="parameter"
  51554. ><I
  51555. >length</I
  51556. ></TT
  51557. >
  51558.      byt∙ z bzip2 souboru odkazovanΘho pomocφ <TT
  51559. CLASS="parameter"
  51560. ><I
  51561. >bz</I
  51562. ></TT
  51563. >.
  51564.      ╚tenφ konΦφ, je-li p°eΦteno <TT
  51565. CLASS="parameter"
  51566. ><I
  51567. >length</I
  51568. ></TT
  51569. >
  51570.      (nekomprimovan²ch) byt∙ nebo se dosßhne konce souboru - podle toho, co
  51571.      nastane d°φv. Nenφ-li specifikovßn nepovinn² parametr
  51572.      <TT
  51573. CLASS="parameter"
  51574. ><I
  51575. >length</I
  51576. ></TT
  51577. >, funkce <B
  51578. CLASS="function"
  51579. >bzread()</B
  51580. >
  51581.      p°eΦte najednou 1024 (nekomprimovan²ch) byt∙.
  51582.     </P
  51583. ><P
  51584. >      <TABLE
  51585. WIDTH="100%"
  51586. BORDER="0"
  51587. CELLPADDING="0"
  51588. CELLSPACING="0"
  51589. CLASS="EXAMPLE"
  51590. ><TR
  51591. ><TD
  51592. ><DIV
  51593. CLASS="example"
  51594. ><A
  51595. NAME="AEN9998"
  51596. ></A
  51597. ><P
  51598. ><B
  51599. >P°φklad 1. P°φklad - <B
  51600. CLASS="function"
  51601. >bzread()</B
  51602. ></B
  51603. ></P
  51604. ><TABLE
  51605. BORDER="0"
  51606. BGCOLOR="#E0E0E0"
  51607. CELLPADDING="5"
  51608. ><TR
  51609. ><TD
  51610. ><PRE
  51611. CLASS="php"
  51612. ><?php
  51613. $bz = bzopen("/tmp/foo.bz2", "r");
  51614. $str = bzread($bz, 2048);
  51615. echo $str;
  51616. ?></PRE
  51617. ></TD
  51618. ></TR
  51619. ></TABLE
  51620. ></DIV
  51621. ></TD
  51622. ></TR
  51623. ></TABLE
  51624. >
  51625.     </P
  51626. ><P
  51627. >      Viz takΘ <A
  51628. HREF="#function.bzwrite"
  51629. ><B
  51630. CLASS="function"
  51631. >bzwrite()</B
  51632. ></A
  51633. > a <A
  51634. HREF="#function.bzopen"
  51635. ><B
  51636. CLASS="function"
  51637. >bzopen()</B
  51638. ></A
  51639. >.
  51640.     </P
  51641. ></DIV
  51642. ><H1
  51643. ><A
  51644. NAME="function.bzwrite"
  51645. ></A
  51646. >bzwrite</H1
  51647. ><DIV
  51648. CLASS="refnamediv"
  51649. ><A
  51650. NAME="AEN10006"
  51651. ></A
  51652. ><P
  51653. >    (4.0.4 - 4.3.2 only)</P
  51654. >bzwrite -- Binßrn∞ bezpeΦn² zßpis do souboru bzip2</DIV
  51655. ><DIV
  51656. CLASS="refsect1"
  51657. ><A
  51658. NAME="AEN10009"
  51659. ></A
  51660. ><H2
  51661. >Popis</H2
  51662. >int <B
  51663. CLASS="methodname"
  51664. >bzwrite</B
  51665. > ( resource bz, string data [, int length])<BR
  51666. ></BR
  51667. ><P
  51668. >      <B
  51669. CLASS="function"
  51670. >bzwrite()</B
  51671. > zapφ╣e obsah °et∞zce
  51672.      <TT
  51673. CLASS="parameter"
  51674. ><I
  51675. >data</I
  51676. ></TT
  51677. > do souboru bzip2 odkazovanΘho pomocφ
  51678.      <TT
  51679. CLASS="parameter"
  51680. ><I
  51681. >bz</I
  51682. ></TT
  51683. >. Je-li p°φtomen nepovinn² parametr
  51684.      <TT
  51685. CLASS="parameter"
  51686. ><I
  51687. >length</I
  51688. ></TT
  51689. >, zßpis skonΦφ potΘ, co bude zapsßno
  51690.      <TT
  51691. CLASS="parameter"
  51692. ><I
  51693. >length</I
  51694. ></TT
  51695. > (nekomprimovan²ch) byt∙ nebo bude dosa╛eno
  51696.      konce °et∞zce - podle toho, co nastane d°φv.
  51697.     </P
  51698. ><P
  51699. >      <TABLE
  51700. WIDTH="100%"
  51701. BORDER="0"
  51702. CELLPADDING="0"
  51703. CELLSPACING="0"
  51704. CLASS="EXAMPLE"
  51705. ><TR
  51706. ><TD
  51707. ><DIV
  51708. CLASS="example"
  51709. ><A
  51710. NAME="AEN10030"
  51711. ></A
  51712. ><P
  51713. ><B
  51714. >P°φklad 1. P°φklad <B
  51715. CLASS="function"
  51716. >bzwrite()</B
  51717. ></B
  51718. ></P
  51719. ><TABLE
  51720. BORDER="0"
  51721. BGCOLOR="#E0E0E0"
  51722. CELLPADDING="5"
  51723. ><TR
  51724. ><TD
  51725. ><PRE
  51726. CLASS="php"
  51727. ><?php
  51728. $str = "nekomprimovanß data";
  51729. $bz = bzopen("/tmp/foo.bz2", "w");
  51730. bzwrite($bz, $str, strlen($str));
  51731. bzclose($bz);
  51732. ?></PRE
  51733. ></TD
  51734. ></TR
  51735. ></TABLE
  51736. ></DIV
  51737. ></TD
  51738. ></TR
  51739. ></TABLE
  51740. >
  51741.     </P
  51742. ><P
  51743. >      Viz takΘ <A
  51744. HREF="#function.bzread"
  51745. ><B
  51746. CLASS="function"
  51747. >bzread()</B
  51748. ></A
  51749. > a <A
  51750. HREF="#function.bzopen"
  51751. ><B
  51752. CLASS="function"
  51753. >bzopen()</B
  51754. ></A
  51755. >.
  51756.     </P
  51757. ></DIV
  51758. ></DIV
  51759. ><DIV
  51760. CLASS="reference"
  51761. ><A
  51762. NAME="ref.calendar"
  51763. ></A
  51764. ><DIV
  51765. CLASS="TITLEPAGE"
  51766. ><H1
  51767. CLASS="title"
  51768. >VI. Kalendß°ovΘ funkce</H1
  51769. ><DIV
  51770. CLASS="PARTINTRO"
  51771. ><A
  51772. NAME="AEN10040"
  51773. ></A
  51774. ><DIV
  51775. CLASS="section"
  51776. ><H1
  51777. CLASS="section"
  51778. ><A
  51779. NAME="calendar.intro"
  51780. ></A
  51781. >┌vod</H1
  51782. ><P
  51783. >      Toto roz╣φ°enφ p°edstavuje sadu funkcφ urΦen²ch ke zjednodu╣enφ p°evod∙
  51784.      mezi r∙zn²mi kalendß°i. Prost°ednφkem nebo standardem, na kterΘm je zalo╛ena,
  51785.      je Julian Day Count. To je poΦet dnφ zaΦφnajφcφ daleko p°ed jak²mkoli datem
  51786.      o kterΘ by se v∞t╣ina lidφ zajφmala (n∞kde kolem 4000 p°. n. l.). Pokud
  51787.      chcete p°evßd∞t mezi kalendß°ov²mi systΘmy, musφte nejd°φv p°evΘst na
  51788.      Julian Day Count, potom na k²╛en² kalendß°. Julian Day Count se velmi li╣φ
  51789.      od JulißnskΘho kaledß°e! Pro vφce informacφ o Julian Day Count viz
  51790.      <A
  51791. HREF="http://www.hermetic.ch/cal_stud/jdn.htm"
  51792. TARGET="_top"
  51793. >http://www.hermetic.ch/cal_stud/jdn.htm</A
  51794. >. Pro vφce informacφ o kalendß°ov²ch systΘmech viz <A
  51795. HREF="http://www.boogle.com/info/cal-overview.html"
  51796. TARGET="_top"
  51797. >http://www.boogle.com/info/cal-overview.html</A
  51798. >. Tyto instrukce obsahujφ v²≥atky
  51799.      z tΘto strßnky (v uvozovkßch).
  51800.     </P
  51801. ></DIV
  51802. ><DIV
  51803. CLASS="section"
  51804. ><HR><H1
  51805. CLASS="section"
  51806. ><A
  51807. NAME="calendar.installation"
  51808. ></A
  51809. >Instalace</H1
  51810. ><P
  51811. >   Pro prßci tohoto roz╣φ°enφ musφte PHP zkompilovat s volbou
  51812.   <TT
  51813. CLASS="option"
  51814. >--enable-calendar</TT
  51815. >.
  51816.  </P
  51817. ><P
  51818. >Verze <TT
  51819. CLASS="literal"
  51820. >PHP</TT
  51821. > pro Windows
  51822. mß vestav∞nou podporu pro toto roz╣φ°enφ. K pou╛itφ t∞chto funkcφ nenφ t°eba
  51823. naΦφtat ╛ßdnß dal╣φ roz╣φ°enφ.</P
  51824. ></DIV
  51825. ><DIV
  51826. CLASS="section"
  51827. ><HR><H1
  51828. CLASS="section"
  51829. ><A
  51830. NAME="calendar.configuration"
  51831. ></A
  51832. >Konfigurace b∞hu</H1
  51833. ><P
  51834. >Toto roz╣φ°enφ nemß definovßno ╛ßdnΘ konfiguraΦnφ
  51835. direktivy.</P
  51836. ></DIV
  51837. ><DIV
  51838. CLASS="section"
  51839. ><HR><H1
  51840. CLASS="section"
  51841. ><A
  51842. NAME="calendar.resources"
  51843. ></A
  51844. >Typy prost°edk∙</H1
  51845. ><P
  51846. >Toto roz╣φ°enφ nemß definovßn ╛ßdn² typ prost°edku
  51847. (resource).</P
  51848. ></DIV
  51849. ><DIV
  51850. CLASS="section"
  51851. ><HR><H1
  51852. CLASS="section"
  51853. ><A
  51854. NAME="calendar.constants"
  51855. ></A
  51856. >P°eddefinovanΘ konstanty</H1
  51857. ><P
  51858. > Tyto konstanty jsou definovßny tφmto roz╣φ°enφm a budou k dispozici pouze
  51859. tehdy, bylo-li roz╣φ°enφ zkompilovßno spoleΦn∞ s PHP nebo dynamicky zavedeno
  51860. za b∞hu.
  51861. </P
  51862. ><P
  51863. ></P
  51864. ><DIV
  51865. CLASS="variablelist"
  51866. ><DL
  51867. ><DT
  51868. ><TT
  51869. CLASS="constant"
  51870. ><B
  51871. >CAL_GREGORIAN</B
  51872. ></TT
  51873.     (<A
  51874. HREF="#language.types.integer"
  51875. ><B
  51876. CLASS="type"
  51877. >integer</B
  51878. ></A
  51879. >)</DT
  51880. ><DD
  51881. ><P
  51882. >
  51883.     </P
  51884. ></DD
  51885. ><DT
  51886. ><TT
  51887. CLASS="constant"
  51888. ><B
  51889. >CAL_JULIAN</B
  51890. ></TT
  51891.     (<A
  51892. HREF="#language.types.integer"
  51893. ><B
  51894. CLASS="type"
  51895. >integer</B
  51896. ></A
  51897. >)</DT
  51898. ><DD
  51899. ><P
  51900. >
  51901.     </P
  51902. ></DD
  51903. ><DT
  51904. ><TT
  51905. CLASS="constant"
  51906. ><B
  51907. >CAL_JEWISH</B
  51908. ></TT
  51909.     (<A
  51910. HREF="#language.types.integer"
  51911. ><B
  51912. CLASS="type"
  51913. >integer</B
  51914. ></A
  51915. >)</DT
  51916. ><DD
  51917. ><P
  51918. >      
  51919.     </P
  51920. ></DD
  51921. ><DT
  51922. ><TT
  51923. CLASS="constant"
  51924. ><B
  51925. >CAL_FRENCH</B
  51926. ></TT
  51927.     (<A
  51928. HREF="#language.types.integer"
  51929. ><B
  51930. CLASS="type"
  51931. >integer</B
  51932. ></A
  51933. >)</DT
  51934. ><DD
  51935. ><P
  51936. >      
  51937.     </P
  51938. ></DD
  51939. ><DT
  51940. ><TT
  51941. CLASS="constant"
  51942. ><B
  51943. >CAL_NUM_CALS</B
  51944. ></TT
  51945.     (<A
  51946. HREF="#language.types.integer"
  51947. ><B
  51948. CLASS="type"
  51949. >integer</B
  51950. ></A
  51951. >)</DT
  51952. ><DD
  51953. ><P
  51954. >      
  51955.     </P
  51956. ></DD
  51957. ><DT
  51958. ><TT
  51959. CLASS="constant"
  51960. ><B
  51961. >CAL_DOW_DAYNO</B
  51962. ></TT
  51963.     (<A
  51964. HREF="#language.types.integer"
  51965. ><B
  51966. CLASS="type"
  51967. >integer</B
  51968. ></A
  51969. >)</DT
  51970. ><DD
  51971. ><P
  51972. >      
  51973.     </P
  51974. ></DD
  51975. ><DT
  51976. ><TT
  51977. CLASS="constant"
  51978. ><B
  51979. >CAL_DOW_SHORT</B
  51980. ></TT
  51981.     (<A
  51982. HREF="#language.types.integer"
  51983. ><B
  51984. CLASS="type"
  51985. >integer</B
  51986. ></A
  51987. >)</DT
  51988. ><DD
  51989. ><P
  51990. >      
  51991.     </P
  51992. ></DD
  51993. ><DT
  51994. ><TT
  51995. CLASS="constant"
  51996. ><B
  51997. >CAL_DOW_LONG</B
  51998. ></TT
  51999.     (<A
  52000. HREF="#language.types.integer"
  52001. ><B
  52002. CLASS="type"
  52003. >integer</B
  52004. ></A
  52005. >)</DT
  52006. ><DD
  52007. ><P
  52008. >      
  52009.     </P
  52010. ></DD
  52011. ><DT
  52012. ><TT
  52013. CLASS="constant"
  52014. ><B
  52015. >CAL_MONTH_GREGORIAN_SHORT</B
  52016. ></TT
  52017.     (<A
  52018. HREF="#language.types.integer"
  52019. ><B
  52020. CLASS="type"
  52021. >integer</B
  52022. ></A
  52023. >)</DT
  52024. ><DD
  52025. ><P
  52026. >      
  52027.     </P
  52028. ></DD
  52029. ><DT
  52030. ><TT
  52031. CLASS="constant"
  52032. ><B
  52033. >CAL_MONTH_GREGORIAN_LONG</B
  52034. ></TT
  52035.     (<A
  52036. HREF="#language.types.integer"
  52037. ><B
  52038. CLASS="type"
  52039. >integer</B
  52040. ></A
  52041. >)</DT
  52042. ><DD
  52043. ><P
  52044. >      
  52045.     </P
  52046. ></DD
  52047. ><DT
  52048. ><TT
  52049. CLASS="constant"
  52050. ><B
  52051. >CAL_MONTH_JULIAN_SHORT</B
  52052. ></TT
  52053.     (<A
  52054. HREF="#language.types.integer"
  52055. ><B
  52056. CLASS="type"
  52057. >integer</B
  52058. ></A
  52059. >)</DT
  52060. ><DD
  52061. ><P
  52062. >      
  52063.     </P
  52064. ></DD
  52065. ><DT
  52066. ><TT
  52067. CLASS="constant"
  52068. ><B
  52069. >CAL_MONTH_JULIAN_LONG</B
  52070. ></TT
  52071.     (<A
  52072. HREF="#language.types.integer"
  52073. ><B
  52074. CLASS="type"
  52075. >integer</B
  52076. ></A
  52077. >)</DT
  52078. ><DD
  52079. ><P
  52080. >      
  52081.     </P
  52082. ></DD
  52083. ><DT
  52084. ><TT
  52085. CLASS="constant"
  52086. ><B
  52087. >CAL_MONTH_JEWISH</B
  52088. ></TT
  52089.     (<A
  52090. HREF="#language.types.integer"
  52091. ><B
  52092. CLASS="type"
  52093. >integer</B
  52094. ></A
  52095. >)</DT
  52096. ><DD
  52097. ><P
  52098. >      
  52099.     </P
  52100. ></DD
  52101. ><DT
  52102. ><TT
  52103. CLASS="constant"
  52104. ><B
  52105. >CAL_MONTH_FRENCH</B
  52106. ></TT
  52107.     (<A
  52108. HREF="#language.types.integer"
  52109. ><B
  52110. CLASS="type"
  52111. >integer</B
  52112. ></A
  52113. >)</DT
  52114. ><DD
  52115. ><P
  52116. >      
  52117.     </P
  52118. ></DD
  52119. ></DL
  52120. ></DIV
  52121. ><P
  52122. >   The following constants are available since <TT
  52123. CLASS="literal"
  52124. >PHP</TT
  52125. > 4.3.0 :
  52126.  </P
  52127. ><P
  52128. ></P
  52129. ><DIV
  52130. CLASS="variablelist"
  52131. ><DL
  52132. ><DT
  52133. ><TT
  52134. CLASS="constant"
  52135. ><B
  52136. >CAL_EASTER_DEFAULT</B
  52137. ></TT
  52138.     (<A
  52139. HREF="#language.types.integer"
  52140. ><B
  52141. CLASS="type"
  52142. >integer</B
  52143. ></A
  52144. >)</DT
  52145. ><DD
  52146. ><P
  52147. >      
  52148.     </P
  52149. ></DD
  52150. ><DT
  52151. ><TT
  52152. CLASS="constant"
  52153. ><B
  52154. >CAL_EASTER_ROMAN</B
  52155. ></TT
  52156.     (<A
  52157. HREF="#language.types.integer"
  52158. ><B
  52159. CLASS="type"
  52160. >integer</B
  52161. ></A
  52162. >)</DT
  52163. ><DD
  52164. ><P
  52165. >      
  52166.     </P
  52167. ></DD
  52168. ><DT
  52169. ><TT
  52170. CLASS="constant"
  52171. ><B
  52172. >CAL_EASTER_ALWAYS_GREGORIAN</B
  52173. ></TT
  52174.     (<A
  52175. HREF="#language.types.integer"
  52176. ><B
  52177. CLASS="type"
  52178. >integer</B
  52179. ></A
  52180. >)</DT
  52181. ><DD
  52182. ><P
  52183. >      
  52184.     </P
  52185. ></DD
  52186. ><DT
  52187. ><TT
  52188. CLASS="constant"
  52189. ><B
  52190. >CAL_EASTER_ALWAYS_JULIAN</B
  52191. ></TT
  52192.     (<A
  52193. HREF="#language.types.integer"
  52194. ><B
  52195. CLASS="type"
  52196. >integer</B
  52197. ></A
  52198. >)</DT
  52199. ><DD
  52200. ><P
  52201. >      
  52202.     </P
  52203. ></DD
  52204. ></DL
  52205. ></DIV
  52206. ><P
  52207. >   The following constants are available since <TT
  52208. CLASS="literal"
  52209. >PHP</TT
  52210. > 5.0.0 :
  52211.  </P
  52212. ><P
  52213. ></P
  52214. ><DIV
  52215. CLASS="variablelist"
  52216. ><DL
  52217. ><DT
  52218. ><TT
  52219. CLASS="constant"
  52220. ><B
  52221. >CAL_JEWISH_ADD_ALAFIM_GERESH</B
  52222. ></TT
  52223. >
  52224.      (<A
  52225. HREF="#language.types.integer"
  52226. ><B
  52227. CLASS="type"
  52228. >integer</B
  52229. ></A
  52230. >)</DT
  52231. ><DD
  52232. ><P
  52233. >
  52234.     </P
  52235. ></DD
  52236. ><DT
  52237. ><TT
  52238. CLASS="constant"
  52239. ><B
  52240. >CAL_JEWISH_ADD_ALAFIM</B
  52241. ></TT
  52242. >
  52243.      (<A
  52244. HREF="#language.types.integer"
  52245. ><B
  52246. CLASS="type"
  52247. >integer</B
  52248. ></A
  52249. >)</DT
  52250. ><DD
  52251. ><P
  52252. >
  52253.     </P
  52254. ></DD
  52255. ><DT
  52256. ><TT
  52257. CLASS="constant"
  52258. ><B
  52259. >CAL_JEWISH_ADD_GERESHAYIM</B
  52260. ></TT
  52261. >
  52262.      (<A
  52263. HREF="#language.types.integer"
  52264. ><B
  52265. CLASS="type"
  52266. >integer</B
  52267. ></A
  52268. >)</DT
  52269. ><DD
  52270. ><P
  52271. >
  52272.     </P
  52273. ></DD
  52274. ></DL
  52275. ></DIV
  52276. ></DIV
  52277. ></DIV
  52278. ><DIV
  52279. CLASS="TOC"
  52280. ><DL
  52281. ><DT
  52282. ><B
  52283. >Obsah</B
  52284. ></DT
  52285. ><DT
  52286. ><A
  52287. HREF="#function.cal-days-in-month"
  52288. >cal_days_in_month</A
  52289. > -- Return the number of days in a month for a given year and calendar</DT
  52290. ><DT
  52291. ><A
  52292. HREF="#function.cal-from-jd"
  52293. >cal_from_jd</A
  52294. > -- Converts from Julian Day Count to a supported calendar</DT
  52295. ><DT
  52296. ><A
  52297. HREF="#function.cal-info"
  52298. >cal_info</A
  52299. > -- Returns information about a particular calendar</DT
  52300. ><DT
  52301. ><A
  52302. HREF="#function.cal-to-jd"
  52303. >cal_to_jd</A
  52304. > -- Converts from a supported calendar to Julian Day Count</DT
  52305. ><DT
  52306. ><A
  52307. HREF="#function.easter-date"
  52308. >easter_date</A
  52309. > -- Zjistit UNIXov² timestamp VelikonoΦnφ p∙lnoci v danΘm roce
  52310.     </DT
  52311. ><DT
  52312. ><A
  52313. HREF="#function.easter-days"
  52314. >easter_days</A
  52315. > -- 
  52316.      Get number of days after March 21 on which Easter falls for a
  52317.      given year
  52318.     </DT
  52319. ><DT
  52320. ><A
  52321. HREF="#function.frenchtojd"
  52322. >FrenchToJD</A
  52323. > -- 
  52324.      P°evΘst datum z FrancouzskΘho republikßnskΘho kalendß°e na Julian
  52325.      Day Count
  52326.     </DT
  52327. ><DT
  52328. ><A
  52329. HREF="#function.gregoriantojd"
  52330. >GregorianToJD</A
  52331. > -- P°evΘst GregorißnskΘ datum na Julian Day Count</DT
  52332. ><DT
  52333. ><A
  52334. HREF="#function.jddayofweek"
  52335. >JDDayOfWeek</A
  52336. > -- Vrßtit den v t²dnu</DT
  52337. ><DT
  52338. ><A
  52339. HREF="#function.jdmonthname"
  52340. >JDMonthName</A
  52341. > -- Vrßtit nßzev m∞sφce</DT
  52342. ><DT
  52343. ><A
  52344. HREF="#function.jdtofrench"
  52345. >JDToFrench</A
  52346. > -- 
  52347.      P°evΘst Julian Day Count na Francouzsk² republikßnsk² kalendß°
  52348.     </DT
  52349. ><DT
  52350. ><A
  52351. HREF="#function.jdtogregorian"
  52352. >JDToGregorian</A
  52353. > -- P°evΘst Julian Day Count na GregorißnskΘ datum</DT
  52354. ><DT
  52355. ><A
  52356. HREF="#function.jdtojewish"
  52357. >JDToJewish</A
  52358. > -- 
  52359.      P°evΘst Julian Day Count na  idovsk² kalendß°
  52360.     </DT
  52361. ><DT
  52362. ><A
  52363. HREF="#function.jdtojulian"
  52364. >JDToJulian</A
  52365. > -- 
  52366.      P°evΘst Julian Day Count na JulißnskΘ datum
  52367.     </DT
  52368. ><DT
  52369. ><A
  52370. HREF="#function.jdtounix"
  52371. >jdtounix</A
  52372. > -- P°evΘst Julian Day Count na UNIXov² timestamp</DT
  52373. ><DT
  52374. ><A
  52375. HREF="#function.jewishtojd"
  52376. >JewishToJD</A
  52377. > -- 
  52378.      P°evΘst datum podle  idovskΘho kalendß°e na Julian Day Count
  52379.     </DT
  52380. ><DT
  52381. ><A
  52382. HREF="#function.juliantojd"
  52383. >JulianToJD</A
  52384. > -- 
  52385.      P°evΘst JulißnskΘ datum na Julian Day Count
  52386.     </DT
  52387. ><DT
  52388. ><A
  52389. HREF="#function.unixtojd"
  52390. >unixtojd</A
  52391. > -- P°evΘst UNIXov² timestamp na Julian Day Count</DT
  52392. ></DL
  52393. ></DIV
  52394. ></DIV
  52395. ><H1
  52396. ><A
  52397. NAME="function.cal-days-in-month"
  52398. ></A
  52399. >cal_days_in_month</H1
  52400. ><DIV
  52401. CLASS="refnamediv"
  52402. ><A
  52403. NAME="AEN10195"
  52404. ></A
  52405. ><P
  52406. >    (PHP 4 >= 4.1.0)</P
  52407. >cal_days_in_month -- Return the number of days in a month for a given year and calendar</DIV
  52408. ><DIV
  52409. CLASS="refsect1"
  52410. ><A
  52411. NAME="AEN10198"
  52412. ></A
  52413. ><H2
  52414. >Description</H2
  52415. >int <B
  52416. CLASS="methodname"
  52417. >cal_days_in_month</B
  52418. > ( int calendar, int month, int year)<BR
  52419. ></BR
  52420. ><P
  52421. >      This function will return the number of days in the
  52422.      <TT
  52423. CLASS="parameter"
  52424. ><I
  52425. >month</I
  52426. ></TT
  52427. > of <TT
  52428. CLASS="parameter"
  52429. ><I
  52430. >year</I
  52431. ></TT
  52432. > for
  52433.      the specified <TT
  52434. CLASS="parameter"
  52435. ><I
  52436. >calendar</I
  52437. ></TT
  52438. >.
  52439.     </P
  52440. ><P
  52441. >      <TABLE
  52442. WIDTH="100%"
  52443. BORDER="0"
  52444. CELLPADDING="0"
  52445. CELLSPACING="0"
  52446. CLASS="EXAMPLE"
  52447. ><TR
  52448. ><TD
  52449. ><DIV
  52450. CLASS="example"
  52451. ><A
  52452. NAME="AEN10217"
  52453. ></A
  52454. ><P
  52455. ><B
  52456. >P°φklad 1. <B
  52457. CLASS="function"
  52458. >cal_days_in_month()</B
  52459. > example</B
  52460. ></P
  52461. ><TABLE
  52462. BORDER="0"
  52463. BGCOLOR="#E0E0E0"
  52464. CELLPADDING="5"
  52465. ><TR
  52466. ><TD
  52467. ><PRE
  52468. CLASS="php"
  52469. ><?php
  52470. $num = cal_days_in_month(CAL_GREGORIAN, 8, 2003); // 31
  52471. echo "There was $num days in August 2003";
  52472. ?></PRE
  52473. ></TD
  52474. ></TR
  52475. ></TABLE
  52476. ></DIV
  52477. ></TD
  52478. ></TR
  52479. ></TABLE
  52480. >
  52481.     </P
  52482. ><P
  52483. >      See also <A
  52484. HREF="#function.jdtounix"
  52485. ><B
  52486. CLASS="function"
  52487. >jdtounix()</B
  52488. ></A
  52489. >.
  52490.     </P
  52491. ></DIV
  52492. ><H1
  52493. ><A
  52494. NAME="function.cal-from-jd"
  52495. ></A
  52496. >cal_from_jd</H1
  52497. ><DIV
  52498. CLASS="refnamediv"
  52499. ><A
  52500. NAME="AEN10224"
  52501. ></A
  52502. ><P
  52503. >    (PHP 4 >= 4.1.0)</P
  52504. >cal_from_jd -- Converts from Julian Day Count to a supported calendar</DIV
  52505. ><DIV
  52506. CLASS="refsect1"
  52507. ><A
  52508. NAME="AEN10227"
  52509. ></A
  52510. ><H2
  52511. >Description</H2
  52512. >array <B
  52513. CLASS="methodname"
  52514. >cal_from_jd</B
  52515. > ( int jd, int calendar)<BR
  52516. ></BR
  52517. ><P
  52518. >      <B
  52519. CLASS="function"
  52520. >cal_from_jd()</B
  52521. > converts the Julian day given in
  52522.      <TT
  52523. CLASS="parameter"
  52524. ><I
  52525. >jd</I
  52526. ></TT
  52527. > into a date of the specified
  52528.      <TT
  52529. CLASS="parameter"
  52530. ><I
  52531. >calendar</I
  52532. ></TT
  52533. >. Supported
  52534.      <TT
  52535. CLASS="parameter"
  52536. ><I
  52537. >calendar</I
  52538. ></TT
  52539. > values are
  52540.      <TT
  52541. CLASS="constant"
  52542. ><B
  52543. >CAL_GREGORIAN</B
  52544. ></TT
  52545. >,
  52546.      <TT
  52547. CLASS="constant"
  52548. ><B
  52549. >CAL_JULIAN</B
  52550. ></TT
  52551. >,
  52552.      <TT
  52553. CLASS="constant"
  52554. ><B
  52555. >CAL_JEWISH</B
  52556. ></TT
  52557. > and
  52558.      <TT
  52559. CLASS="constant"
  52560. ><B
  52561. >CAL_FRENCH</B
  52562. ></TT
  52563. >.
  52564.     </P
  52565. ><P
  52566. >      <TABLE
  52567. WIDTH="100%"
  52568. BORDER="0"
  52569. CELLPADDING="0"
  52570. CELLSPACING="0"
  52571. CLASS="EXAMPLE"
  52572. ><TR
  52573. ><TD
  52574. ><DIV
  52575. CLASS="example"
  52576. ><A
  52577. NAME="AEN10248"
  52578. ></A
  52579. ><P
  52580. ><B
  52581. >P°φklad 1. <B
  52582. CLASS="function"
  52583. >cal_from_jd()</B
  52584. > example</B
  52585. ></P
  52586. ><TABLE
  52587. BORDER="0"
  52588. BGCOLOR="#E0E0E0"
  52589. CELLPADDING="5"
  52590. ><TR
  52591. ><TD
  52592. ><PRE
  52593. CLASS="php"
  52594. ><?php
  52595. $today = unixtojd(mktime(0, 0, 0, 8, 16, 2003));
  52596. print_r(cal_from_jd($today, CAL_GREGORIAN));
  52597. ?></PRE
  52598. ></TD
  52599. ></TR
  52600. ></TABLE
  52601. ><P
  52602. >        This will output :
  52603.       </P
  52604. ><TABLE
  52605. BORDER="0"
  52606. BGCOLOR="#E0E0E0"
  52607. CELLPADDING="5"
  52608. ><TR
  52609. ><TD
  52610. ><PRE
  52611. CLASS="screen"
  52612. >Array
  52613. (
  52614.     [date] => 8/16/2003
  52615.     [month] => 8
  52616.     [day] => 16
  52617.     [year] => 2003
  52618.     [dow] => 6
  52619.     [abbrevdayname] => Sat
  52620.     [dayname] => Saturday
  52621.     [abbrevmonth] => Aug
  52622.     [monthname] => August
  52623. )</PRE
  52624. ></TD
  52625. ></TR
  52626. ></TABLE
  52627. ></DIV
  52628. ></TD
  52629. ></TR
  52630. ></TABLE
  52631. >
  52632.     </P
  52633. ><P
  52634. >      See also <A
  52635. HREF="#function.cal-to-jd"
  52636. ><B
  52637. CLASS="function"
  52638. >cal_to_jd()</B
  52639. ></A
  52640. >.
  52641.     </P
  52642. ></DIV
  52643. ><H1
  52644. ><A
  52645. NAME="function.cal-info"
  52646. ></A
  52647. >cal_info</H1
  52648. ><DIV
  52649. CLASS="refnamediv"
  52650. ><A
  52651. NAME="AEN10257"
  52652. ></A
  52653. ><P
  52654. >    (PHP 4 >= 4.1.0)</P
  52655. >cal_info -- Returns information about a particular calendar</DIV
  52656. ><DIV
  52657. CLASS="refsect1"
  52658. ><A
  52659. NAME="AEN10260"
  52660. ></A
  52661. ><H2
  52662. >Description</H2
  52663. >array <B
  52664. CLASS="methodname"
  52665. >cal_info</B
  52666. > ( [int calendar])<BR
  52667. ></BR
  52668. ><P
  52669. >      <B
  52670. CLASS="function"
  52671. >cal_info()</B
  52672. > returns information on the
  52673.      specified <TT
  52674. CLASS="parameter"
  52675. ><I
  52676. >calendar</I
  52677. ></TT
  52678. > or on all supported
  52679.      calendars if no <TT
  52680. CLASS="parameter"
  52681. ><I
  52682. >calendar</I
  52683. ></TT
  52684. > is specified.
  52685.     </P
  52686. ><P
  52687. >      Calendar information is returned as an array containing the
  52688.      elements <TT
  52689. CLASS="literal"
  52690. >calname</TT
  52691. >, <TT
  52692. CLASS="literal"
  52693. >calsymbol</TT
  52694. >,
  52695.      <TT
  52696. CLASS="literal"
  52697. >month</TT
  52698. >, <TT
  52699. CLASS="literal"
  52700. >abbrevmonth</TT
  52701. > and
  52702.      <TT
  52703. CLASS="literal"
  52704. >maxdaysinmonth</TT
  52705. >.
  52706.     </P
  52707. ><P
  52708. >      If no <TT
  52709. CLASS="parameter"
  52710. ><I
  52711. >calendar</I
  52712. ></TT
  52713. > is specified information on all
  52714.      supported calendars is returned as an array. This functionality
  52715.      will be available beginning with PHP 5.
  52716.     </P
  52717. ></DIV
  52718. ><H1
  52719. ><A
  52720. NAME="function.cal-to-jd"
  52721. ></A
  52722. >cal_to_jd</H1
  52723. ><DIV
  52724. CLASS="refnamediv"
  52725. ><A
  52726. NAME="AEN10281"
  52727. ></A
  52728. ><P
  52729. >    (PHP 4 >= 4.1.0)</P
  52730. >cal_to_jd -- Converts from a supported calendar to Julian Day Count</DIV
  52731. ><DIV
  52732. CLASS="refsect1"
  52733. ><A
  52734. NAME="AEN10284"
  52735. ></A
  52736. ><H2
  52737. >Description</H2
  52738. >int <B
  52739. CLASS="methodname"
  52740. >cal_to_jd</B
  52741. > ( int calendar, int month, int day, int year)<BR
  52742. ></BR
  52743. ><P
  52744. >      <B
  52745. CLASS="function"
  52746. >cal_to_jd()</B
  52747. > calculates the Julian day count
  52748.      for a date in the specified <TT
  52749. CLASS="parameter"
  52750. ><I
  52751. >calendar</I
  52752. ></TT
  52753. >.
  52754.      Supported <TT
  52755. CLASS="parameter"
  52756. ><I
  52757. >calendar</I
  52758. ></TT
  52759. >s are
  52760.      <TT
  52761. CLASS="constant"
  52762. ><B
  52763. >CAL_GREGORIAN</B
  52764. ></TT
  52765. >,
  52766.      <TT
  52767. CLASS="constant"
  52768. ><B
  52769. >CAL_JULIAN</B
  52770. ></TT
  52771. >,
  52772.      <TT
  52773. CLASS="constant"
  52774. ><B
  52775. >CAL_JEWISH</B
  52776. ></TT
  52777. > and
  52778.      <TT
  52779. CLASS="constant"
  52780. ><B
  52781. >CAL_FRENCH</B
  52782. ></TT
  52783. >.
  52784.     </P
  52785. ><P
  52786. >      See also <B
  52787. CLASS="function"
  52788. >cal_to_jd()</B
  52789. >.
  52790.     </P
  52791. ></DIV
  52792. ><H1
  52793. ><A
  52794. NAME="function.easter-date"
  52795. ></A
  52796. >easter_date</H1
  52797. ><DIV
  52798. CLASS="refnamediv"
  52799. ><A
  52800. NAME="AEN10312"
  52801. ></A
  52802. ><P
  52803. >    (PHP 3>= 3.0.9, PHP 4 )</P
  52804. >easter_date -- Zjistit UNIXov² timestamp VelikonoΦnφ p∙lnoci v danΘm roce
  52805.     </DIV
  52806. ><DIV
  52807. CLASS="refsect1"
  52808. ><A
  52809. NAME="AEN10315"
  52810. ></A
  52811. ><H2
  52812. >Popis</H2
  52813. >int <B
  52814. CLASS="methodname"
  52815. >easter_date</B
  52816. > ( int year)<BR
  52817. ></BR
  52818. ><P
  52819. >      Vracφ UNIXov² timestamp odpovφdajφcφ VelikonoΦnφ p∙lnoci v danΘm roce.
  52820.      Default <TT
  52821. CLASS="parameter"
  52822. ><I
  52823. >year</I
  52824. ></TT
  52825. > je souΦasn² rok.
  52826.     </P
  52827. ><P
  52828. >      <SPAN
  52829. CLASS="emphasis"
  52830. ><I
  52831. CLASS="emphasis"
  52832. >Varovßnφ:</I
  52833. ></SPAN
  52834. > Tato funkce vygeneruje varovßnφ, pokud je
  52835.      <TT
  52836. CLASS="parameter"
  52837. ><I
  52838. >year</I
  52839. ></TT
  52840. > mimo rozsah UNIXov²ch timestamp∙ (tj. p°ed 1970
  52841.      nebo po 2037).
  52842.      <TABLE
  52843. WIDTH="100%"
  52844. BORDER="0"
  52845. CELLPADDING="0"
  52846. CELLSPACING="0"
  52847. CLASS="EXAMPLE"
  52848. ><TR
  52849. ><TD
  52850. ><DIV
  52851. CLASS="example"
  52852. ><A
  52853. NAME="AEN10328"
  52854. ></A
  52855. ><P
  52856. ><B
  52857. >P°φklad 1. Ukßzka <B
  52858. CLASS="function"
  52859. >easter_date()</B
  52860. ></B
  52861. ></P
  52862. ><TABLE
  52863. BORDER="0"
  52864. BGCOLOR="#E0E0E0"
  52865. CELLPADDING="5"
  52866. ><TR
  52867. ><TD
  52868. ><PRE
  52869. CLASS="php"
  52870. >echo date ("M-d-Y", easter_date(1999));        /* "Apr-04-1999" */
  52871. echo date ("M-d-Y", easter_date(2000));        /* "Apr-23-2000" */
  52872. echo date ("M-d-Y", easter_date(2001));        /* "Apr-15-2001" */</PRE
  52873. ></TD
  52874. ></TR
  52875. ></TABLE
  52876. ></DIV
  52877. ></TD
  52878. ></TR
  52879. ></TABLE
  52880. >
  52881.     </P
  52882. ><P
  52883. >      Datum Velikonoc bylo definovßno Nicaejsk²m koncilem v r. 325 n. l. jako
  52884.      ned∞le po prvnφm ·pl≥ku kter² p°ipadß na nebo po jarnφ rovnodennosti.
  52885.      Rovnodennost se v╛dy p°edpoklßdß na 21. b°ezna, tak╛e se v²poΦet redukuje
  52886.      na urΦenφ data ·pl≥ku a data nßsledujφcφ ned∞le. Zde pou╛it² algoritmus
  52887.      byl poprvΘ pou╛it kolem roku 532 Dionysiem Exiguem. V JulißnskΘm kalendß°i
  52888.      (pro lΘta p°ed 1753) se na sledovßnφ fßzφ M∞sφce pou╛φval jednoduch²
  52889.      devatenßctilet² cyklus. V GregorißnskΘm kalendß°i (pro lΘta po 1753 -
  52890.      navr╛en Claviem a Liliem a zaveden pape╛em ╪eho°em XIII v °φjnu 1582, v
  52891.      Britßnii a jejφch koloniφch v zß°φ 1752) se p°idßvajφ dva faktory, kterΘ
  52892.      tento cyklus zp°es≥ujφ.
  52893.     </P
  52894. ><P
  52895. >      (K≤d je zalo╛en na C programu od Simona Kershawa,
  52896.      <webmaster@ely.anglican.org>)
  52897.     </P
  52898. ><P
  52899. >      V²poΦet Velikonoc p°ed rokem 1970 nebo po roce 2037 viz
  52900.      <A
  52901. HREF="#function.easter-days"
  52902. ><B
  52903. CLASS="function"
  52904. >easter_days()</B
  52905. ></A
  52906. >.
  52907.     </P
  52908. ></DIV
  52909. ><H1
  52910. ><A
  52911. NAME="function.easter-days"
  52912. ></A
  52913. >easter_days</H1
  52914. ><DIV
  52915. CLASS="refnamediv"
  52916. ><A
  52917. NAME="AEN10337"
  52918. ></A
  52919. ><P
  52920. >    (PHP 3>= 3.0.9, PHP 4 )</P
  52921. >easter_days -- 
  52922.      Get number of days after March 21 on which Easter falls for a
  52923.      given year
  52924.     </DIV
  52925. ><DIV
  52926. CLASS="refsect1"
  52927. ><A
  52928. NAME="AEN10340"
  52929. ></A
  52930. ><H2
  52931. >Popis</H2
  52932. >int <B
  52933. CLASS="methodname"
  52934. >easter_days</B
  52935. > ( int year)<BR
  52936. ></BR
  52937. ><P
  52938. >      Vracφ poΦet dnφ od 21. b°ezna do Velikonoc v danΘm roce. Default
  52939.      <TT
  52940. CLASS="parameter"
  52941. ><I
  52942. >year</I
  52943. ></TT
  52944. > je souΦasn² rok.
  52945.     </P
  52946. ><P
  52947. >      Tato funkce je vyu╛itelnß mφsto <A
  52948. HREF="#function.easter-date"
  52949. ><B
  52950. CLASS="function"
  52951. >easter_date()</B
  52952. ></A
  52953. > na v²poΦty
  52954.      Velikonoc pro roky kterΘ spadajφ mimo rozsah UNIXov²ch timestamp∙ (tj. p°ed
  52955.      rokem 1970 a po roce 2037).
  52956.      <TABLE
  52957. WIDTH="100%"
  52958. BORDER="0"
  52959. CELLPADDING="0"
  52960. CELLSPACING="0"
  52961. CLASS="EXAMPLE"
  52962. ><TR
  52963. ><TD
  52964. ><DIV
  52965. CLASS="example"
  52966. ><A
  52967. NAME="AEN10352"
  52968. ></A
  52969. ><P
  52970. ><B
  52971. >P°φklad 1. Ukßzka <A
  52972. HREF="#function.easter-date"
  52973. ><B
  52974. CLASS="function"
  52975. >easter_date()</B
  52976. ></A
  52977. ></B
  52978. ></P
  52979. ><TABLE
  52980. BORDER="0"
  52981. BGCOLOR="#E0E0E0"
  52982. CELLPADDING="5"
  52983. ><TR
  52984. ><TD
  52985. ><PRE
  52986. CLASS="php"
  52987. >echo easter_days (1999);        /* 14, i.e. April 4   */
  52988. echo easter_days (1492);        /* 32, i.e. April 22  */
  52989. echo easter_days (1913);        /*  2, i.e. March 23  */</PRE
  52990. ></TD
  52991. ></TR
  52992. ></TABLE
  52993. ></DIV
  52994. ></TD
  52995. ></TR
  52996. ></TABLE
  52997. >
  52998.     </P
  52999. ><P
  53000. >      Datum Velikonoc bylo definovßno Nicaejsk²m koncilem v r. 325 n. l. jako
  53001.      ned∞le po prvnφm ·pl≥ku kter² p°ipadß na nebo po jarnφ rovnodennosti.
  53002.      Rovnodennost se v╛dy p°edpoklßdß na 21. b°ezna, tak╛e se v²poΦet redukuje
  53003.      na urΦenφ data ·pl≥ku a data nßsledujφcφ ned∞le. Zde pou╛it² algoritmus
  53004.      byl poprvΘ pou╛it kolem roku 532 Dionysiem Exiguem. V JulißnskΘm kalendß°i
  53005.      (pro lΘta p°ed 1753) se na sledovßnφ fßzφ M∞sφce pou╛φval jednoduch²
  53006.      devatenßctilet² cyklus. V GregorißnskΘm kalendß°i (pro lΘta po 1753 -
  53007.      navr╛en Claviem a Liliem a zaveden pape╛em ╪eho°em XIII v °φjnu 1582, v
  53008.      Britßnii a jejφch koloniφch v zß°φ 1752) se p°idßvajφ dva faktory, kterΘ
  53009.      tento cyklus zp°es≥ujφ.
  53010.     </P
  53011. ><P
  53012. >      (K≤d je zalo╛en na C programu od Simona Kershawa,
  53013.      <webmaster@ely.anglican.org>)
  53014.     </P
  53015. ><P
  53016. >      Viz takΘ: <A
  53017. HREF="#function.easter-date"
  53018. ><B
  53019. CLASS="function"
  53020. >easter_date()</B
  53021. ></A
  53022. >.
  53023.     </P
  53024. ></DIV
  53025. ><H1
  53026. ><A
  53027. NAME="function.frenchtojd"
  53028. ></A
  53029. >FrenchToJD</H1
  53030. ><DIV
  53031. CLASS="refnamediv"
  53032. ><A
  53033. NAME="AEN10361"
  53034. ></A
  53035. ><P
  53036. >    (PHP 3, PHP 4 )</P
  53037. >FrenchToJD -- 
  53038.      P°evΘst datum z FrancouzskΘho republikßnskΘho kalendß°e na Julian
  53039.      Day Count
  53040.     </DIV
  53041. ><DIV
  53042. CLASS="refsect1"
  53043. ><A
  53044. NAME="AEN10364"
  53045. ></A
  53046. ><H2
  53047. >Popis</H2
  53048. >int <B
  53049. CLASS="methodname"
  53050. >frenchtojd</B
  53051. > ( int month, int day, int year)<BR
  53052. ></BR
  53053. ><P
  53054. >      P°evßdφ datum z FrancouzskΘho republikßnskΘho kalendß°e na Julian
  53055.      Day Count.
  53056.     </P
  53057. ><P
  53058. >      Tyto rutiny konvertujφ pouze data v letech 1 a╛ 14 (Gregorißnskß data
  53059.      22. zß°φ 1792 a╛ 22. zß°φ 1806). To vφce ne╛ dostateΦn∞ pokr²vß obdobφ, po
  53060.      kterΘ se tento kalendß° pou╛φval.
  53061.     </P
  53062. ></DIV
  53063. ><H1
  53064. ><A
  53065. NAME="function.gregoriantojd"
  53066. ></A
  53067. >GregorianToJD</H1
  53068. ><DIV
  53069. CLASS="refnamediv"
  53070. ><A
  53071. NAME="AEN10381"
  53072. ></A
  53073. ><P
  53074. >    (PHP 3, PHP 4 )</P
  53075. >GregorianToJD -- P°evΘst GregorißnskΘ datum na Julian Day Count</DIV
  53076. ><DIV
  53077. CLASS="refsect1"
  53078. ><A
  53079. NAME="AEN10384"
  53080. ></A
  53081. ><H2
  53082. >Popis</H2
  53083. >int <B
  53084. CLASS="methodname"
  53085. >gregoriantojd</B
  53086. > ( int month, int day, int year)<BR
  53087. ></BR
  53088. ><P
  53089. >      Platn² rozsah GregorißnskΘho kalendß°e je 4714 p°. n. l. a╛ 9999 n. l.
  53090.     </P
  53091. ><P
  53092. >      Jakkoli tento software zvlßdß data a╛ do 4714 p°. n. l., takovΘ pou╛itφ asi
  53093.      nemß smysl. Gregorißnsk² kalendß° byl zalo╛en a╛ 15. °φjna 1582 (5. °φjna
  53094.      1582 podle JulißnskΘho kalendß°e). N∞kterΘ zem∞ ho p°ijaly mnohem pozd∞ji,
  53095.      ╪ecko a╛ v r. 1923. V∞t╣ina evropsk²m stßt∙ p°ed Gregorißnsk²m kalendß°em
  53096.      pou╛φvala Julißnsk².
  53097.      <TABLE
  53098. WIDTH="100%"
  53099. BORDER="0"
  53100. CELLPADDING="0"
  53101. CELLSPACING="0"
  53102. CLASS="EXAMPLE"
  53103. ><TR
  53104. ><TD
  53105. ><DIV
  53106. CLASS="example"
  53107. ><A
  53108. NAME="AEN10400"
  53109. ></A
  53110. ><P
  53111. ><B
  53112. >P°φklad 1. Kalendß°ovΘ funkce</B
  53113. ></P
  53114. ><TABLE
  53115. BORDER="0"
  53116. BGCOLOR="#E0E0E0"
  53117. CELLPADDING="5"
  53118. ><TR
  53119. ><TD
  53120. ><PRE
  53121. CLASS="php"
  53122. ><?php
  53123. $jd = GregorianToJD (10,11,1970);
  53124. echo "$jd\n";
  53125. $gregorian = JDToGregorian ($jd);
  53126. echo "$gregorian\n";
  53127. ?></PRE
  53128. ></TD
  53129. ></TR
  53130. ></TABLE
  53131. ></DIV
  53132. ></TD
  53133. ></TR
  53134. ></TABLE
  53135. >
  53136.     </P
  53137. ></DIV
  53138. ><H1
  53139. ><A
  53140. NAME="function.jddayofweek"
  53141. ></A
  53142. >JDDayOfWeek</H1
  53143. ><DIV
  53144. CLASS="refnamediv"
  53145. ><A
  53146. NAME="AEN10404"
  53147. ></A
  53148. ><P
  53149. >    (PHP 3, PHP 4 )</P
  53150. >JDDayOfWeek -- Vrßtit den v t²dnu</DIV
  53151. ><DIV
  53152. CLASS="refsect1"
  53153. ><A
  53154. NAME="AEN10407"
  53155. ></A
  53156. ><H2
  53157. >Popis</H2
  53158. >mixed <B
  53159. CLASS="methodname"
  53160. >jddayofweek</B
  53161. > ( int julianday, int mode)<BR
  53162. ></BR
  53163. ><P
  53164. >      Vracφ den v t²dnu. V zßvislosti na m≤du vracφ °et∞zec nebo integer.
  53165.      <DIV
  53166. CLASS="table"
  53167. ><A
  53168. NAME="AEN10419"
  53169. ></A
  53170. ><P
  53171. ><B
  53172. >Tabulka 1. Kalendß°ovΘ t²dennφ m≤dy</B
  53173. ></P
  53174. ><TABLE
  53175. BORDER="1"
  53176. CLASS="CALSTABLE"
  53177. ><THEAD
  53178. ><TR
  53179. ><TH
  53180. ALIGN="LEFT"
  53181. VALIGN="MIDDLE"
  53182. >M≤d</TH
  53183. ><TH
  53184. ALIGN="LEFT"
  53185. VALIGN="MIDDLE"
  53186. >V²znam</TH
  53187. ></TR
  53188. ></THEAD
  53189. ><TBODY
  53190. ><TR
  53191. ><TD
  53192. ALIGN="LEFT"
  53193. VALIGN="MIDDLE"
  53194. >0</TD
  53195. ><TD
  53196. ALIGN="LEFT"
  53197. VALIGN="MIDDLE"
  53198. >       Vracφ Φφslo dne jako integer (0=sunday, 1=monday, etc)
  53199.      </TD
  53200. ></TR
  53201. ><TR
  53202. ><TD
  53203. ALIGN="LEFT"
  53204. VALIGN="MIDDLE"
  53205. >1</TD
  53206. ><TD
  53207. ALIGN="LEFT"
  53208. VALIGN="MIDDLE"
  53209. >       Vracφ °et∞zec obsahujφcφ nßzev dne v t²dnu (anglick² gregorißnsk²)
  53210.      </TD
  53211. ></TR
  53212. ><TR
  53213. ><TD
  53214. ALIGN="LEFT"
  53215. VALIGN="MIDDLE"
  53216. >2</TD
  53217. ><TD
  53218. ALIGN="LEFT"
  53219. VALIGN="MIDDLE"
  53220. >       Vracφ °et∞zec obsahujφcφ zkrßcen² nßzev dne v t²dnu (anglick² gregorißnsk²)
  53221.      </TD
  53222. ></TR
  53223. ></TBODY
  53224. ></TABLE
  53225. ></DIV
  53226. >
  53227.     </P
  53228. ></DIV
  53229. ><H1
  53230. ><A
  53231. NAME="function.jdmonthname"
  53232. ></A
  53233. >JDMonthName</H1
  53234. ><DIV
  53235. CLASS="refnamediv"
  53236. ><A
  53237. NAME="AEN10437"
  53238. ></A
  53239. ><P
  53240. >    (PHP 3, PHP 4 )</P
  53241. >JDMonthName -- Vrßtit nßzev m∞sφce</DIV
  53242. ><DIV
  53243. CLASS="refsect1"
  53244. ><A
  53245. NAME="AEN10440"
  53246. ></A
  53247. ><H2
  53248. >Popis</H2
  53249. >string <B
  53250. CLASS="methodname"
  53251. >jdmonthname</B
  53252. > ( int julianday, int mode)<BR
  53253. ></BR
  53254. ><P
  53255. >      Vracφ °et∞zec obsahujφcφ nßzev m∞sφce. <TT
  53256. CLASS="parameter"
  53257. ><I
  53258. >mode</I
  53259. ></TT
  53260. > urΦuje,
  53261.      na kter² kalendß° se mß Julian Day Count konvertovat a jak² typ jmΘna se
  53262.      mß vrßtit.
  53263.      <DIV
  53264. CLASS="table"
  53265. ><A
  53266. NAME="AEN10453"
  53267. ></A
  53268. ><P
  53269. ><B
  53270. >Tabulka 1. Kalendß°ovΘ m≤dy</B
  53271. ></P
  53272. ><TABLE
  53273. BORDER="1"
  53274. CLASS="CALSTABLE"
  53275. ><THEAD
  53276. ><TR
  53277. ><TH
  53278. ALIGN="LEFT"
  53279. VALIGN="MIDDLE"
  53280. >M≤d</TH
  53281. ><TH
  53282. ALIGN="LEFT"
  53283. VALIGN="MIDDLE"
  53284. >V²znam</TH
  53285. ></TR
  53286. ></THEAD
  53287. ><TBODY
  53288. ><TR
  53289. ><TD
  53290. ALIGN="LEFT"
  53291. VALIGN="MIDDLE"
  53292. >0</TD
  53293. ><TD
  53294. ALIGN="LEFT"
  53295. VALIGN="MIDDLE"
  53296. >Gregorißnsk² - zkrßcen²</TD
  53297. ></TR
  53298. ><TR
  53299. ><TD
  53300. ALIGN="LEFT"
  53301. VALIGN="MIDDLE"
  53302. >1</TD
  53303. ><TD
  53304. ALIGN="LEFT"
  53305. VALIGN="MIDDLE"
  53306. >Gregorißnsk²</TD
  53307. ></TR
  53308. ><TR
  53309. ><TD
  53310. ALIGN="LEFT"
  53311. VALIGN="MIDDLE"
  53312. >2</TD
  53313. ><TD
  53314. ALIGN="LEFT"
  53315. VALIGN="MIDDLE"
  53316. >Julißnsk² - zkrßcen²</TD
  53317. ></TR
  53318. ><TR
  53319. ><TD
  53320. ALIGN="LEFT"
  53321. VALIGN="MIDDLE"
  53322. >3</TD
  53323. ><TD
  53324. ALIGN="LEFT"
  53325. VALIGN="MIDDLE"
  53326. >Julißnsk²</TD
  53327. ></TR
  53328. ><TR
  53329. ><TD
  53330. ALIGN="LEFT"
  53331. VALIGN="MIDDLE"
  53332. >4</TD
  53333. ><TD
  53334. ALIGN="LEFT"
  53335. VALIGN="MIDDLE"
  53336. > idovsk²</TD
  53337. ></TR
  53338. ><TR
  53339. ><TD
  53340. ALIGN="LEFT"
  53341. VALIGN="MIDDLE"
  53342. >5</TD
  53343. ><TD
  53344. ALIGN="LEFT"
  53345. VALIGN="MIDDLE"
  53346. >Francouzsk² republikßnsk²</TD
  53347. ></TR
  53348. ></TBODY
  53349. ></TABLE
  53350. ></DIV
  53351. >
  53352.     </P
  53353. ></DIV
  53354. ><H1
  53355. ><A
  53356. NAME="function.jdtofrench"
  53357. ></A
  53358. >JDToFrench</H1
  53359. ><DIV
  53360. CLASS="refnamediv"
  53361. ><A
  53362. NAME="AEN10480"
  53363. ></A
  53364. ><P
  53365. >    (PHP 3, PHP 4 )</P
  53366. >JDToFrench -- 
  53367.      P°evΘst Julian Day Count na Francouzsk² republikßnsk² kalendß°
  53368.     </DIV
  53369. ><DIV
  53370. CLASS="refsect1"
  53371. ><A
  53372. NAME="AEN10483"
  53373. ></A
  53374. ><H2
  53375. >Popis</H2
  53376. >string <B
  53377. CLASS="methodname"
  53378. >jdtofrench</B
  53379. > ( int juliandaycount)<BR
  53380. ></BR
  53381. ><P
  53382. >      P°evßdφ Julian Day Count na Francouzsk² republikßnsk² kalendß°.
  53383.     </P
  53384. ></DIV
  53385. ><H1
  53386. ><A
  53387. NAME="function.jdtogregorian"
  53388. ></A
  53389. >JDToGregorian</H1
  53390. ><DIV
  53391. CLASS="refnamediv"
  53392. ><A
  53393. NAME="AEN10493"
  53394. ></A
  53395. ><P
  53396. >    (PHP 3, PHP 4 )</P
  53397. >JDToGregorian -- P°evΘst Julian Day Count na GregorißnskΘ datum</DIV
  53398. ><DIV
  53399. CLASS="refsect1"
  53400. ><A
  53401. NAME="AEN10496"
  53402. ></A
  53403. ><H2
  53404. >Popis</H2
  53405. >string <B
  53406. CLASS="methodname"
  53407. >jdtogregorian</B
  53408. > ( int julianday)<BR
  53409. ></BR
  53410. ><P
  53411. >      P°evßdφ Julian Day Count na °et∞zec obsahujφcφ GregorißnskΘ datum ve formßtu
  53412.      "m∞sφc/den/rok".
  53413.     </P
  53414. ></DIV
  53415. ><H1
  53416. ><A
  53417. NAME="function.jdtojewish"
  53418. ></A
  53419. >JDToJewish</H1
  53420. ><DIV
  53421. CLASS="refnamediv"
  53422. ><A
  53423. NAME="AEN10506"
  53424. ></A
  53425. ><P
  53426. >    (PHP 3, PHP 4 )</P
  53427. >JDToJewish -- 
  53428.      P°evΘst Julian Day Count na  idovsk² kalendß°
  53429.     </DIV
  53430. ><DIV
  53431. CLASS="refsect1"
  53432. ><A
  53433. NAME="AEN10509"
  53434. ></A
  53435. ><H2
  53436. >Popis</H2
  53437. >string <B
  53438. CLASS="methodname"
  53439. >jdtojewish</B
  53440. > ( int julianday)<BR
  53441. ></BR
  53442. ><P
  53443. >      P°evßdφ Julian Day Count na  idovsk² kalendß°.
  53444.     </P
  53445. ></DIV
  53446. ><H1
  53447. ><A
  53448. NAME="function.jdtojulian"
  53449. ></A
  53450. >JDToJulian</H1
  53451. ><DIV
  53452. CLASS="refnamediv"
  53453. ><A
  53454. NAME="AEN10519"
  53455. ></A
  53456. ><P
  53457. >    (PHP 3, PHP 4 )</P
  53458. >JDToJulian -- 
  53459.      P°evΘst Julian Day Count na JulißnskΘ datum
  53460.     </DIV
  53461. ><DIV
  53462. CLASS="refsect1"
  53463. ><A
  53464. NAME="AEN10522"
  53465. ></A
  53466. ><H2
  53467. >Popis</H2
  53468. >string <B
  53469. CLASS="methodname"
  53470. >jdtojulian</B
  53471. > ( int julianday)<BR
  53472. ></BR
  53473. ><P
  53474. >      P°evßdφ Julian Day Count na °et∞zec obsahujφcφ JulißnskΘ datum ve formßtu
  53475.      "m∞sφc/den/rok".
  53476.     </P
  53477. ></DIV
  53478. ><H1
  53479. ><A
  53480. NAME="function.jdtounix"
  53481. ></A
  53482. >jdtounix</H1
  53483. ><DIV
  53484. CLASS="refnamediv"
  53485. ><A
  53486. NAME="AEN10532"
  53487. ></A
  53488. ><P
  53489. >    (PHP 4 )</P
  53490. >jdtounix -- P°evΘst Julian Day Count na UNIXov² timestamp</DIV
  53491. ><DIV
  53492. CLASS="refsect1"
  53493. ><A
  53494. NAME="AEN10535"
  53495. ></A
  53496. ><H2
  53497. >Popis</H2
  53498. >int <B
  53499. CLASS="methodname"
  53500. >jdtounix</B
  53501. > ( int jday)<BR
  53502. ></BR
  53503. ><P
  53504. >      <B
  53505. CLASS="function"
  53506. >jdtounix()</B
  53507. > vracφ UNIXov² timestamp odpovφdajφcφ Julian
  53508.      Day Countu danΘmu v <TT
  53509. CLASS="parameter"
  53510. ><I
  53511. >jday</I
  53512. ></TT
  53513. > nebo <TT
  53514. CLASS="constant"
  53515. ><B
  53516. >FALSE</B
  53517. ></TT
  53518. >,
  53519.      pokud je <TT
  53520. CLASS="parameter"
  53521. ><I
  53522. >jday</I
  53523. ></TT
  53524. > mimo UNIXovou epochu (GregorißnskΘ
  53525.      roky mezi 1970 a 2037, nebo-li 2440588 <= <TT
  53526. CLASS="parameter"
  53527. ><I
  53528. >jday</I
  53529. ></TT
  53530. >
  53531.      <= 2465342 )
  53532.     </P
  53533. ><P
  53534. >      Viz takΘ: <B
  53535. CLASS="function"
  53536. >jdtounix()</B
  53537. >.
  53538.     </P
  53539. ><DIV
  53540. CLASS="note"
  53541. ><BLOCKQUOTE
  53542. CLASS="note"
  53543. ><P
  53544. ><B
  53545. >Poznßmka: </B
  53546. >
  53547.       Tato funkce byla p°idßna v PHP 4 RC2.
  53548.      </P
  53549. ></BLOCKQUOTE
  53550. ></DIV
  53551. ></DIV
  53552. ><H1
  53553. ><A
  53554. NAME="function.jewishtojd"
  53555. ></A
  53556. >JewishToJD</H1
  53557. ><DIV
  53558. CLASS="refnamediv"
  53559. ><A
  53560. NAME="AEN10554"
  53561. ></A
  53562. ><P
  53563. >    (PHP 3, PHP 4 )</P
  53564. >JewishToJD -- 
  53565.      P°evΘst datum podle  idovskΘho kalendß°e na Julian Day Count
  53566.     </DIV
  53567. ><DIV
  53568. CLASS="refsect1"
  53569. ><A
  53570. NAME="AEN10557"
  53571. ></A
  53572. ><H2
  53573. >Popis</H2
  53574. >int <B
  53575. CLASS="methodname"
  53576. >jewishtojd</B
  53577. > ( int month, int day, int year)<BR
  53578. ></BR
  53579. ><P
  53580. >      Platn² rozsah
  53581.      Jakkoli tento software zvlßdß data a╛ do roku 1 (3761 p°. n. l.), takovΘ
  53582.      pou╛itφ asi nemß smysl.
  53583.     </P
  53584. ><P
  53585. >       idovsk² kalendß° se pou╛φvß n∞kolik tisφc let, ale zpoΦßtku neexistoval
  53586.      vzorec na urΦenφ zaΦßtku m∞sφce. Nov² m∞sφc zaΦφnal, kdy╛ byl poprvΘ spat°en
  53587.      nov² M∞sφc.
  53588.     </P
  53589. ></DIV
  53590. ><H1
  53591. ><A
  53592. NAME="function.juliantojd"
  53593. ></A
  53594. >JulianToJD</H1
  53595. ><DIV
  53596. CLASS="refnamediv"
  53597. ><A
  53598. NAME="AEN10574"
  53599. ></A
  53600. ><P
  53601. >    (PHP 3, PHP 4 )</P
  53602. >JulianToJD -- 
  53603.      P°evΘst JulißnskΘ datum na Julian Day Count
  53604.     </DIV
  53605. ><DIV
  53606. CLASS="refsect1"
  53607. ><A
  53608. NAME="AEN10577"
  53609. ></A
  53610. ><H2
  53611. >Popis</H2
  53612. >int <B
  53613. CLASS="methodname"
  53614. >juliantojd</B
  53615. > ( int month, int day, int year)<BR
  53616. ></BR
  53617. ><P
  53618. >      Platn² rozsah pro Julißnsk² kalendß° je 4713 p°. n. l. a╛ 9999 n. l.
  53619.     </P
  53620. ><P
  53621. >      Jakkoli tento software zvlßdß data a╛ do 4713 p°. n. l., takovΘ pou╛itφ asi
  53622.      nemß smysl. Tento kalendß° byl vytvo°en v roce 46 p°. n. l., ale detaily se
  53623.      nestabilizovaly nejmΘn∞ do 8 n. l., a mo╛nß a╛ do konce 4. stoletφ. Navφc
  53624.      zaΦßtek roku se li╣il od kultury ke kultu°e - ne v╣echny p°ijφmaly leden
  53625.      jako prvnφ m∞sφc roku.
  53626.     </P
  53627. ></DIV
  53628. ><H1
  53629. ><A
  53630. NAME="function.unixtojd"
  53631. ></A
  53632. >unixtojd</H1
  53633. ><DIV
  53634. CLASS="refnamediv"
  53635. ><A
  53636. NAME="AEN10594"
  53637. ></A
  53638. ><P
  53639. >    (PHP 4 )</P
  53640. >unixtojd -- P°evΘst UNIXov² timestamp na Julian Day Count</DIV
  53641. ><DIV
  53642. CLASS="refsect1"
  53643. ><A
  53644. NAME="AEN10597"
  53645. ></A
  53646. ><H2
  53647. >Popis</H2
  53648. >int <B
  53649. CLASS="methodname"
  53650. >unixtojd</B
  53651. > ( [int timestamp])<BR
  53652. ></BR
  53653. ><P
  53654. >      Vracφ Julian Day Count pro UNIXov² <TT
  53655. CLASS="parameter"
  53656. ><I
  53657. >timestamp</I
  53658. ></TT
  53659. >
  53660.      (sekundy od 1.1.1970), nebo pro aktußlnφ den, pokud nenφ dßn
  53661.      <TT
  53662. CLASS="parameter"
  53663. ><I
  53664. >timestamp</I
  53665. ></TT
  53666. >.
  53667.     </P
  53668. ><P
  53669. >      Viz takΘ: <A
  53670. HREF="#function.jdtounix"
  53671. ><B
  53672. CLASS="function"
  53673. >jdtounix()</B
  53674. ></A
  53675. >.
  53676.     </P
  53677. ><DIV
  53678. CLASS="note"
  53679. ><BLOCKQUOTE
  53680. CLASS="note"
  53681. ><P
  53682. ><B
  53683. >Poznßmka: </B
  53684. >
  53685.       Tato funkce byla p°idßna v PHP 4 RC2.
  53686.      </P
  53687. ></BLOCKQUOTE
  53688. ></DIV
  53689. ></DIV
  53690. ></DIV
  53691. ><DIV
  53692. CLASS="reference"
  53693. ><A
  53694. NAME="ref.ccvs"
  53695. ></A
  53696. ><DIV
  53697. CLASS="TITLEPAGE"
  53698. ><H1
  53699. CLASS="title"
  53700. >VII. CCVS API Functions</H1
  53701. ><DIV
  53702. CLASS="PARTINTRO"
  53703. ><A
  53704. NAME="AEN10615"
  53705. ></A
  53706. ><DIV
  53707. CLASS="section"
  53708. ><H1
  53709. CLASS="section"
  53710. ><A
  53711. NAME="ccvs.intro"
  53712. ></A
  53713. >┌vod</H1
  53714. ><P
  53715. >      Tyto funkce p°edstavujφ interface k CCVS API, a umo╛nujφ tak p°φmo pracovat
  53716.      s CCVS z va╣ich PHP skript∙. CCVS je <A
  53717. HREF="http://www.redhat.com/"
  53718. TARGET="_top"
  53719. >RedHatφ</A
  53720. > °e╣enφ "zprost°edkovatele"
  53721.      ve zpracovßnφ kreditnφch karet. Umo╛%nuje vßm oslovovat p°φmo zpracovatele
  53722.      kreditnφch karet p°es vß╣ *nix systΘm a modem. Pomocφ CCVS modulu pro PHP
  53723.      m∙╛ete zpracovßvat kreditnφ karty p°es CCVS ve va╣ich PHP skriptech.
  53724.      Nßsledujφcφ reference tento proces p°iblφ╛φ.
  53725.     </P
  53726. ><DIV
  53727. CLASS="note"
  53728. ><BLOCKQUOTE
  53729. CLASS="note"
  53730. ><P
  53731. ><B
  53732. >Poznßmka: </B
  53733. >
  53734.       CCVS bylo firmou RedHat pozastaveno a nemß v plßnu
  53735.       vydßvat dal╣φ klφΦe nebo podporovat kontrakty. Pokud hledßte
  53736.       nßhradu, zva╛te
  53737.       <A
  53738. HREF="http://www.mcve.com/"
  53739. TARGET="_top"
  53740. >MCVE firmy Main Street Softworks</A
  53741. >
  53742.       jako mo╛nou nßhradu. Mß podobn² design a dokumentovanou
  53743.       podporu PHP!
  53744.      </P
  53745. ><P
  53746. >       Toto roz╣φ°enφ bylo z PHP odstran∞no a od verze 4.3.0 nenφ k dispozici.
  53747.       Pokud chcete pou╛φvat funkce pro zpracovßnφ kreditnφch karet,
  53748.       m∙╛ete mφsto toho pou╛φt roz╣φ°enφ <A
  53749. HREF="#ref.mcve"
  53750. >MCVE</A
  53751. >.
  53752.      </P
  53753. ></BLOCKQUOTE
  53754. ></DIV
  53755. ></DIV
  53756. ><DIV
  53757. CLASS="section"
  53758. ><HR><H1
  53759. CLASS="section"
  53760. ><A
  53761. NAME="ccvs.installation"
  53762. ></A
  53763. >Instalace</H1
  53764. ><P
  53765. >     Pokud chcete zapnout CCVS podporu v PHP, zjist∞te si nejd°φve instalaΦnφ
  53766.     adresß° CCVS. Potom budete muset PHP zkonfigurovat s <TT
  53767. CLASS="option"
  53768. >--with-ccvs</TT
  53769. >. Pokud toto pou╛ijete be udßnφ cesty
  53770.     k va╣φ instalaci CCVS, PHP se pokusφ podφvat do defaultnφ instalaΦnφ lokace
  53771.     CCVS (/usr/local/ccvs). Pokud je CCVS na nestandardnφm mφst∞, spust∞te
  53772.     configure s: <TT
  53773. CLASS="option"
  53774. >--with-ccvs=$ccvs_path</TT
  53775. >, kde
  53776.     $ccvs_path je cesta k va╣φ instalaci CVS. Pozn.: Podpora CCVS vy╛aduje
  53777.     existenci $ccvs_path/lib a $ccvs_path/include, a p°φtomnost cv_api.h v
  53778.     adresß°i include a libccvs.a v adresß°i lib.
  53779.    </P
  53780. ><P
  53781. >     Dßle je pot°eba, aby b∞╛el proces ccvsd. Navφc, PHP processy musφ b∞╛et pod
  53782.     stejn²m u╛ivatelem, pod kter²m b∞hß CCVS (nap°. pokud jste instalovali ccvs
  53783.     jako 'ccvs', va╣e PHP procesy musφ takΘ b∞╛et jako 'ccvs').
  53784.  </P
  53785. ></DIV
  53786. ><DIV
  53787. CLASS="section"
  53788. ><HR><H1
  53789. CLASS="section"
  53790. ><A
  53791. NAME="ccvs.seealso"
  53792. ></A
  53793. >Viz takΘ</H1
  53794. ><P
  53795. >      RedHat p°eru╣il podporu CCVS, p°esto je mφrn∞
  53796.      zastaralß dokumentace k dispozici na
  53797.      <A
  53798. HREF="http://redhat.com/docs/manuals/ccvs/"
  53799. TARGET="_top"
  53800. >http://redhat.com/docs/manuals/ccvs/</A
  53801. >.
  53802.     </P
  53803. ></DIV
  53804. ></DIV
  53805. ><DIV
  53806. CLASS="TOC"
  53807. ><DL
  53808. ><DT
  53809. ><B
  53810. >Obsah</B
  53811. ></DT
  53812. ><DT
  53813. ><A
  53814. HREF="#function.ccvs-add"
  53815. >ccvs_add</A
  53816. > -- Add data to a transaction </DT
  53817. ><DT
  53818. ><A
  53819. HREF="#function.ccvs-auth"
  53820. >ccvs_auth</A
  53821. > --  
  53822.      Perform credit authorization test on a transaction 
  53823.     </DT
  53824. ><DT
  53825. ><A
  53826. HREF="#function.ccvs-command"
  53827. >ccvs_command</A
  53828. > -- 
  53829.      Performs a command which is peculiar to a single protocol, 
  53830.      and thus is not available in the general CCVS API 
  53831.     </DT
  53832. ><DT
  53833. ><A
  53834. HREF="#function.ccvs-count"
  53835. >ccvs_count</A
  53836. > -- 
  53837.      Find out how many transactions of a given type are stored in the system 
  53838.     </DT
  53839. ><DT
  53840. ><A
  53841. HREF="#function.ccvs-delete"
  53842. >ccvs_delete</A
  53843. > -- Delete a transaction</DT
  53844. ><DT
  53845. ><A
  53846. HREF="#function.ccvs-done"
  53847. >ccvs_done</A
  53848. > -- Terminate CCVS engine and do cleanup work</DT
  53849. ><DT
  53850. ><A
  53851. HREF="#function.ccvs-init"
  53852. >ccvs_init</A
  53853. > -- Initialize CCVS for use</DT
  53854. ><DT
  53855. ><A
  53856. HREF="#function.ccvs-lookup"
  53857. >ccvs_lookup</A
  53858. > -- 
  53859.      Look up an item of a particular type in the database #
  53860.     </DT
  53861. ><DT
  53862. ><A
  53863. HREF="#function.ccvs-new"
  53864. >ccvs_new</A
  53865. > -- Create a new, blank transaction </DT
  53866. ><DT
  53867. ><A
  53868. HREF="#function.ccvs-report"
  53869. >ccvs_report</A
  53870. > -- Return the status of the background communication process </DT
  53871. ><DT
  53872. ><A
  53873. HREF="#function.ccvs-return"
  53874. >ccvs_return</A
  53875. > -- 
  53876.      Transfer funds from the merchant to the credit card holder 
  53877.     </DT
  53878. ><DT
  53879. ><A
  53880. HREF="#function.ccvs-reverse"
  53881. >ccvs_reverse</A
  53882. > -- 
  53883.      Perform a full reversal on an already-processed authorization 
  53884.     </DT
  53885. ><DT
  53886. ><A
  53887. HREF="#function.ccvs-sale"
  53888. >ccvs_sale</A
  53889. > -- 
  53890.      Transfer funds from the credit card holder to the merchant
  53891.     </DT
  53892. ><DT
  53893. ><A
  53894. HREF="#function.ccvs-status"
  53895. >ccvs_status</A
  53896. > -- Check the status of an invoice</DT
  53897. ><DT
  53898. ><A
  53899. HREF="#function.ccvs-textvalue"
  53900. >ccvs_textvalue</A
  53901. > -- Get text return value for previous function call</DT
  53902. ><DT
  53903. ><A
  53904. HREF="#function.ccvs-void"
  53905. >ccvs_void</A
  53906. > -- 
  53907.      Perform a full reversal on a completed transaction 
  53908.     </DT
  53909. ></DL
  53910. ></DIV
  53911. ></DIV
  53912. ><H1
  53913. ><A
  53914. NAME="function.ccvs-add"
  53915. ></A
  53916. >ccvs_add</H1
  53917. ><DIV
  53918. CLASS="refnamediv"
  53919. ><A
  53920. NAME="AEN10636"
  53921. ></A
  53922. ><P
  53923. >    (4.0.2 - 4.2.3 only)</P
  53924. >ccvs_add -- Add data to a transaction </DIV
  53925. ><DIV
  53926. CLASS="refsect1"
  53927. ><A
  53928. NAME="AEN10639"
  53929. ></A
  53930. ><H2
  53931. >Description</H2
  53932. >string <B
  53933. CLASS="methodname"
  53934. >ccvs_add</B
  53935. > ( string session, string invoice, string argtype, string argval)<BR
  53936. ></BR
  53937. ><P
  53938. >      <DIV
  53939. CLASS="warning"
  53940. ><P
  53941. ></P
  53942. ><TABLE
  53943. CLASS="warning"
  53944. BORDER="1"
  53945. WIDTH="100%"
  53946. ><TR
  53947. ><TD
  53948. ALIGN="CENTER"
  53949. ><B
  53950. >Varovßnφ</B
  53951. ></TD
  53952. ></TR
  53953. ><TR
  53954. ><TD
  53955. ALIGN="LEFT"
  53956. ><P
  53957. >Tato funkce je╣t∞ nenφ
  53958. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  53959. ></TD
  53960. ></TR
  53961. ></TABLE
  53962. ></DIV
  53963. >
  53964.     </P
  53965. ></DIV
  53966. ><H1
  53967. ><A
  53968. NAME="function.ccvs-auth"
  53969. ></A
  53970. >ccvs_auth</H1
  53971. ><DIV
  53972. CLASS="refnamediv"
  53973. ><A
  53974. NAME="AEN10660"
  53975. ></A
  53976. ><P
  53977. >    (4.0.2 - 4.2.3 only)</P
  53978. >ccvs_auth --  
  53979.      Perform credit authorization test on a transaction 
  53980.     </DIV
  53981. ><DIV
  53982. CLASS="refsect1"
  53983. ><A
  53984. NAME="AEN10663"
  53985. ></A
  53986. ><H2
  53987. >Description</H2
  53988. >string <B
  53989. CLASS="methodname"
  53990. >ccvs_auth</B
  53991. > ( string session, string invoice)<BR
  53992. ></BR
  53993. ><P
  53994. >      <DIV
  53995. CLASS="warning"
  53996. ><P
  53997. ></P
  53998. ><TABLE
  53999. CLASS="warning"
  54000. BORDER="1"
  54001. WIDTH="100%"
  54002. ><TR
  54003. ><TD
  54004. ALIGN="CENTER"
  54005. ><B
  54006. >Varovßnφ</B
  54007. ></TD
  54008. ></TR
  54009. ><TR
  54010. ><TD
  54011. ALIGN="LEFT"
  54012. ><P
  54013. >Tato funkce je╣t∞ nenφ
  54014. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54015. ></TD
  54016. ></TR
  54017. ></TABLE
  54018. ></DIV
  54019. >
  54020.     </P
  54021. ></DIV
  54022. ><H1
  54023. ><A
  54024. NAME="function.ccvs-command"
  54025. ></A
  54026. >ccvs_command</H1
  54027. ><DIV
  54028. CLASS="refnamediv"
  54029. ><A
  54030. NAME="AEN10678"
  54031. ></A
  54032. ><P
  54033. >    (4.0.2 - 4.2.3 only)</P
  54034. >ccvs_command -- 
  54035.      Performs a command which is peculiar to a single protocol, 
  54036.      and thus is not available in the general CCVS API 
  54037.     </DIV
  54038. ><DIV
  54039. CLASS="refsect1"
  54040. ><A
  54041. NAME="AEN10681"
  54042. ></A
  54043. ><H2
  54044. >Description</H2
  54045. >string <B
  54046. CLASS="methodname"
  54047. >ccvs_command</B
  54048. > ( string session, string type, string argval)<BR
  54049. ></BR
  54050. ><P
  54051. >      <DIV
  54052. CLASS="warning"
  54053. ><P
  54054. ></P
  54055. ><TABLE
  54056. CLASS="warning"
  54057. BORDER="1"
  54058. WIDTH="100%"
  54059. ><TR
  54060. ><TD
  54061. ALIGN="CENTER"
  54062. ><B
  54063. >Varovßnφ</B
  54064. ></TD
  54065. ></TR
  54066. ><TR
  54067. ><TD
  54068. ALIGN="LEFT"
  54069. ><P
  54070. >Tato funkce je╣t∞ nenφ
  54071. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54072. ></TD
  54073. ></TR
  54074. ></TABLE
  54075. ></DIV
  54076. >
  54077.     </P
  54078. ></DIV
  54079. ><H1
  54080. ><A
  54081. NAME="function.ccvs-count"
  54082. ></A
  54083. >ccvs_count</H1
  54084. ><DIV
  54085. CLASS="refnamediv"
  54086. ><A
  54087. NAME="AEN10699"
  54088. ></A
  54089. ><P
  54090. >    (4.0.2 - 4.2.3 only)</P
  54091. >ccvs_count -- 
  54092.      Find out how many transactions of a given type are stored in the system 
  54093.     </DIV
  54094. ><DIV
  54095. CLASS="refsect1"
  54096. ><A
  54097. NAME="AEN10702"
  54098. ></A
  54099. ><H2
  54100. >Description</H2
  54101. >int <B
  54102. CLASS="methodname"
  54103. >ccvs_count</B
  54104. > ( string session, string type)<BR
  54105. ></BR
  54106. ><P
  54107. >      <DIV
  54108. CLASS="warning"
  54109. ><P
  54110. ></P
  54111. ><TABLE
  54112. CLASS="warning"
  54113. BORDER="1"
  54114. WIDTH="100%"
  54115. ><TR
  54116. ><TD
  54117. ALIGN="CENTER"
  54118. ><B
  54119. >Varovßnφ</B
  54120. ></TD
  54121. ></TR
  54122. ><TR
  54123. ><TD
  54124. ALIGN="LEFT"
  54125. ><P
  54126. >Tato funkce je╣t∞ nenφ
  54127. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54128. ></TD
  54129. ></TR
  54130. ></TABLE
  54131. ></DIV
  54132. >
  54133.     </P
  54134. ></DIV
  54135. ><H1
  54136. ><A
  54137. NAME="function.ccvs-delete"
  54138. ></A
  54139. >ccvs_delete</H1
  54140. ><DIV
  54141. CLASS="refnamediv"
  54142. ><A
  54143. NAME="AEN10717"
  54144. ></A
  54145. ><P
  54146. >    (4.0.2 - 4.2.3 only)</P
  54147. >ccvs_delete -- Delete a transaction</DIV
  54148. ><DIV
  54149. CLASS="refsect1"
  54150. ><A
  54151. NAME="AEN10720"
  54152. ></A
  54153. ><H2
  54154. >Description</H2
  54155. >string <B
  54156. CLASS="methodname"
  54157. >ccvs_delete</B
  54158. > ( string session, string invoice)<BR
  54159. ></BR
  54160. ><P
  54161. >      <DIV
  54162. CLASS="warning"
  54163. ><P
  54164. ></P
  54165. ><TABLE
  54166. CLASS="warning"
  54167. BORDER="1"
  54168. WIDTH="100%"
  54169. ><TR
  54170. ><TD
  54171. ALIGN="CENTER"
  54172. ><B
  54173. >Varovßnφ</B
  54174. ></TD
  54175. ></TR
  54176. ><TR
  54177. ><TD
  54178. ALIGN="LEFT"
  54179. ><P
  54180. >Tato funkce je╣t∞ nenφ
  54181. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54182. ></TD
  54183. ></TR
  54184. ></TABLE
  54185. ></DIV
  54186. >
  54187.     </P
  54188. ></DIV
  54189. ><H1
  54190. ><A
  54191. NAME="function.ccvs-done"
  54192. ></A
  54193. >ccvs_done</H1
  54194. ><DIV
  54195. CLASS="refnamediv"
  54196. ><A
  54197. NAME="AEN10735"
  54198. ></A
  54199. ><P
  54200. >    (4.0.2 - 4.2.3 only)</P
  54201. >ccvs_done -- Terminate CCVS engine and do cleanup work</DIV
  54202. ><DIV
  54203. CLASS="refsect1"
  54204. ><A
  54205. NAME="AEN10738"
  54206. ></A
  54207. ><H2
  54208. >Description</H2
  54209. >string <B
  54210. CLASS="methodname"
  54211. >ccvs_done</B
  54212. > ( string sess)<BR
  54213. ></BR
  54214. ><P
  54215. >      <DIV
  54216. CLASS="warning"
  54217. ><P
  54218. ></P
  54219. ><TABLE
  54220. CLASS="warning"
  54221. BORDER="1"
  54222. WIDTH="100%"
  54223. ><TR
  54224. ><TD
  54225. ALIGN="CENTER"
  54226. ><B
  54227. >Varovßnφ</B
  54228. ></TD
  54229. ></TR
  54230. ><TR
  54231. ><TD
  54232. ALIGN="LEFT"
  54233. ><P
  54234. >Tato funkce je╣t∞ nenφ
  54235. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54236. ></TD
  54237. ></TR
  54238. ></TABLE
  54239. ></DIV
  54240. >
  54241.     </P
  54242. ></DIV
  54243. ><H1
  54244. ><A
  54245. NAME="function.ccvs-init"
  54246. ></A
  54247. >ccvs_init</H1
  54248. ><DIV
  54249. CLASS="refnamediv"
  54250. ><A
  54251. NAME="AEN10750"
  54252. ></A
  54253. ><P
  54254. >    (4.0.2 - 4.2.3 only)</P
  54255. >ccvs_init -- Initialize CCVS for use</DIV
  54256. ><DIV
  54257. CLASS="refsect1"
  54258. ><A
  54259. NAME="AEN10753"
  54260. ></A
  54261. ><H2
  54262. >Description</H2
  54263. >string <B
  54264. CLASS="methodname"
  54265. >ccvs_init</B
  54266. > ( string name)<BR
  54267. ></BR
  54268. ><P
  54269. >      <DIV
  54270. CLASS="warning"
  54271. ><P
  54272. ></P
  54273. ><TABLE
  54274. CLASS="warning"
  54275. BORDER="1"
  54276. WIDTH="100%"
  54277. ><TR
  54278. ><TD
  54279. ALIGN="CENTER"
  54280. ><B
  54281. >Varovßnφ</B
  54282. ></TD
  54283. ></TR
  54284. ><TR
  54285. ><TD
  54286. ALIGN="LEFT"
  54287. ><P
  54288. >Tato funkce je╣t∞ nenφ
  54289. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54290. ></TD
  54291. ></TR
  54292. ></TABLE
  54293. ></DIV
  54294. >
  54295.     </P
  54296. ></DIV
  54297. ><H1
  54298. ><A
  54299. NAME="function.ccvs-lookup"
  54300. ></A
  54301. >ccvs_lookup</H1
  54302. ><DIV
  54303. CLASS="refnamediv"
  54304. ><A
  54305. NAME="AEN10765"
  54306. ></A
  54307. ><P
  54308. >    (4.0.2 - 4.2.3 only)</P
  54309. >ccvs_lookup -- 
  54310.      Look up an item of a particular type in the database #
  54311.     </DIV
  54312. ><DIV
  54313. CLASS="refsect1"
  54314. ><A
  54315. NAME="AEN10768"
  54316. ></A
  54317. ><H2
  54318. >Description</H2
  54319. >string <B
  54320. CLASS="methodname"
  54321. >ccvs_lookup</B
  54322. > ( string session, string invoice, int inum)<BR
  54323. ></BR
  54324. ><P
  54325. >      <DIV
  54326. CLASS="warning"
  54327. ><P
  54328. ></P
  54329. ><TABLE
  54330. CLASS="warning"
  54331. BORDER="1"
  54332. WIDTH="100%"
  54333. ><TR
  54334. ><TD
  54335. ALIGN="CENTER"
  54336. ><B
  54337. >Varovßnφ</B
  54338. ></TD
  54339. ></TR
  54340. ><TR
  54341. ><TD
  54342. ALIGN="LEFT"
  54343. ><P
  54344. >Tato funkce je╣t∞ nenφ
  54345. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54346. ></TD
  54347. ></TR
  54348. ></TABLE
  54349. ></DIV
  54350. >
  54351.     </P
  54352. ></DIV
  54353. ><H1
  54354. ><A
  54355. NAME="function.ccvs-new"
  54356. ></A
  54357. >ccvs_new</H1
  54358. ><DIV
  54359. CLASS="refnamediv"
  54360. ><A
  54361. NAME="AEN10786"
  54362. ></A
  54363. ><P
  54364. >    (4.0.2 - 4.2.3 only)</P
  54365. >ccvs_new -- Create a new, blank transaction </DIV
  54366. ><DIV
  54367. CLASS="refsect1"
  54368. ><A
  54369. NAME="AEN10789"
  54370. ></A
  54371. ><H2
  54372. >Description</H2
  54373. >string <B
  54374. CLASS="methodname"
  54375. >ccvs_new</B
  54376. > ( string session, string invoice)<BR
  54377. ></BR
  54378. ><P
  54379. >      <DIV
  54380. CLASS="warning"
  54381. ><P
  54382. ></P
  54383. ><TABLE
  54384. CLASS="warning"
  54385. BORDER="1"
  54386. WIDTH="100%"
  54387. ><TR
  54388. ><TD
  54389. ALIGN="CENTER"
  54390. ><B
  54391. >Varovßnφ</B
  54392. ></TD
  54393. ></TR
  54394. ><TR
  54395. ><TD
  54396. ALIGN="LEFT"
  54397. ><P
  54398. >Tato funkce je╣t∞ nenφ
  54399. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54400. ></TD
  54401. ></TR
  54402. ></TABLE
  54403. ></DIV
  54404. >
  54405.     </P
  54406. ></DIV
  54407. ><H1
  54408. ><A
  54409. NAME="function.ccvs-report"
  54410. ></A
  54411. >ccvs_report</H1
  54412. ><DIV
  54413. CLASS="refnamediv"
  54414. ><A
  54415. NAME="AEN10804"
  54416. ></A
  54417. ><P
  54418. >    (4.0.2 - 4.2.3 only)</P
  54419. >ccvs_report -- Return the status of the background communication process </DIV
  54420. ><DIV
  54421. CLASS="refsect1"
  54422. ><A
  54423. NAME="AEN10807"
  54424. ></A
  54425. ><H2
  54426. >Description</H2
  54427. >string <B
  54428. CLASS="methodname"
  54429. >ccvs_report</B
  54430. > ( string session, string type)<BR
  54431. ></BR
  54432. ><P
  54433. >      <DIV
  54434. CLASS="warning"
  54435. ><P
  54436. ></P
  54437. ><TABLE
  54438. CLASS="warning"
  54439. BORDER="1"
  54440. WIDTH="100%"
  54441. ><TR
  54442. ><TD
  54443. ALIGN="CENTER"
  54444. ><B
  54445. >Varovßnφ</B
  54446. ></TD
  54447. ></TR
  54448. ><TR
  54449. ><TD
  54450. ALIGN="LEFT"
  54451. ><P
  54452. >Tato funkce je╣t∞ nenφ
  54453. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54454. ></TD
  54455. ></TR
  54456. ></TABLE
  54457. ></DIV
  54458. >
  54459.     </P
  54460. ></DIV
  54461. ><H1
  54462. ><A
  54463. NAME="function.ccvs-return"
  54464. ></A
  54465. >ccvs_return</H1
  54466. ><DIV
  54467. CLASS="refnamediv"
  54468. ><A
  54469. NAME="AEN10822"
  54470. ></A
  54471. ><P
  54472. >    (4.0.2 - 4.2.3 only)</P
  54473. >ccvs_return -- 
  54474.      Transfer funds from the merchant to the credit card holder 
  54475.     </DIV
  54476. ><DIV
  54477. CLASS="refsect1"
  54478. ><A
  54479. NAME="AEN10825"
  54480. ></A
  54481. ><H2
  54482. >Description</H2
  54483. >string <B
  54484. CLASS="methodname"
  54485. >ccvs_return</B
  54486. > ( string session, string invoice)<BR
  54487. ></BR
  54488. ><P
  54489. >      <DIV
  54490. CLASS="warning"
  54491. ><P
  54492. ></P
  54493. ><TABLE
  54494. CLASS="warning"
  54495. BORDER="1"
  54496. WIDTH="100%"
  54497. ><TR
  54498. ><TD
  54499. ALIGN="CENTER"
  54500. ><B
  54501. >Varovßnφ</B
  54502. ></TD
  54503. ></TR
  54504. ><TR
  54505. ><TD
  54506. ALIGN="LEFT"
  54507. ><P
  54508. >Tato funkce je╣t∞ nenφ
  54509. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54510. ></TD
  54511. ></TR
  54512. ></TABLE
  54513. ></DIV
  54514. >
  54515.     </P
  54516. ></DIV
  54517. ><H1
  54518. ><A
  54519. NAME="function.ccvs-reverse"
  54520. ></A
  54521. >ccvs_reverse</H1
  54522. ><DIV
  54523. CLASS="refnamediv"
  54524. ><A
  54525. NAME="AEN10840"
  54526. ></A
  54527. ><P
  54528. >    (4.0.2 - 4.2.3 only)</P
  54529. >ccvs_reverse -- 
  54530.      Perform a full reversal on an already-processed authorization 
  54531.     </DIV
  54532. ><DIV
  54533. CLASS="refsect1"
  54534. ><A
  54535. NAME="AEN10843"
  54536. ></A
  54537. ><H2
  54538. >Description</H2
  54539. >string <B
  54540. CLASS="methodname"
  54541. >ccvs_reverse</B
  54542. > ( string session, string invoice)<BR
  54543. ></BR
  54544. ><P
  54545. >      <DIV
  54546. CLASS="warning"
  54547. ><P
  54548. ></P
  54549. ><TABLE
  54550. CLASS="warning"
  54551. BORDER="1"
  54552. WIDTH="100%"
  54553. ><TR
  54554. ><TD
  54555. ALIGN="CENTER"
  54556. ><B
  54557. >Varovßnφ</B
  54558. ></TD
  54559. ></TR
  54560. ><TR
  54561. ><TD
  54562. ALIGN="LEFT"
  54563. ><P
  54564. >Tato funkce je╣t∞ nenφ
  54565. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54566. ></TD
  54567. ></TR
  54568. ></TABLE
  54569. ></DIV
  54570. >
  54571.     </P
  54572. ></DIV
  54573. ><H1
  54574. ><A
  54575. NAME="function.ccvs-sale"
  54576. ></A
  54577. >ccvs_sale</H1
  54578. ><DIV
  54579. CLASS="refnamediv"
  54580. ><A
  54581. NAME="AEN10858"
  54582. ></A
  54583. ><P
  54584. >    (4.0.2 - 4.2.3 only)</P
  54585. >ccvs_sale -- 
  54586.      Transfer funds from the credit card holder to the merchant
  54587.     </DIV
  54588. ><DIV
  54589. CLASS="refsect1"
  54590. ><A
  54591. NAME="AEN10861"
  54592. ></A
  54593. ><H2
  54594. >Description</H2
  54595. >string <B
  54596. CLASS="methodname"
  54597. >ccvs_sale</B
  54598. > ( string session, string invoice)<BR
  54599. ></BR
  54600. ><P
  54601. >      <DIV
  54602. CLASS="warning"
  54603. ><P
  54604. ></P
  54605. ><TABLE
  54606. CLASS="warning"
  54607. BORDER="1"
  54608. WIDTH="100%"
  54609. ><TR
  54610. ><TD
  54611. ALIGN="CENTER"
  54612. ><B
  54613. >Varovßnφ</B
  54614. ></TD
  54615. ></TR
  54616. ><TR
  54617. ><TD
  54618. ALIGN="LEFT"
  54619. ><P
  54620. >Tato funkce je╣t∞ nenφ
  54621. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54622. ></TD
  54623. ></TR
  54624. ></TABLE
  54625. ></DIV
  54626. >
  54627.     </P
  54628. ></DIV
  54629. ><H1
  54630. ><A
  54631. NAME="function.ccvs-status"
  54632. ></A
  54633. >ccvs_status</H1
  54634. ><DIV
  54635. CLASS="refnamediv"
  54636. ><A
  54637. NAME="AEN10876"
  54638. ></A
  54639. ><P
  54640. >    (4.0.2 - 4.2.3 only)</P
  54641. >ccvs_status -- Check the status of an invoice</DIV
  54642. ><DIV
  54643. CLASS="refsect1"
  54644. ><A
  54645. NAME="AEN10879"
  54646. ></A
  54647. ><H2
  54648. >Description</H2
  54649. >string <B
  54650. CLASS="methodname"
  54651. >ccvs_status</B
  54652. > ( string session, string invoice)<BR
  54653. ></BR
  54654. ><P
  54655. >      <DIV
  54656. CLASS="warning"
  54657. ><P
  54658. ></P
  54659. ><TABLE
  54660. CLASS="warning"
  54661. BORDER="1"
  54662. WIDTH="100%"
  54663. ><TR
  54664. ><TD
  54665. ALIGN="CENTER"
  54666. ><B
  54667. >Varovßnφ</B
  54668. ></TD
  54669. ></TR
  54670. ><TR
  54671. ><TD
  54672. ALIGN="LEFT"
  54673. ><P
  54674. >Tato funkce je╣t∞ nenφ
  54675. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54676. ></TD
  54677. ></TR
  54678. ></TABLE
  54679. ></DIV
  54680. >
  54681.     </P
  54682. ></DIV
  54683. ><H1
  54684. ><A
  54685. NAME="function.ccvs-textvalue"
  54686. ></A
  54687. >ccvs_textvalue</H1
  54688. ><DIV
  54689. CLASS="refnamediv"
  54690. ><A
  54691. NAME="AEN10894"
  54692. ></A
  54693. ><P
  54694. >    (4.0.2 - 4.2.3 only)</P
  54695. >ccvs_textvalue -- Get text return value for previous function call</DIV
  54696. ><DIV
  54697. CLASS="refsect1"
  54698. ><A
  54699. NAME="AEN10897"
  54700. ></A
  54701. ><H2
  54702. >Description</H2
  54703. >string <B
  54704. CLASS="methodname"
  54705. >ccvs_textvalue</B
  54706. > ( string session)<BR
  54707. ></BR
  54708. ><P
  54709. >      <DIV
  54710. CLASS="warning"
  54711. ><P
  54712. ></P
  54713. ><TABLE
  54714. CLASS="warning"
  54715. BORDER="1"
  54716. WIDTH="100%"
  54717. ><TR
  54718. ><TD
  54719. ALIGN="CENTER"
  54720. ><B
  54721. >Varovßnφ</B
  54722. ></TD
  54723. ></TR
  54724. ><TR
  54725. ><TD
  54726. ALIGN="LEFT"
  54727. ><P
  54728. >Tato funkce je╣t∞ nenφ
  54729. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54730. ></TD
  54731. ></TR
  54732. ></TABLE
  54733. ></DIV
  54734. >
  54735.     </P
  54736. ></DIV
  54737. ><H1
  54738. ><A
  54739. NAME="function.ccvs-void"
  54740. ></A
  54741. >ccvs_void</H1
  54742. ><DIV
  54743. CLASS="refnamediv"
  54744. ><A
  54745. NAME="AEN10909"
  54746. ></A
  54747. ><P
  54748. >    (4.0.2 - 4.2.3 only)</P
  54749. >ccvs_void -- 
  54750.      Perform a full reversal on a completed transaction 
  54751.     </DIV
  54752. ><DIV
  54753. CLASS="refsect1"
  54754. ><A
  54755. NAME="AEN10912"
  54756. ></A
  54757. ><H2
  54758. >Description</H2
  54759. >string <B
  54760. CLASS="methodname"
  54761. >ccvs_void</B
  54762. > ( string session, string invoice)<BR
  54763. ></BR
  54764. ><P
  54765. >      <DIV
  54766. CLASS="warning"
  54767. ><P
  54768. ></P
  54769. ><TABLE
  54770. CLASS="warning"
  54771. BORDER="1"
  54772. WIDTH="100%"
  54773. ><TR
  54774. ><TD
  54775. ALIGN="CENTER"
  54776. ><B
  54777. >Varovßnφ</B
  54778. ></TD
  54779. ></TR
  54780. ><TR
  54781. ><TD
  54782. ALIGN="LEFT"
  54783. ><P
  54784. >Tato funkce je╣t∞ nenφ
  54785. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  54786. ></TD
  54787. ></TR
  54788. ></TABLE
  54789. ></DIV
  54790. >
  54791.     </P
  54792. ></DIV
  54793. ></DIV
  54794. ><DIV
  54795. CLASS="reference"
  54796. ><A
  54797. NAME="ref.com"
  54798. ></A
  54799. ><DIV
  54800. CLASS="TITLEPAGE"
  54801. ><H1
  54802. CLASS="title"
  54803. >VIII. Funkce na podporu COM ve Windows</H1
  54804. ><DIV
  54805. CLASS="PARTINTRO"
  54806. ><A
  54807. NAME="AEN10929"
  54808. ></A
  54809. ><DIV
  54810. CLASS="section"
  54811. ><H1
  54812. CLASS="section"
  54813. ><A
  54814. NAME="com.intro"
  54815. ></A
  54816. >┌vod</H1
  54817. ><P
  54818. >      COM je technologie, kterß umo╛≥uje znovupou╛φt k≤d napsan² v jakΘmkoliv
  54819.      jazyce za pou╛itφ standardnφho volßnφ a schovßnφm
  54820.      implementaΦnφch detail∙ - jako na kterΘm poΦφtaΦi je komponenta
  54821.      ulo╛ena a kter² spustiteln² soubor ji uchovßvß - za API. Lze si to p°edstavit jako roz╣φ°en²
  54822.      mechanismus vzdßlenΘho volßnφ procedur (RPC) se zßklady objekt∙. COM
  54823.      odd∞luje implementaci od rozhranφ.
  54824.     </P
  54825. ><P
  54826. >      COM podporuje verzovßnφ, odd∞lenφ implementace od
  54827.      rozhranφ a skrytφ implementaΦnφch detail∙ jako je umφst∞nφ spustitelnΘho souboru a
  54828.      jazyku, kter² byl pou╛it.
  54829.     </P
  54830. ></DIV
  54831. ><DIV
  54832. CLASS="section"
  54833. ><HR><H1
  54834. CLASS="section"
  54835. ><A
  54836. NAME="com.requirements"
  54837. ></A
  54838. >Po╛adavky</H1
  54839. ><P
  54840. >      Tyto funkce jsou dostupnΘ pouze ve Windows verzi PHP.
  54841.     </P
  54842. ></DIV
  54843. ><DIV
  54844. CLASS="section"
  54845. ><HR><H1
  54846. CLASS="section"
  54847. ><A
  54848. NAME="com.installation"
  54849. ></A
  54850. >Instalace</H1
  54851. ><P
  54852. >K pou╛φvßnφ t∞chto funkcφ nenφ t°eba ╛ßdnß
  54853. instalace, jsou souΦßstφ jßdra PHP.</P
  54854. ><P
  54855. >Verze <TT
  54856. CLASS="literal"
  54857. >PHP</TT
  54858. > pro Windows
  54859. mß vestav∞nou podporu pro toto roz╣φ°enφ. K pou╛itφ t∞chto funkcφ nenφ t°eba
  54860. naΦφtat ╛ßdnß dal╣φ roz╣φ°enφ.</P
  54861. ></DIV
  54862. ><DIV
  54863. CLASS="section"
  54864. ><HR><H1
  54865. CLASS="section"
  54866. ><A
  54867. NAME="com.configuration"
  54868. ></A
  54869. >Konfigurace b∞hu</H1
  54870. ><P
  54871. > Chovßnφ t∞chto funkcφ je ovlivn∞no nastavenφm parametr∙ v <TT
  54872. CLASS="filename"
  54873. >php.ini</TT
  54874. >.
  54875. </P
  54876. ><P
  54877. >  <DIV
  54878. CLASS="table"
  54879. ><A
  54880. NAME="AEN10947"
  54881. ></A
  54882. ><P
  54883. ><B
  54884. >Tabulka 1. Com configuration options</B
  54885. ></P
  54886. ><TABLE
  54887. BORDER="1"
  54888. CLASS="CALSTABLE"
  54889. ><THEAD
  54890. ><TR
  54891. ><TH
  54892. ALIGN="LEFT"
  54893. VALIGN="MIDDLE"
  54894. >Name</TH
  54895. ><TH
  54896. ALIGN="LEFT"
  54897. VALIGN="MIDDLE"
  54898. >Default</TH
  54899. ><TH
  54900. ALIGN="LEFT"
  54901. VALIGN="MIDDLE"
  54902. >Changeable</TH
  54903. ></TR
  54904. ></THEAD
  54905. ><TBODY
  54906. ><TR
  54907. ><TD
  54908. ALIGN="LEFT"
  54909. VALIGN="MIDDLE"
  54910. >com.allow_dcom</TD
  54911. ><TD
  54912. ALIGN="LEFT"
  54913. VALIGN="MIDDLE"
  54914. >"0"</TD
  54915. ><TD
  54916. ALIGN="LEFT"
  54917. VALIGN="MIDDLE"
  54918. >PHP_INI_SYSTEM</TD
  54919. ></TR
  54920. ><TR
  54921. ><TD
  54922. ALIGN="LEFT"
  54923. VALIGN="MIDDLE"
  54924. >com.autoregister_typelib</TD
  54925. ><TD
  54926. ALIGN="LEFT"
  54927. VALIGN="MIDDLE"
  54928. >"0"</TD
  54929. ><TD
  54930. ALIGN="LEFT"
  54931. VALIGN="MIDDLE"
  54932. >PHP_INI_SYSTEM</TD
  54933. ></TR
  54934. ><TR
  54935. ><TD
  54936. ALIGN="LEFT"
  54937. VALIGN="MIDDLE"
  54938. >com.autoregister_verbose</TD
  54939. ><TD
  54940. ALIGN="LEFT"
  54941. VALIGN="MIDDLE"
  54942. >"0"</TD
  54943. ><TD
  54944. ALIGN="LEFT"
  54945. VALIGN="MIDDLE"
  54946. >PHP_INI_SYSTEM</TD
  54947. ></TR
  54948. ><TR
  54949. ><TD
  54950. ALIGN="LEFT"
  54951. VALIGN="MIDDLE"
  54952. >com.autoregister_casesensitive</TD
  54953. ><TD
  54954. ALIGN="LEFT"
  54955. VALIGN="MIDDLE"
  54956. >"1"</TD
  54957. ><TD
  54958. ALIGN="LEFT"
  54959. VALIGN="MIDDLE"
  54960. >PHP_INI_SYSTEM</TD
  54961. ></TR
  54962. ><TR
  54963. ><TD
  54964. ALIGN="LEFT"
  54965. VALIGN="MIDDLE"
  54966. >com.typelib_file</TD
  54967. ><TD
  54968. ALIGN="LEFT"
  54969. VALIGN="MIDDLE"
  54970. >""</TD
  54971. ><TD
  54972. ALIGN="LEFT"
  54973. VALIGN="MIDDLE"
  54974. >PHP_INI_SYSTEM</TD
  54975. ></TR
  54976. ></TBODY
  54977. ></TABLE
  54978. ></DIV
  54979. >
  54980.  For further details and definition of the PHP_INI_* constants see
  54981.  <A
  54982. HREF="#function.ini-set"
  54983. ><B
  54984. CLASS="function"
  54985. >ini_set()</B
  54986. ></A
  54987. >.
  54988.  </P
  54989. ></DIV
  54990. ><DIV
  54991. CLASS="section"
  54992. ><HR><H1
  54993. CLASS="section"
  54994. ><A
  54995. NAME="com.constants"
  54996. ></A
  54997. >P°eddefinovanΘ konstanty</H1
  54998. ><P
  54999. > Tyto konstanty jsou definovßny tφmto roz╣φ°enφm a budou k dispozici pouze
  55000. tehdy, bylo-li roz╣φ°enφ zkompilovßno spoleΦn∞ s PHP nebo dynamicky zavedeno
  55001. za b∞hu.
  55002. </P
  55003. ><P
  55004. ></P
  55005. ><DIV
  55006. CLASS="variablelist"
  55007. ><DL
  55008. ><DT
  55009. ><TT
  55010. CLASS="constant"
  55011. ><B
  55012. >CLSCTX_INPROC_SERVER</B
  55013. ></TT
  55014.     (<A
  55015. HREF="#language.types.integer"
  55016. ><B
  55017. CLASS="type"
  55018. >integer</B
  55019. ></A
  55020. >)</DT
  55021. ><DD
  55022. ><P
  55023. >      
  55024.     </P
  55025. ></DD
  55026. ><DT
  55027. ><TT
  55028. CLASS="constant"
  55029. ><B
  55030. >CLSCTX_INPROC_HANDLER</B
  55031. ></TT
  55032.     (<A
  55033. HREF="#language.types.integer"
  55034. ><B
  55035. CLASS="type"
  55036. >integer</B
  55037. ></A
  55038. >)</DT
  55039. ><DD
  55040. ><P
  55041. >      
  55042.     </P
  55043. ></DD
  55044. ><DT
  55045. ><TT
  55046. CLASS="constant"
  55047. ><B
  55048. >CLSCTX_LOCAL_SERVER</B
  55049. ></TT
  55050.     (<A
  55051. HREF="#language.types.integer"
  55052. ><B
  55053. CLASS="type"
  55054. >integer</B
  55055. ></A
  55056. >)</DT
  55057. ><DD
  55058. ><P
  55059. >      
  55060.     </P
  55061. ></DD
  55062. ><DT
  55063. ><TT
  55064. CLASS="constant"
  55065. ><B
  55066. >CLSCTX_REMOTE_SERVER</B
  55067. ></TT
  55068.     (<A
  55069. HREF="#language.types.integer"
  55070. ><B
  55071. CLASS="type"
  55072. >integer</B
  55073. ></A
  55074. >)</DT
  55075. ><DD
  55076. ><P
  55077. >      
  55078.     </P
  55079. ></DD
  55080. ><DT
  55081. ><TT
  55082. CLASS="constant"
  55083. ><B
  55084. >CLSCTX_SERVER</B
  55085. ></TT
  55086.     (<A
  55087. HREF="#language.types.integer"
  55088. ><B
  55089. CLASS="type"
  55090. >integer</B
  55091. ></A
  55092. >)</DT
  55093. ><DD
  55094. ><P
  55095. >      
  55096.     </P
  55097. ></DD
  55098. ><DT
  55099. ><TT
  55100. CLASS="constant"
  55101. ><B
  55102. >CLSCTX_ALL</B
  55103. ></TT
  55104.     (<A
  55105. HREF="#language.types.integer"
  55106. ><B
  55107. CLASS="type"
  55108. >integer</B
  55109. ></A
  55110. >)</DT
  55111. ><DD
  55112. ><P
  55113. >      
  55114.     </P
  55115. ></DD
  55116. ><DT
  55117. ><TT
  55118. CLASS="constant"
  55119. ><B
  55120. >VT_NULL</B
  55121. ></TT
  55122.     (<A
  55123. HREF="#language.types.integer"
  55124. ><B
  55125. CLASS="type"
  55126. >integer</B
  55127. ></A
  55128. >)</DT
  55129. ><DD
  55130. ><P
  55131. >      
  55132.     </P
  55133. ></DD
  55134. ><DT
  55135. ><TT
  55136. CLASS="constant"
  55137. ><B
  55138. >VT_EMPTY</B
  55139. ></TT
  55140.     (<A
  55141. HREF="#language.types.integer"
  55142. ><B
  55143. CLASS="type"
  55144. >integer</B
  55145. ></A
  55146. >)</DT
  55147. ><DD
  55148. ><P
  55149. >      
  55150.     </P
  55151. ></DD
  55152. ><DT
  55153. ><TT
  55154. CLASS="constant"
  55155. ><B
  55156. >VT_UI1</B
  55157. ></TT
  55158.     (<A
  55159. HREF="#language.types.integer"
  55160. ><B
  55161. CLASS="type"
  55162. >integer</B
  55163. ></A
  55164. >)</DT
  55165. ><DD
  55166. ><P
  55167. >      
  55168.     </P
  55169. ></DD
  55170. ><DT
  55171. ><TT
  55172. CLASS="constant"
  55173. ><B
  55174. >VT_I2</B
  55175. ></TT
  55176.     (<A
  55177. HREF="#language.types.integer"
  55178. ><B
  55179. CLASS="type"
  55180. >integer</B
  55181. ></A
  55182. >)</DT
  55183. ><DD
  55184. ><P
  55185. >      
  55186.     </P
  55187. ></DD
  55188. ><DT
  55189. ><TT
  55190. CLASS="constant"
  55191. ><B
  55192. >VT_I4</B
  55193. ></TT
  55194.     (<A
  55195. HREF="#language.types.integer"
  55196. ><B
  55197. CLASS="type"
  55198. >integer</B
  55199. ></A
  55200. >)</DT
  55201. ><DD
  55202. ><P
  55203. >      
  55204.     </P
  55205. ></DD
  55206. ><DT
  55207. ><TT
  55208. CLASS="constant"
  55209. ><B
  55210. >VT_R4</B
  55211. ></TT
  55212.     (<A
  55213. HREF="#language.types.integer"
  55214. ><B
  55215. CLASS="type"
  55216. >integer</B
  55217. ></A
  55218. >)</DT
  55219. ><DD
  55220. ><P
  55221. >      
  55222.     </P
  55223. ></DD
  55224. ><DT
  55225. ><TT
  55226. CLASS="constant"
  55227. ><B
  55228. >VT_R8</B
  55229. ></TT
  55230.     (<A
  55231. HREF="#language.types.integer"
  55232. ><B
  55233. CLASS="type"
  55234. >integer</B
  55235. ></A
  55236. >)</DT
  55237. ><DD
  55238. ><P
  55239. >      
  55240.     </P
  55241. ></DD
  55242. ><DT
  55243. ><TT
  55244. CLASS="constant"
  55245. ><B
  55246. >VT_BOOL</B
  55247. ></TT
  55248.     (<A
  55249. HREF="#language.types.integer"
  55250. ><B
  55251. CLASS="type"
  55252. >integer</B
  55253. ></A
  55254. >)</DT
  55255. ><DD
  55256. ><P
  55257. >      
  55258.     </P
  55259. ></DD
  55260. ><DT
  55261. ><TT
  55262. CLASS="constant"
  55263. ><B
  55264. >VT_ERROR</B
  55265. ></TT
  55266.     (<A
  55267. HREF="#language.types.integer"
  55268. ><B
  55269. CLASS="type"
  55270. >integer</B
  55271. ></A
  55272. >)</DT
  55273. ><DD
  55274. ><P
  55275. >      
  55276.     </P
  55277. ></DD
  55278. ><DT
  55279. ><TT
  55280. CLASS="constant"
  55281. ><B
  55282. >VT_CY</B
  55283. ></TT
  55284.     (<A
  55285. HREF="#language.types.integer"
  55286. ><B
  55287. CLASS="type"
  55288. >integer</B
  55289. ></A
  55290. >)</DT
  55291. ><DD
  55292. ><P
  55293. >      
  55294.     </P
  55295. ></DD
  55296. ><DT
  55297. ><TT
  55298. CLASS="constant"
  55299. ><B
  55300. >VT_DATE</B
  55301. ></TT
  55302.     (<A
  55303. HREF="#language.types.integer"
  55304. ><B
  55305. CLASS="type"
  55306. >integer</B
  55307. ></A
  55308. >)</DT
  55309. ><DD
  55310. ><P
  55311. >      
  55312.     </P
  55313. ></DD
  55314. ><DT
  55315. ><TT
  55316. CLASS="constant"
  55317. ><B
  55318. >VT_BSTR</B
  55319. ></TT
  55320.     (<A
  55321. HREF="#language.types.integer"
  55322. ><B
  55323. CLASS="type"
  55324. >integer</B
  55325. ></A
  55326. >)</DT
  55327. ><DD
  55328. ><P
  55329. >      
  55330.     </P
  55331. ></DD
  55332. ><DT
  55333. ><TT
  55334. CLASS="constant"
  55335. ><B
  55336. >VT_DECIMAL</B
  55337. ></TT
  55338.     (<A
  55339. HREF="#language.types.integer"
  55340. ><B
  55341. CLASS="type"
  55342. >integer</B
  55343. ></A
  55344. >)</DT
  55345. ><DD
  55346. ><P
  55347. >      
  55348.     </P
  55349. ></DD
  55350. ><DT
  55351. ><TT
  55352. CLASS="constant"
  55353. ><B
  55354. >VT_UNKNOWN</B
  55355. ></TT
  55356.     (<A
  55357. HREF="#language.types.integer"
  55358. ><B
  55359. CLASS="type"
  55360. >integer</B
  55361. ></A
  55362. >)</DT
  55363. ><DD
  55364. ><P
  55365. >      
  55366.     </P
  55367. ></DD
  55368. ><DT
  55369. ><TT
  55370. CLASS="constant"
  55371. ><B
  55372. >VT_DISPATCH</B
  55373. ></TT
  55374.     (<A
  55375. HREF="#language.types.integer"
  55376. ><B
  55377. CLASS="type"
  55378. >integer</B
  55379. ></A
  55380. >)</DT
  55381. ><DD
  55382. ><P
  55383. >      
  55384.     </P
  55385. ></DD
  55386. ><DT
  55387. ><TT
  55388. CLASS="constant"
  55389. ><B
  55390. >VT_VARIANT</B
  55391. ></TT
  55392.     (<A
  55393. HREF="#language.types.integer"
  55394. ><B
  55395. CLASS="type"
  55396. >integer</B
  55397. ></A
  55398. >)</DT
  55399. ><DD
  55400. ><P
  55401. >      
  55402.     </P
  55403. ></DD
  55404. ><DT
  55405. ><TT
  55406. CLASS="constant"
  55407. ><B
  55408. >VT_I1</B
  55409. ></TT
  55410.     (<A
  55411. HREF="#language.types.integer"
  55412. ><B
  55413. CLASS="type"
  55414. >integer</B
  55415. ></A
  55416. >)</DT
  55417. ><DD
  55418. ><P
  55419. >      
  55420.     </P
  55421. ></DD
  55422. ><DT
  55423. ><TT
  55424. CLASS="constant"
  55425. ><B
  55426. >VT_UI2</B
  55427. ></TT
  55428.     (<A
  55429. HREF="#language.types.integer"
  55430. ><B
  55431. CLASS="type"
  55432. >integer</B
  55433. ></A
  55434. >)</DT
  55435. ><DD
  55436. ><P
  55437. >      
  55438.     </P
  55439. ></DD
  55440. ><DT
  55441. ><TT
  55442. CLASS="constant"
  55443. ><B
  55444. >VT_UI4</B
  55445. ></TT
  55446.     (<A
  55447. HREF="#language.types.integer"
  55448. ><B
  55449. CLASS="type"
  55450. >integer</B
  55451. ></A
  55452. >)</DT
  55453. ><DD
  55454. ><P
  55455. >      
  55456.     </P
  55457. ></DD
  55458. ><DT
  55459. ><TT
  55460. CLASS="constant"
  55461. ><B
  55462. >VT_INT</B
  55463. ></TT
  55464.     (<A
  55465. HREF="#language.types.integer"
  55466. ><B
  55467. CLASS="type"
  55468. >integer</B
  55469. ></A
  55470. >)</DT
  55471. ><DD
  55472. ><P
  55473. >      
  55474.     </P
  55475. ></DD
  55476. ><DT
  55477. ><TT
  55478. CLASS="constant"
  55479. ><B
  55480. >VT_UINT</B
  55481. ></TT
  55482.     (<A
  55483. HREF="#language.types.integer"
  55484. ><B
  55485. CLASS="type"
  55486. >integer</B
  55487. ></A
  55488. >)</DT
  55489. ><DD
  55490. ><P
  55491. >      
  55492.     </P
  55493. ></DD
  55494. ><DT
  55495. ><TT
  55496. CLASS="constant"
  55497. ><B
  55498. >VT_ARRAY</B
  55499. ></TT
  55500.     (<A
  55501. HREF="#language.types.integer"
  55502. ><B
  55503. CLASS="type"
  55504. >integer</B
  55505. ></A
  55506. >)</DT
  55507. ><DD
  55508. ><P
  55509. >      
  55510.     </P
  55511. ></DD
  55512. ><DT
  55513. ><TT
  55514. CLASS="constant"
  55515. ><B
  55516. >VT_BYREF</B
  55517. ></TT
  55518.     (<A
  55519. HREF="#language.types.integer"
  55520. ><B
  55521. CLASS="type"
  55522. >integer</B
  55523. ></A
  55524. >)</DT
  55525. ><DD
  55526. ><P
  55527. >      
  55528.     </P
  55529. ></DD
  55530. ><DT
  55531. ><TT
  55532. CLASS="constant"
  55533. ><B
  55534. >CP_ACP</B
  55535. ></TT
  55536.     (<A
  55537. HREF="#language.types.integer"
  55538. ><B
  55539. CLASS="type"
  55540. >integer</B
  55541. ></A
  55542. >)</DT
  55543. ><DD
  55544. ><P
  55545. >      
  55546.     </P
  55547. ></DD
  55548. ><DT
  55549. ><TT
  55550. CLASS="constant"
  55551. ><B
  55552. >CP_MACCP</B
  55553. ></TT
  55554.     (<A
  55555. HREF="#language.types.integer"
  55556. ><B
  55557. CLASS="type"
  55558. >integer</B
  55559. ></A
  55560. >)</DT
  55561. ><DD
  55562. ><P
  55563. >      
  55564.     </P
  55565. ></DD
  55566. ><DT
  55567. ><TT
  55568. CLASS="constant"
  55569. ><B
  55570. >CP_OEMCP</B
  55571. ></TT
  55572.     (<A
  55573. HREF="#language.types.integer"
  55574. ><B
  55575. CLASS="type"
  55576. >integer</B
  55577. ></A
  55578. >)</DT
  55579. ><DD
  55580. ><P
  55581. >      
  55582.     </P
  55583. ></DD
  55584. ><DT
  55585. ><TT
  55586. CLASS="constant"
  55587. ><B
  55588. >CP_UTF7</B
  55589. ></TT
  55590.     (<A
  55591. HREF="#language.types.integer"
  55592. ><B
  55593. CLASS="type"
  55594. >integer</B
  55595. ></A
  55596. >)</DT
  55597. ><DD
  55598. ><P
  55599. >      
  55600.     </P
  55601. ></DD
  55602. ><DT
  55603. ><TT
  55604. CLASS="constant"
  55605. ><B
  55606. >CP_UTF8</B
  55607. ></TT
  55608.     (<A
  55609. HREF="#language.types.integer"
  55610. ><B
  55611. CLASS="type"
  55612. >integer</B
  55613. ></A
  55614. >)</DT
  55615. ><DD
  55616. ><P
  55617. >      
  55618.     </P
  55619. ></DD
  55620. ><DT
  55621. ><TT
  55622. CLASS="constant"
  55623. ><B
  55624. >CP_SYMBOL</B
  55625. ></TT
  55626.     (<A
  55627. HREF="#language.types.integer"
  55628. ><B
  55629. CLASS="type"
  55630. >integer</B
  55631. ></A
  55632. >)</DT
  55633. ><DD
  55634. ><P
  55635. >      
  55636.     </P
  55637. ></DD
  55638. ><DT
  55639. ><TT
  55640. CLASS="constant"
  55641. ><B
  55642. >CP_THREAD_ACP</B
  55643. ></TT
  55644.     (<A
  55645. HREF="#language.types.integer"
  55646. ><B
  55647. CLASS="type"
  55648. >integer</B
  55649. ></A
  55650. >)</DT
  55651. ><DD
  55652. ><P
  55653. >      
  55654.     </P
  55655. ></DD
  55656. ></DL
  55657. ></DIV
  55658. ></DIV
  55659. ><DIV
  55660. CLASS="section"
  55661. ><HR><H1
  55662. CLASS="section"
  55663. ><A
  55664. NAME="com.seealso"
  55665. ></A
  55666. >Viz takΘ</H1
  55667. ><P
  55668. >      Vφce informacφ o COM naleznete ve <A
  55669. HREF="http://www.microsoft.com/Com/resources/comdocs.asp"
  55670. TARGET="_top"
  55671. >specifikaci
  55672.      COM</A
  55673. > nebo se t°eba podφvejte na <A
  55674. HREF="http://www.develop.com/essentialcom/sources/YACL.htm"
  55675. TARGET="_top"
  55676. >Yet
  55677.      Another COM Library (YACL)</A
  55678. > Dona Boxe.
  55679.     </P
  55680. ></DIV
  55681. ></DIV
  55682. ><DIV
  55683. CLASS="TOC"
  55684. ><DL
  55685. ><DT
  55686. ><B
  55687. >Obsah</B
  55688. ></DT
  55689. ><DT
  55690. ><A
  55691. HREF="#class.com"
  55692. >COM</A
  55693. > -- COM class</DT
  55694. ><DT
  55695. ><A
  55696. HREF="#class.variant"
  55697. >VARIANT</A
  55698. > -- VARIANT class</DT
  55699. ><DT
  55700. ><A
  55701. HREF="#function.com-addref"
  55702. >com_addref</A
  55703. > -- 
  55704.     Increases the components reference counter.
  55705.    </DT
  55706. ><DT
  55707. ><A
  55708. HREF="#function.com-get"
  55709. >com_get</A
  55710. > -- 
  55711.      Zφskßvß hodnotu vlastnosti COM komponenty
  55712.     </DT
  55713. ><DT
  55714. ><A
  55715. HREF="#function.com-invoke"
  55716. >com_invoke</A
  55717. > -- 
  55718.      Volß metodu COM komponenty.
  55719.     </DT
  55720. ><DT
  55721. ><A
  55722. HREF="#function.com-isenum"
  55723. >com_isenum</A
  55724. > -- Grabs an IEnumVariant</DT
  55725. ><DT
  55726. ><A
  55727. HREF="#function.com-load-typelib"
  55728. >com_load_typelib</A
  55729. > -- Loads a Typelib</DT
  55730. ><DT
  55731. ><A
  55732. HREF="#function.com-load"
  55733. >com_load</A
  55734. > -- 
  55735.      Vytvo°φ nov² odkaz na COM komponentu
  55736.     </DT
  55737. ><DT
  55738. ><A
  55739. HREF="#function.com-propget"
  55740. >com_propget</A
  55741. > -- 
  55742.      Zφskßvß hodnotu vlastnosti COM komponenty
  55743.     </DT
  55744. ><DT
  55745. ><A
  55746. HREF="#function.com-propput"
  55747. >com_propput</A
  55748. > -- 
  55749.      P°i°azuje hodnotu vlastnosti COM komponenty.
  55750.     </DT
  55751. ><DT
  55752. ><A
  55753. HREF="#function.com-propset"
  55754. >com_propset</A
  55755. > -- 
  55756.      P°i°azuje hodnotu vlastnosti COM komponenty.
  55757.     </DT
  55758. ><DT
  55759. ><A
  55760. HREF="#function.com-release"
  55761. >com_release</A
  55762. > -- 
  55763.     Decreases the components reference counter.
  55764.    </DT
  55765. ><DT
  55766. ><A
  55767. HREF="#function.com-set"
  55768. >com_set</A
  55769. > -- 
  55770.      P°i°azuje hodnotu vlastnosti COM komponenty.
  55771.     </DT
  55772. ></DL
  55773. ></DIV
  55774. ></DIV
  55775. ><H1
  55776. ><A
  55777. NAME="class.com"
  55778. ></A
  55779. >COM</H1
  55780. ><DIV
  55781. CLASS="refnamediv"
  55782. ><A
  55783. NAME="AEN11203"
  55784. ></A
  55785. ><P
  55786. >    (no version information, might be only in CVS)</P
  55787. >COM -- COM class</DIV
  55788. ><DIV
  55789. CLASS="refsynopsisdiv"
  55790. ><A
  55791. NAME="AEN11206"
  55792. ></A
  55793. ><H2
  55794. >P°ehled</H2
  55795. ><TABLE
  55796. BORDER="0"
  55797. BGCOLOR="#E0E0E0"
  55798. CELLPADDING="5"
  55799. ><TR
  55800. ><TD
  55801. ><PRE
  55802. CLASS="synopsis"
  55803. >$obj = new COM("server.object")</PRE
  55804. ></TD
  55805. ></TR
  55806. ></TABLE
  55807. ></DIV
  55808. ><DIV
  55809. CLASS="refsect1"
  55810. ><A
  55811. NAME="class.com.class"
  55812. ></A
  55813. ><H2
  55814. >Description</H2
  55815. ><P
  55816. >     The COM class provides a framework to integrate (D)COM components into
  55817.     your PHP scripts.
  55818.    </P
  55819. ></DIV
  55820. ><DIV
  55821. CLASS="refsect1"
  55822. ><A
  55823. NAME="class.com.constructor"
  55824. ></A
  55825. ><H2
  55826. >Methods</H2
  55827. >string <B
  55828. CLASS="methodname"
  55829. >COM::COM</B
  55830. > ( string module_name [, string server_name [, int codepage]])<BR
  55831. ></BR
  55832. ><P
  55833. >     COM class constructor. Parameters:
  55834.     <P
  55835. ></P
  55836. ><DIV
  55837. CLASS="variablelist"
  55838. ><DL
  55839. ><DT
  55840. >module_name</DT
  55841. ><DD
  55842. ><P
  55843. >       name or class-id of the requested component.
  55844.      </P
  55845. ></DD
  55846. ><DT
  55847. >server_name</DT
  55848. ><DD
  55849. ><P
  55850. >       name of the DCOM server from which the component should be fetched.
  55851.       If <TT
  55852. CLASS="constant"
  55853. ><B
  55854. >NULL</B
  55855. ></TT
  55856. >, <TT
  55857. CLASS="literal"
  55858. >localhost</TT
  55859. > is assumed.
  55860.       To allow DCOM <TT
  55861. CLASS="constant"
  55862. ><B
  55863. >com.allow_dcom</B
  55864. ></TT
  55865. > has to be set to 
  55866.       <TT
  55867. CLASS="constant"
  55868. ><B
  55869. >TRUE</B
  55870. ></TT
  55871. > in <TT
  55872. CLASS="filename"
  55873. >php.ini</TT
  55874. >.
  55875.      </P
  55876. ></DD
  55877. ><DT
  55878. >codepage</DT
  55879. ><DD
  55880. ><P
  55881. >       specifies the codepage that is used to convert php-strings to
  55882.       unicode-strings and vice versa. Possible values are
  55883.       <TT
  55884. CLASS="constant"
  55885. ><B
  55886. >CP_ACP</B
  55887. ></TT
  55888. >, <TT
  55889. CLASS="constant"
  55890. ><B
  55891. >CP_MACCP</B
  55892. ></TT
  55893. >,
  55894.       <TT
  55895. CLASS="constant"
  55896. ><B
  55897. >CP_OEMCP</B
  55898. ></TT
  55899. >, <TT
  55900. CLASS="constant"
  55901. ><B
  55902. >CP_SYMBOL</B
  55903. ></TT
  55904. >,
  55905.       <TT
  55906. CLASS="constant"
  55907. ><B
  55908. >CP_THREAD_ACP</B
  55909. ></TT
  55910. >, <TT
  55911. CLASS="constant"
  55912. ><B
  55913. >CP_UTF7</B
  55914. ></TT
  55915. >
  55916.       and <TT
  55917. CLASS="constant"
  55918. ><B
  55919. >CP_UTF8</B
  55920. ></TT
  55921. >.
  55922.      </P
  55923. ></DD
  55924. ></DL
  55925. ></DIV
  55926. >
  55927.    </P
  55928. ><P
  55929. >     <TABLE
  55930. WIDTH="100%"
  55931. BORDER="0"
  55932. CELLPADDING="0"
  55933. CELLSPACING="0"
  55934. CLASS="EXAMPLE"
  55935. ><TR
  55936. ><TD
  55937. ><DIV
  55938. CLASS="example"
  55939. ><A
  55940. NAME="example.com1"
  55941. ></A
  55942. ><P
  55943. ><B
  55944. >P°φklad 1. COM example (1)</B
  55945. ></P
  55946. ><TABLE
  55947. BORDER="0"
  55948. BGCOLOR="#E0E0E0"
  55949. CELLPADDING="5"
  55950. ><TR
  55951. ><TD
  55952. ><PRE
  55953. CLASS="php"
  55954. ><?php
  55955. // starting word
  55956. $word = new COM("word.application") or die("Unable to instanciate Word");
  55957. echo "Loaded Word, version {$word->Version}\n";
  55958.  
  55959. //bring it to front
  55960. $word->Visible = 1;
  55961.  
  55962. //open an empty document
  55963. $word->Documents->Add();
  55964.  
  55965. //do some weird stuff
  55966. $word->Selection->TypeText("This is a test...");
  55967. $word->Documents[1]->SaveAs("Useless test.doc");
  55968.  
  55969. //closing word
  55970. $word->Quit();
  55971.  
  55972. //free the object
  55973. $word->Release();
  55974. $word = null;
  55975. ?></PRE
  55976. ></TD
  55977. ></TR
  55978. ></TABLE
  55979. ></DIV
  55980. ></TD
  55981. ></TR
  55982. ></TABLE
  55983. >
  55984.    </P
  55985. ><P
  55986. >     <TABLE
  55987. WIDTH="100%"
  55988. BORDER="0"
  55989. CELLPADDING="0"
  55990. CELLSPACING="0"
  55991. CLASS="EXAMPLE"
  55992. ><TR
  55993. ><TD
  55994. ><DIV
  55995. CLASS="example"
  55996. ><A
  55997. NAME="example.com2"
  55998. ></A
  55999. ><P
  56000. ><B
  56001. >P°φklad 2. COM example (2)</B
  56002. ></P
  56003. ><TABLE
  56004. BORDER="0"
  56005. BGCOLOR="#E0E0E0"
  56006. CELLPADDING="5"
  56007. ><TR
  56008. ><TD
  56009. ><PRE
  56010. CLASS="php"
  56011. ><?php
  56012.  
  56013. $conn = new COM("ADODB.Connection") or die("Cannot start ADO");
  56014. $conn->Open("Provider=SQLOLEDB; Data Source=localhost;
  56015. Initial Catalog=database; User ID=user; Password=password");
  56016.  
  56017. $rs = $conn->Execute("SELECT * FROM sometable");    // Recordset
  56018.  
  56019. $num_columns = $rs->Fields->Count();
  56020. echo $num_columns . "\n";
  56021.  
  56022. for ($i=0; $i < $num_columns; $i++) {
  56023.     $fld[$i] = $rs->Fields($i);
  56024. }
  56025.  
  56026. $rowcount = 0;
  56027. while (!$rs->EOF) {
  56028.     for ($i=0; $i < $num_columns; $i++) {
  56029.         echo $fld[$i]->value . "\t";
  56030.     }
  56031.     echo "\n";
  56032.     $rowcount++;            // increments rowcount
  56033.     $rs->MoveNext();
  56034. }
  56035.  
  56036. $rs->Close();
  56037. $conn->Close();
  56038.  
  56039. $rs->Release();
  56040. $conn->Release();
  56041.  
  56042. $rs = null;
  56043. $conn = null;
  56044.  
  56045. ?></PRE
  56046. ></TD
  56047. ></TR
  56048. ></TABLE
  56049. ></DIV
  56050. ></TD
  56051. ></TR
  56052. ></TABLE
  56053. >
  56054.    </P
  56055. ></DIV
  56056. ><H1
  56057. ><A
  56058. NAME="class.variant"
  56059. ></A
  56060. >VARIANT</H1
  56061. ><DIV
  56062. CLASS="refnamediv"
  56063. ><A
  56064. NAME="AEN11261"
  56065. ></A
  56066. ><P
  56067. >    (no version information, might be only in CVS)</P
  56068. >VARIANT -- VARIANT class</DIV
  56069. ><DIV
  56070. CLASS="refsynopsisdiv"
  56071. ><A
  56072. NAME="AEN11264"
  56073. ></A
  56074. ><H2
  56075. >P°ehled</H2
  56076. ><TABLE
  56077. BORDER="0"
  56078. BGCOLOR="#E0E0E0"
  56079. CELLPADDING="5"
  56080. ><TR
  56081. ><TD
  56082. ><PRE
  56083. CLASS="synopsis"
  56084. >$vVar = new VARIANT($var)</PRE
  56085. ></TD
  56086. ></TR
  56087. ></TABLE
  56088. ></DIV
  56089. ><DIV
  56090. CLASS="refsect1"
  56091. ><A
  56092. NAME="class.variant.class"
  56093. ></A
  56094. ><H2
  56095. >Description</H2
  56096. ><P
  56097. >     A simple container to wrap variables into VARIANT structures.
  56098.    </P
  56099. ></DIV
  56100. ><DIV
  56101. CLASS="refsect1"
  56102. ><A
  56103. NAME="class.variant.constructor"
  56104. ></A
  56105. ><H2
  56106. >Methods</H2
  56107. >string <B
  56108. CLASS="methodname"
  56109. >VARIANT::VARIANT</B
  56110. > ( [mixed value [, int type [, int codepage]]])<BR
  56111. ></BR
  56112. ><P
  56113. >     VARIANT class constructor. Parameters:
  56114.     <P
  56115. ></P
  56116. ><DIV
  56117. CLASS="variablelist"
  56118. ><DL
  56119. ><DT
  56120. >value</DT
  56121. ><DD
  56122. ><P
  56123. >       initial value. if omitted an VT_EMPTY object is created.
  56124.      </P
  56125. ></DD
  56126. ><DT
  56127. >type</DT
  56128. ><DD
  56129. ><P
  56130. >       specifies the content type of the VARIANT object. Possible values are
  56131.       <TT
  56132. CLASS="constant"
  56133. ><B
  56134. >VT_UI1</B
  56135. ></TT
  56136. >, <TT
  56137. CLASS="constant"
  56138. ><B
  56139. >VT_UI2</B
  56140. ></TT
  56141. >, <TT
  56142. CLASS="constant"
  56143. ><B
  56144. >VT_UI4</B
  56145. ></TT
  56146. >, 
  56147.       <TT
  56148. CLASS="constant"
  56149. ><B
  56150. >VT_I1</B
  56151. ></TT
  56152. >, <TT
  56153. CLASS="constant"
  56154. ><B
  56155. >VT_I2</B
  56156. ></TT
  56157. >, <TT
  56158. CLASS="constant"
  56159. ><B
  56160. >VT_I4</B
  56161. ></TT
  56162. >, 
  56163.       <TT
  56164. CLASS="constant"
  56165. ><B
  56166. >VT_R4</B
  56167. ></TT
  56168. >, <TT
  56169. CLASS="constant"
  56170. ><B
  56171. >VT_R8</B
  56172. ></TT
  56173. >, <TT
  56174. CLASS="constant"
  56175. ><B
  56176. >VT_INT</B
  56177. ></TT
  56178. >, <TT
  56179. CLASS="constant"
  56180. ><B
  56181. >VT_UINT</B
  56182. ></TT
  56183. >,
  56184.       <TT
  56185. CLASS="constant"
  56186. ><B
  56187. >VT_BOOL</B
  56188. ></TT
  56189. >, <TT
  56190. CLASS="constant"
  56191. ><B
  56192. >VT_ERROR</B
  56193. ></TT
  56194. >, <TT
  56195. CLASS="constant"
  56196. ><B
  56197. >VT_CY</B
  56198. ></TT
  56199. >, 
  56200.       <TT
  56201. CLASS="constant"
  56202. ><B
  56203. >VT_DATE</B
  56204. ></TT
  56205. >, <TT
  56206. CLASS="constant"
  56207. ><B
  56208. >VT_BSTR</B
  56209. ></TT
  56210. >, <TT
  56211. CLASS="constant"
  56212. ><B
  56213. >VT_DECIMAL</B
  56214. ></TT
  56215. >, 
  56216.       <TT
  56217. CLASS="constant"
  56218. ><B
  56219. >VT_UNKNOWN</B
  56220. ></TT
  56221. >, <TT
  56222. CLASS="constant"
  56223. ><B
  56224. >VT_DISPATCH</B
  56225. ></TT
  56226. > and <TT
  56227. CLASS="constant"
  56228. ><B
  56229. >VT_VARIANT</B
  56230. ></TT
  56231. >. These values are
  56232.       mutual exclusive, but they can be combined with <TT
  56233. CLASS="constant"
  56234. ><B
  56235. >VT_BYREF</B
  56236. ></TT
  56237. > to specify being a value. If omitted,
  56238.       the type of <TT
  56239. CLASS="parameter"
  56240. ><I
  56241. >value</I
  56242. ></TT
  56243. > is used. Consult the <SPAN
  56244. CLASS="acronym"
  56245. >MSDN</SPAN
  56246. > library for additional information.
  56247.      </P
  56248. ></DD
  56249. ><DT
  56250. >codepage</DT
  56251. ><DD
  56252. ><P
  56253. >       specifies the codepage that is used to convert php-strings to
  56254.       unicode-strings and vice versa. Possible values are
  56255.       <TT
  56256. CLASS="constant"
  56257. ><B
  56258. >CP_ACP</B
  56259. ></TT
  56260. >, <TT
  56261. CLASS="constant"
  56262. ><B
  56263. >CP_MACCP</B
  56264. ></TT
  56265. >,
  56266.       <TT
  56267. CLASS="constant"
  56268. ><B
  56269. >CP_OEMCP</B
  56270. ></TT
  56271. >, <TT
  56272. CLASS="constant"
  56273. ><B
  56274. >CP_SYMBOL</B
  56275. ></TT
  56276. >,
  56277.       <TT
  56278. CLASS="constant"
  56279. ><B
  56280. >CP_THREAD_ACP</B
  56281. ></TT
  56282. >, <TT
  56283. CLASS="constant"
  56284. ><B
  56285. >CP_UTF7</B
  56286. ></TT
  56287. >
  56288.       and <TT
  56289. CLASS="constant"
  56290. ><B
  56291. >CP_UTF8</B
  56292. ></TT
  56293. >.
  56294.      </P
  56295. ></DD
  56296. ></DL
  56297. ></DIV
  56298. >
  56299.    </P
  56300. ></DIV
  56301. ><H1
  56302. ><A
  56303. NAME="function.com-addref"
  56304. ></A
  56305. >com_addref</H1
  56306. ><DIV
  56307. CLASS="refnamediv"
  56308. ><A
  56309. NAME="AEN11328"
  56310. ></A
  56311. ><P
  56312. >    (4.1.0 - 4.3.2 only)</P
  56313. >com_addref -- 
  56314.     Increases the components reference counter.
  56315.    </DIV
  56316. ><DIV
  56317. CLASS="refsect1"
  56318. ><A
  56319. NAME="AEN11331"
  56320. ></A
  56321. ><H2
  56322. >Description</H2
  56323. >void <B
  56324. CLASS="methodname"
  56325. >com_addref</B
  56326. > ( void )<BR
  56327. ></BR
  56328. ><P
  56329. >     Increases the components reference counter.
  56330.    </P
  56331. ></DIV
  56332. ><H1
  56333. ><A
  56334. NAME="function.com-get"
  56335. ></A
  56336. >com_get</H1
  56337. ><DIV
  56338. CLASS="refnamediv"
  56339. ><A
  56340. NAME="AEN11339"
  56341. ></A
  56342. ><P
  56343. >    (PHP 3>= 3.0.3, 4.0.5 - 4.3.2 only)</P
  56344. >com_get -- 
  56345.      Zφskßvß hodnotu vlastnosti COM komponenty
  56346.     </DIV
  56347. ><DIV
  56348. CLASS="refsect1"
  56349. ><A
  56350. NAME="AEN11342"
  56351. ></A
  56352. ><H2
  56353. >Popis</H2
  56354. >mixed <B
  56355. CLASS="methodname"
  56356. >com_get</B
  56357. > ( resource com_object, string property)<BR
  56358. ></BR
  56359. ><P
  56360. >      Vracφ hodnotu <TT
  56361. CLASS="parameter"
  56362. ><I
  56363. >property</I
  56364. ></TT
  56365. > COM komponenty odkazovanΘ
  56366.      <TT
  56367. CLASS="parameter"
  56368. ><I
  56369. >com_object</I
  56370. ></TT
  56371. >. P°i chyb∞ vracφ <TT
  56372. CLASS="constant"
  56373. ><B
  56374. >FALSE</B
  56375. ></TT
  56376. >.
  56377.     </P
  56378. ></DIV
  56379. ><H1
  56380. ><A
  56381. NAME="function.com-invoke"
  56382. ></A
  56383. >com_invoke</H1
  56384. ><DIV
  56385. CLASS="refnamediv"
  56386. ><A
  56387. NAME="AEN11358"
  56388. ></A
  56389. ><P
  56390. >    (PHP 3>= 3.0.3)</P
  56391. >com_invoke -- 
  56392.      Volß metodu COM komponenty.
  56393.     </DIV
  56394. ><DIV
  56395. CLASS="refsect1"
  56396. ><A
  56397. NAME="AEN11361"
  56398. ></A
  56399. ><H2
  56400. >Popis</H2
  56401. >mixed <B
  56402. CLASS="methodname"
  56403. >com_invoke</B
  56404. > ( resource com_object, string function_name [, mixed parametry funkce, ...])<BR
  56405. ></BR
  56406. ><P
  56407. >      <B
  56408. CLASS="function"
  56409. >com_invoke()</B
  56410. > volß metodu COM komponenty odkazovanΘ
  56411.      <TT
  56412. CLASS="parameter"
  56413. ><I
  56414. >com_object</I
  56415. ></TT
  56416. >. Pokud dojde k chyb∞, vracφ
  56417.      <TT
  56418. CLASS="constant"
  56419. ><B
  56420. >FALSE</B
  56421. ></TT
  56422. >, p°i ·sp∞chu vracφ nßvratovou hodnotu metody
  56423.      <TT
  56424. CLASS="parameter"
  56425. ><I
  56426. >function_name</I
  56427. ></TT
  56428. >.
  56429.     </P
  56430. ></DIV
  56431. ><H1
  56432. ><A
  56433. NAME="function.com-isenum"
  56434. ></A
  56435. >com_isenum</H1
  56436. ><DIV
  56437. CLASS="refnamediv"
  56438. ><A
  56439. NAME="AEN11381"
  56440. ></A
  56441. ><P
  56442. >    (4.1.0 - 4.3.2 only)</P
  56443. >com_isenum -- Grabs an IEnumVariant</DIV
  56444. ><DIV
  56445. CLASS="refsect1"
  56446. ><A
  56447. NAME="AEN11384"
  56448. ></A
  56449. ><H2
  56450. >Description</H2
  56451. >void <B
  56452. CLASS="methodname"
  56453. >com_isenum</B
  56454. > ( object com_module)<BR
  56455. ></BR
  56456. ><P
  56457. >      <DIV
  56458. CLASS="warning"
  56459. ><P
  56460. ></P
  56461. ><TABLE
  56462. CLASS="warning"
  56463. BORDER="1"
  56464. WIDTH="100%"
  56465. ><TR
  56466. ><TD
  56467. ALIGN="CENTER"
  56468. ><B
  56469. >Varovßnφ</B
  56470. ></TD
  56471. ></TR
  56472. ><TR
  56473. ><TD
  56474. ALIGN="LEFT"
  56475. ><P
  56476. >Tato funkce je╣t∞ nenφ
  56477. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  56478. ></TD
  56479. ></TR
  56480. ></TABLE
  56481. ></DIV
  56482. >
  56483.     </P
  56484. ></DIV
  56485. ><H1
  56486. ><A
  56487. NAME="function.com-load-typelib"
  56488. ></A
  56489. >com_load_typelib</H1
  56490. ><DIV
  56491. CLASS="refnamediv"
  56492. ><A
  56493. NAME="AEN11396"
  56494. ></A
  56495. ><P
  56496. >    (4.1.0 - 4.3.2 only)</P
  56497. >com_load_typelib -- Loads a Typelib</DIV
  56498. ><DIV
  56499. CLASS="refsect1"
  56500. ><A
  56501. NAME="AEN11399"
  56502. ></A
  56503. ><H2
  56504. >Description</H2
  56505. >void <B
  56506. CLASS="methodname"
  56507. >com_load_typelib</B
  56508. > ( string typelib_name [, int case_insensitive])<BR
  56509. ></BR
  56510. ><P
  56511. >      <DIV
  56512. CLASS="warning"
  56513. ><P
  56514. ></P
  56515. ><TABLE
  56516. CLASS="warning"
  56517. BORDER="1"
  56518. WIDTH="100%"
  56519. ><TR
  56520. ><TD
  56521. ALIGN="CENTER"
  56522. ><B
  56523. >Varovßnφ</B
  56524. ></TD
  56525. ></TR
  56526. ><TR
  56527. ><TD
  56528. ALIGN="LEFT"
  56529. ><P
  56530. >Tato funkce je╣t∞ nenφ
  56531. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  56532. ></TD
  56533. ></TR
  56534. ></TABLE
  56535. ></DIV
  56536. >
  56537.     </P
  56538. ></DIV
  56539. ><H1
  56540. ><A
  56541. NAME="function.com-load"
  56542. ></A
  56543. >com_load</H1
  56544. ><DIV
  56545. CLASS="refnamediv"
  56546. ><A
  56547. NAME="AEN11414"
  56548. ></A
  56549. ><P
  56550. >    (PHP 3>= 3.0.3)</P
  56551. >com_load -- 
  56552.      Vytvo°φ nov² odkaz na COM komponentu
  56553.     </DIV
  56554. ><DIV
  56555. CLASS="refsect1"
  56556. ><A
  56557. NAME="AEN11417"
  56558. ></A
  56559. ><H2
  56560. >Popis</H2
  56561. >string <B
  56562. CLASS="methodname"
  56563. >com_load</B
  56564. > ( string module name [, string server name])<BR
  56565. ></BR
  56566. ><P
  56567. >      <B
  56568. CLASS="function"
  56569. >com_load()</B
  56570. > vytvß°φ novou COM komponentu a vracφ odkaz
  56571.      na ni. P°i ne·sp∞chu vracφ <TT
  56572. CLASS="constant"
  56573. ><B
  56574. >FALSE</B
  56575. ></TT
  56576. >.
  56577.     </P
  56578. ></DIV
  56579. ><H1
  56580. ><A
  56581. NAME="function.com-propget"
  56582. ></A
  56583. >com_propget</H1
  56584. ><DIV
  56585. CLASS="refnamediv"
  56586. ><A
  56587. NAME="AEN11432"
  56588. ></A
  56589. ><P
  56590. >    (PHP 3>= 3.0.3, 4.0.5 - 4.3.2 only)</P
  56591. >com_propget -- 
  56592.      Zφskßvß hodnotu vlastnosti COM komponenty
  56593.     </DIV
  56594. ><DIV
  56595. CLASS="refsect1"
  56596. ><A
  56597. NAME="AEN11435"
  56598. ></A
  56599. ><H2
  56600. >Popis</H2
  56601. >mixed <B
  56602. CLASS="methodname"
  56603. >com_propget</B
  56604. > ( resource com_object, string property)<BR
  56605. ></BR
  56606. ><P
  56607. >      Tato funkce je alias k <A
  56608. HREF="#function.com-get"
  56609. ><B
  56610. CLASS="function"
  56611. >com_get()</B
  56612. ></A
  56613. >.
  56614.     </P
  56615. ></DIV
  56616. ><H1
  56617. ><A
  56618. NAME="function.com-propput"
  56619. ></A
  56620. >com_propput</H1
  56621. ><DIV
  56622. CLASS="refnamediv"
  56623. ><A
  56624. NAME="AEN11449"
  56625. ></A
  56626. ><P
  56627. >    (PHP 3>= 3.0.3, 4.0.5 - 4.3.2 only)</P
  56628. >com_propput -- 
  56629.      P°i°azuje hodnotu vlastnosti COM komponenty.
  56630.     </DIV
  56631. ><DIV
  56632. CLASS="refsect1"
  56633. ><A
  56634. NAME="AEN11452"
  56635. ></A
  56636. ><H2
  56637. >Popis</H2
  56638. >void <B
  56639. CLASS="methodname"
  56640. >com_propput</B
  56641. > ( resource com_object, string property, mixed value)<BR
  56642. ></BR
  56643. ><P
  56644. >      Tato funkce je alias ke <A
  56645. HREF="#function.com-set"
  56646. ><B
  56647. CLASS="function"
  56648. >com_set()</B
  56649. ></A
  56650. >.
  56651.     </P
  56652. ></DIV
  56653. ><H1
  56654. ><A
  56655. NAME="function.com-propset"
  56656. ></A
  56657. >com_propset</H1
  56658. ><DIV
  56659. CLASS="refnamediv"
  56660. ><A
  56661. NAME="AEN11469"
  56662. ></A
  56663. ><P
  56664. >    (PHP 3>= 3.0.3, 4.0.5 - 4.3.2 only)</P
  56665. >com_propset -- 
  56666.      P°i°azuje hodnotu vlastnosti COM komponenty.
  56667.     </DIV
  56668. ><DIV
  56669. CLASS="refsect1"
  56670. ><A
  56671. NAME="AEN11472"
  56672. ></A
  56673. ><H2
  56674. >Popis</H2
  56675. >void <B
  56676. CLASS="methodname"
  56677. >com_propset</B
  56678. > ( resource com_object, string property, mixed value)<BR
  56679. ></BR
  56680. ><P
  56681. >      Tato funkce je alias ke <A
  56682. HREF="#function.com-set"
  56683. ><B
  56684. CLASS="function"
  56685. >com_set()</B
  56686. ></A
  56687. >.
  56688.     </P
  56689. ></DIV
  56690. ><H1
  56691. ><A
  56692. NAME="function.com-release"
  56693. ></A
  56694. >com_release</H1
  56695. ><DIV
  56696. CLASS="refnamediv"
  56697. ><A
  56698. NAME="AEN11489"
  56699. ></A
  56700. ><P
  56701. >    (4.1.0 - 4.3.2 only)</P
  56702. >com_release -- 
  56703.     Decreases the components reference counter.
  56704.    </DIV
  56705. ><DIV
  56706. CLASS="refsect1"
  56707. ><A
  56708. NAME="AEN11492"
  56709. ></A
  56710. ><H2
  56711. >Description</H2
  56712. >void <B
  56713. CLASS="methodname"
  56714. >com_release</B
  56715. > ( void )<BR
  56716. ></BR
  56717. ><P
  56718. >     Decreases the components reference counter.
  56719.    </P
  56720. ></DIV
  56721. ><H1
  56722. ><A
  56723. NAME="function.com-set"
  56724. ></A
  56725. >com_set</H1
  56726. ><DIV
  56727. CLASS="refnamediv"
  56728. ><A
  56729. NAME="AEN11500"
  56730. ></A
  56731. ><P
  56732. >    (PHP 3>= 3.0.3, 4.0.5 - 4.3.2 only)</P
  56733. >com_set -- 
  56734.      P°i°azuje hodnotu vlastnosti COM komponenty.
  56735.     </DIV
  56736. ><DIV
  56737. CLASS="refsect1"
  56738. ><A
  56739. NAME="AEN11503"
  56740. ></A
  56741. ><H2
  56742. >Popis</H2
  56743. >void <B
  56744. CLASS="methodname"
  56745. >com_set</B
  56746. > ( resource com_object, string property, mixed value)<BR
  56747. ></BR
  56748. ><P
  56749. >      Nastavuje hodnotu vlastnosti <TT
  56750. CLASS="parameter"
  56751. ><I
  56752. >property</I
  56753. ></TT
  56754. > COM
  56755.      komponent odkazovanΘ <TT
  56756. CLASS="parameter"
  56757. ><I
  56758. >com_object</I
  56759. ></TT
  56760. >.
  56761.      Vracφ <TT
  56762. CLASS="constant"
  56763. ><B
  56764. >TRUE</B
  56765. ></TT
  56766. >, pokud je <TT
  56767. CLASS="parameter"
  56768. ><I
  56769. >property</I
  56770. ></TT
  56771. >
  56772.      nastaveno. P°i chyb∞ vracφ <TT
  56773. CLASS="constant"
  56774. ><B
  56775. >FALSE</B
  56776. ></TT
  56777. >.
  56778.     </P
  56779. ></DIV
  56780. ></DIV
  56781. ><DIV
  56782. CLASS="reference"
  56783. ><A
  56784. NAME="ref.classobj"
  56785. ></A
  56786. ><DIV
  56787. CLASS="TITLEPAGE"
  56788. ><H1
  56789. CLASS="title"
  56790. >IX. Funkce pro prßci s t°φdami/objekty</H1
  56791. ><DIV
  56792. CLASS="PARTINTRO"
  56793. ><A
  56794. NAME="AEN11526"
  56795. ></A
  56796. ><DIV
  56797. CLASS="section"
  56798. ><H1
  56799. CLASS="section"
  56800. ><A
  56801. NAME="classobj.intro"
  56802. ></A
  56803. >┌vod</H1
  56804. ><P
  56805. >       Tyto funkce vßm umo╛≥ujφ zφskßvat informace o t°φdßch a instancφch. M∙╛ete
  56806.       zjistit nßzev t°φdy do kterΘ objekt pat°φ nebo jeho prom∞nnΘ a metody.
  56807.       Pomocφ t∞chto funkcφ m∙╛ete zjistit nejen p°φslu╣nost objektu k t°φd∞,
  56808.       ale i jeho p°edka (tj. kterou t°φdu t°φda tohoto objektu roz╣i°uje).
  56809.      </P
  56810. ></DIV
  56811. ><DIV
  56812. CLASS="section"
  56813. ><HR><H1
  56814. CLASS="section"
  56815. ><A
  56816. NAME="classobj.requirements"
  56817. ></A
  56818. >Po╛adavky</H1
  56819. ><P
  56820. >Tyto funkce jsou k dispozici jako souΦßst
  56821. standardnφho modulu, kter² je v╛dy dostupn².</P
  56822. ></DIV
  56823. ><DIV
  56824. CLASS="section"
  56825. ><HR><H1
  56826. CLASS="section"
  56827. ><A
  56828. NAME="classobj.installation"
  56829. ></A
  56830. >Instalace</H1
  56831. ><P
  56832. >K pou╛φvßnφ t∞chto funkcφ nenφ t°eba ╛ßdnß
  56833. instalace, jsou souΦßstφ jßdra PHP.</P
  56834. ></DIV
  56835. ><DIV
  56836. CLASS="section"
  56837. ><HR><H1
  56838. CLASS="section"
  56839. ><A
  56840. NAME="classobj.configuration"
  56841. ></A
  56842. >Konfigurace b∞hu</H1
  56843. ><P
  56844. >Toto roz╣φ°enφ nemß definovßno ╛ßdnΘ konfiguraΦnφ
  56845. direktivy.</P
  56846. ></DIV
  56847. ><DIV
  56848. CLASS="section"
  56849. ><HR><H1
  56850. CLASS="section"
  56851. ><A
  56852. NAME="classobj.resources"
  56853. ></A
  56854. >Typy prost°edk∙</H1
  56855. ><P
  56856. >Toto roz╣φ°enφ nemß definovßn ╛ßdn² typ prost°edku
  56857. (resource).</P
  56858. ></DIV
  56859. ><DIV
  56860. CLASS="section"
  56861. ><HR><H1
  56862. CLASS="section"
  56863. ><A
  56864. NAME="classobj.constants"
  56865. ></A
  56866. >P°eddefinovanΘ konstanty</H1
  56867. ><P
  56868. >Toto roz╣φ°enφ nemß definovßny ╛ßdnΘ
  56869. konstanty.</P
  56870. ></DIV
  56871. ><DIV
  56872. CLASS="section"
  56873. ><HR><H1
  56874. CLASS="section"
  56875. ><A
  56876. NAME="classobj.examples"
  56877. ></A
  56878. >P°φklady</H1
  56879. ><P
  56880. >       V tΘto ukßzce nejd°φve definujeme zßkladnφ t°φdu a roz╣φ°enφ tΘto t°φdy.
  56881.       Zßkladnφ t°φda popisuje obecnou zeleninu, a╗ u╛ je jedlß nebo ne a bez
  56882.       ohledu na jejφ barvu. Podt°φda <TT
  56883. CLASS="varname"
  56884. >Spenat</TT
  56885. > p°idßvß metodu
  56886.       na uva°enφ tΘto zeleniny a dal╣φ, kterß zjistφ, jestli je va°enß.
  56887.      </P
  56888. ><P
  56889. >       <TABLE
  56890. WIDTH="100%"
  56891. BORDER="0"
  56892. CELLPADDING="0"
  56893. CELLSPACING="0"
  56894. CLASS="EXAMPLE"
  56895. ><TR
  56896. ><TD
  56897. ><DIV
  56898. CLASS="example"
  56899. ><A
  56900. NAME="AEN11550"
  56901. ></A
  56902. ><P
  56903. ><B
  56904. >P°φklad 1. classes.inc</B
  56905. ></P
  56906. ><TABLE
  56907. BORDER="0"
  56908. BGCOLOR="#E0E0E0"
  56909. CELLPADDING="5"
  56910. ><TR
  56911. ><TD
  56912. ><PRE
  56913. CLASS="php"
  56914. ><?php
  56915.  
  56916. // zßkladnφ t°φda s Φlensk²mi prom∞nn²mi a metodami
  56917. class Zelenina {
  56918.  
  56919.     var $jedla;
  56920.     var $barva;
  56921.  
  56922.     function Zelenina( $jedla, $barva="green" ) {
  56923.         $this->jedla = $jedla;
  56924.         $this->barva = $barva;
  56925.     }
  56926.  
  56927.     function je_jedla() {
  56928.         return $this->jedla;
  56929.     }
  56930.  
  56931.     function jaka_barva() {
  56932.         return $this->barva;
  56933.     }
  56934.  
  56935. } // konec t°φdy Zelenina
  56936.  
  56937. // roz╣i°uje zßkladnφ t°φdu
  56938. class Spenat extends Zelenina {
  56939.  
  56940.     var $varena = false;
  56941.  
  56942.     function Spenat() {
  56943.         $this->Zelenina( true, "zelena" );
  56944.     }
  56945.  
  56946.     function cook_it() {
  56947.         $this->varena = true;
  56948.     }
  56949.  
  56950.     function je_varena() {
  56951.         return $this->varena;
  56952.     }
  56953.  
  56954. } // konec t°φdy Spenat
  56955.  
  56956. ?></PRE
  56957. ></TD
  56958. ></TR
  56959. ></TABLE
  56960. ></DIV
  56961. ></TD
  56962. ></TR
  56963. ></TABLE
  56964. >
  56965.      </P
  56966. ><P
  56967. >      Potom z t∞chto t°φd vytvo°φme 2 objekty a vytiskneme informace o nich, vΦ.
  56968.      rodiΦovsk²ch t°φd. TakΘ definujeme n∞kterΘ pomocnΘ funkce, p°edev╣φm kv∙li
  56969.      pohodlnΘmu tisku informacφ.
  56970.      </P
  56971. ><P
  56972. >       <TABLE
  56973. WIDTH="100%"
  56974. BORDER="0"
  56975. CELLPADDING="0"
  56976. CELLSPACING="0"
  56977. CLASS="EXAMPLE"
  56978. ><TR
  56979. ><TD
  56980. ><DIV
  56981. CLASS="example"
  56982. ><A
  56983. NAME="AEN11555"
  56984. ></A
  56985. ><P
  56986. ><B
  56987. >P°φklad 2. test_script.php</B
  56988. ></P
  56989. ><TABLE
  56990. BORDER="0"
  56991. BGCOLOR="#E0E0E0"
  56992. CELLPADDING="5"
  56993. ><TR
  56994. ><TD
  56995. ><PRE
  56996. CLASS="php"
  56997. ><pre>
  56998. <?php
  56999.  
  57000. include "classes.inc";
  57001.  
  57002. // pomocnΘ funkce
  57003.  
  57004. function vytiskni_promenne($obj) {
  57005.     $pole = get_object_vars($obj);
  57006.     while (list($vlastnost, $hodnota) = each($pole))
  57007.         echo "\t$vlastnost = $hodnota\n";
  57008. }
  57009.  
  57010. function vytiskni_metody($obj) {
  57011.     $pole = get_class_methods(get_class($obj));
  57012.     foreach ($pole as $metoda)
  57013.         echo "\tfunction $metoda()\n";
  57014. }
  57015.  
  57016. function class_parentage($obj, $class) {
  57017.     if (is_subclass_of($GLOBALS[$obj], $class)) {
  57018.         echo "Objekt $obj pat°φ do t°φdy ".get_class($$obj);
  57019.         echo ", kterß je podt°φdou $class\n";
  57020.     } else {
  57021.         echo "Objekt $obj nepat°φ do podt°φdy t°φdy $class\n";
  57022.     }
  57023. }
  57024.  
  57025. // instancujeme 2 objekty
  57026.  
  57027. $zeleninka = new Zelenina(true,"modrß");
  57028. $listnaty = new Spenat();
  57029.  
  57030. // vytisknout informace o obou objektech
  57031. echo "zeleninka: CLASS ".get_class($zeleninka)."\n";
  57032. echo "listnat²: CLASS ".get_class($listnaty);
  57033. echo ", PARENT ".get_parent_class($listnaty)."\n";
  57034.  
  57035. // vytisknout vlastnosti zeleninky
  57036. echo "\nzeleninka: Vlastnosti\n";
  57037. vytiskni_promenne($zeleninka);
  57038.  
  57039. // a metody objektu listnat²
  57040. echo "\nlistnat²: Metody\n";
  57041. vytiskni_metody($listnaty);
  57042.  
  57043. echo "\nRodiΦ:\n";
  57044. class_parentage("listnaty", "Spenat");
  57045. class_parentage("listnaty", "Zelenina");
  57046. ?>
  57047. </pre></PRE
  57048. ></TD
  57049. ></TR
  57050. ></TABLE
  57051. ><P
  57052. >         Je t°eba poznamenat, ╛e ve v²╣e uvedenΘ ukßzce je objekt
  57053.         <TT
  57054. CLASS="varname"
  57055. >$listnaty</TT
  57056. > instancφ t°φdy <B
  57057. CLASS="classname"
  57058. >Spenat</B
  57059. >,
  57060.         kterß je podt°φdou t°φdy <B
  57061. CLASS="classname"
  57062. >Zelenina</B
  57063. >, a poslednφ Φßst
  57064.         v²╣e uvedenΘho skriptu tudφ╛ vytiskne:
  57065.        </P
  57066. ><TABLE
  57067. BORDER="0"
  57068. BGCOLOR="#E0E0E0"
  57069. CELLPADDING="5"
  57070. ><TR
  57071. ><TD
  57072. ><PRE
  57073. CLASS="screen"
  57074. >[...]
  57075. RodiΦ:
  57076. Objekt listnaty nepat°φ do podt°φdy t°φdy Spenat
  57077. Object listnaty pat°φ do t°φdy Spenat, kterß je podt°φdou Zelenina</PRE
  57078. ></TD
  57079. ></TR
  57080. ></TABLE
  57081. ></DIV
  57082. ></TD
  57083. ></TR
  57084. ></TABLE
  57085. >
  57086.      </P
  57087. ></DIV
  57088. ></DIV
  57089. ><DIV
  57090. CLASS="TOC"
  57091. ><DL
  57092. ><DT
  57093. ><B
  57094. >Obsah</B
  57095. ></DT
  57096. ><DT
  57097. ><A
  57098. HREF="#function.call-user-method-array"
  57099. >call_user_method_array</A
  57100. > -- 
  57101.      Call a user method given with an array of parameters [deprecated]
  57102.     </DT
  57103. ><DT
  57104. ><A
  57105. HREF="#function.call-user-method"
  57106. >call_user_method</A
  57107. > -- 
  57108.      Zavolat u╛ivatelsky definouvanou metodu urΦitΘho objektu
  57109.     </DT
  57110. ><DT
  57111. ><A
  57112. HREF="#function.class-exists"
  57113. >class_exists</A
  57114. > -- Zjistit, jestli je t°φda definovßna</DT
  57115. ><DT
  57116. ><A
  57117. HREF="#function.get-class-methods"
  57118. >get_class_methods</A
  57119. > -- Vrßtit pole nßzv∙ metod t°φdy</DT
  57120. ><DT
  57121. ><A
  57122. HREF="#function.get-class-vars"
  57123. >get_class_vars</A
  57124. > -- Vrßtit pole defaultnφch vlastnostφ t°φdy</DT
  57125. ><DT
  57126. ><A
  57127. HREF="#function.get-class"
  57128. >get_class</A
  57129. > -- Vrßtit jmΘno t°φdy objektu</DT
  57130. ><DT
  57131. ><A
  57132. HREF="#function.get-declared-classes"
  57133. >get_declared_classes</A
  57134. > -- Vrßtit pole nßzv∙ definovan²ch t°φd</DT
  57135. ><DT
  57136. ><A
  57137. HREF="#function.get-object-vars"
  57138. >get_object_vars</A
  57139. > -- Vrßtit asociativnφ pole vlastnostφ objektu</DT
  57140. ><DT
  57141. ><A
  57142. HREF="#function.get-parent-class"
  57143. >get_parent_class</A
  57144. > -- Vrßtit nßzev rodiΦovskΘ t°φdy objektu</DT
  57145. ><DT
  57146. ><A
  57147. HREF="#function.is-a"
  57148. >is_a</A
  57149. > -- 
  57150.      Returns <TT
  57151. CLASS="constant"
  57152. ><B
  57153. >TRUE</B
  57154. ></TT
  57155. > if the object is of this class or has this class as 
  57156.      one of its parents
  57157.     </DT
  57158. ><DT
  57159. ><A
  57160. HREF="#function.is-subclass-of"
  57161. >is_subclass_of</A
  57162. > -- 
  57163.      Zjistit, jestli objekt pat°φ do podt°φdy urΦitΘ t°φdy
  57164.     </DT
  57165. ><DT
  57166. ><A
  57167. HREF="#function.method-exists"
  57168. >method_exists</A
  57169. > -- Zjistit, jestli mß t°φda urΦitou metodu</DT
  57170. ></DL
  57171. ></DIV
  57172. ></DIV
  57173. ><H1
  57174. ><A
  57175. NAME="function.call-user-method-array"
  57176. ></A
  57177. >call_user_method_array</H1
  57178. ><DIV
  57179. CLASS="refnamediv"
  57180. ><A
  57181. NAME="AEN11564"
  57182. ></A
  57183. ><P
  57184. >    (PHP 4 >= 4.0.5)</P
  57185. >call_user_method_array -- 
  57186.      Call a user method given with an array of parameters [deprecated]
  57187.     </DIV
  57188. ><DIV
  57189. CLASS="refsect1"
  57190. ><A
  57191. NAME="AEN11567"
  57192. ></A
  57193. ><H2
  57194. >Description</H2
  57195. >mixed <B
  57196. CLASS="methodname"
  57197. >call_user_method_array</B
  57198. > ( string method_name, object obj [, array paramarr])<BR
  57199. ></BR
  57200. ><DIV
  57201. CLASS="warning"
  57202. ><P
  57203. ></P
  57204. ><TABLE
  57205. CLASS="warning"
  57206. BORDER="1"
  57207. WIDTH="100%"
  57208. ><TR
  57209. ><TD
  57210. ALIGN="CENTER"
  57211. ><B
  57212. >Varovßnφ</B
  57213. ></TD
  57214. ></TR
  57215. ><TR
  57216. ><TD
  57217. ALIGN="LEFT"
  57218. ><P
  57219. >       The <B
  57220. CLASS="function"
  57221. >call_user_method_array()</B
  57222. > function is deprecated
  57223.       as of PHP 4.1.0, use the <A
  57224. HREF="#function.call-user-func-array"
  57225. ><B
  57226. CLASS="function"
  57227. >call_user_func_array()</B
  57228. ></A
  57229. > variety 
  57230.       with the <TT
  57231. CLASS="literal"
  57232. >array(&$obj, "method_name")</TT
  57233. > syntax instead.
  57234.      </P
  57235. ></TD
  57236. ></TR
  57237. ></TABLE
  57238. ></DIV
  57239. ><P
  57240. >      Calls the method referred by <TT
  57241. CLASS="parameter"
  57242. ><I
  57243. >method_name</I
  57244. ></TT
  57245. > from
  57246.      the user defined <TT
  57247. CLASS="parameter"
  57248. ><I
  57249. >obj</I
  57250. ></TT
  57251. > object, using the parameters
  57252.      in <TT
  57253. CLASS="parameter"
  57254. ><I
  57255. >paramarr</I
  57256. ></TT
  57257. >.
  57258.     </P
  57259. ><P
  57260. >      See also:
  57261.      <A
  57262. HREF="#function.call-user-func-array"
  57263. ><B
  57264. CLASS="function"
  57265. >call_user_func_array()</B
  57266. ></A
  57267. >, and
  57268.      <A
  57269. HREF="#function.call-user-func"
  57270. ><B
  57271. CLASS="function"
  57272. >call_user_func()</B
  57273. ></A
  57274. >.
  57275.     </P
  57276. ></DIV
  57277. ><H1
  57278. ><A
  57279. NAME="function.call-user-method"
  57280. ></A
  57281. >call_user_method</H1
  57282. ><DIV
  57283. CLASS="refnamediv"
  57284. ><A
  57285. NAME="AEN11594"
  57286. ></A
  57287. ><P
  57288. >    (PHP 3>= 3.0.3, PHP 4 )</P
  57289. >call_user_method -- 
  57290.      Zavolat u╛ivatelsky definouvanou metodu urΦitΘho objektu
  57291.     </DIV
  57292. ><DIV
  57293. CLASS="refsect1"
  57294. ><A
  57295. NAME="AEN11597"
  57296. ></A
  57297. ><H2
  57298. >Popis</H2
  57299. >mixed <B
  57300. CLASS="methodname"
  57301. >call_user_method</B
  57302. > ( string method_name, object obj [, mixed parameter [, mixed ...]])<BR
  57303. ></BR
  57304. ><P
  57305. >      Zavolß metodu <TT
  57306. CLASS="parameter"
  57307. ><I
  57308. >method_name</I
  57309. ></TT
  57310. > objektu
  57311.      <TT
  57312. CLASS="parameter"
  57313. ><I
  57314. >obj</I
  57315. ></TT
  57316. >. Ukßzka vyu╛itφ je nφ╛e, kde definujeme t°φdu,
  57317.      vytvo°φme objekt a pou╛ijeme <B
  57318. CLASS="function"
  57319. >call_user_method()</B
  57320. > k
  57321.      nep°φmΘmu volßnφ jejφ <TT
  57322. CLASS="varname"
  57323. >print_info</TT
  57324. > metody.
  57325.      <DIV
  57326. CLASS="informalexample"
  57327. ><A
  57328. NAME="AEN11619"
  57329. ></A
  57330. ><P
  57331. ></P
  57332. ><TABLE
  57333. BORDER="0"
  57334. BGCOLOR="#E0E0E0"
  57335. CELLPADDING="5"
  57336. ><TR
  57337. ><TD
  57338. ><PRE
  57339. CLASS="php"
  57340. ><?php
  57341. class Country {
  57342.     var $NAME;
  57343.     var $TLD;
  57344.  
  57345.     function Country($name, $tld) {
  57346.         $this->NAME = $name;
  57347.         $this->TLD = $tld;
  57348.     }
  57349.  
  57350.     function print_info($prestr="") {
  57351.         echo $prestr."Country: ".$this->NAME."\n";
  57352.         echo $prestr."Top Level Domain: ".$this->TLD."\n";
  57353.     }
  57354. }
  57355.  
  57356. $cntry = new Country("Peru","pe");
  57357.  
  57358. echo "* Calling the object method directly\n";
  57359. $cntry->print_info();
  57360.  
  57361. echo "\n* Calling the same method indirectly\n";
  57362. call_user_method ("print_info", $cntry, "\t");
  57363. ?></PRE
  57364. ></TD
  57365. ></TR
  57366. ></TABLE
  57367. ><P
  57368. ></P
  57369. ></DIV
  57370. >
  57371.     </P
  57372. ><P
  57373. >      Viz takΘ <A
  57374. HREF="#function.call-user-func"
  57375. ><B
  57376. CLASS="function"
  57377. >call_user_func()</B
  57378. ></A
  57379. >.
  57380.     </P
  57381. ></DIV
  57382. ><H1
  57383. ><A
  57384. NAME="function.class-exists"
  57385. ></A
  57386. >class_exists</H1
  57387. ><DIV
  57388. CLASS="refnamediv"
  57389. ><A
  57390. NAME="AEN11624"
  57391. ></A
  57392. ><P
  57393. >    (PHP 4 )</P
  57394. >class_exists -- Zjistit, jestli je t°φda definovßna</DIV
  57395. ><DIV
  57396. CLASS="refsect1"
  57397. ><A
  57398. NAME="AEN11627"
  57399. ></A
  57400. ><H2
  57401. >Popis</H2
  57402. >bool <B
  57403. CLASS="methodname"
  57404. >class_exists</B
  57405. > ( string class_name)<BR
  57406. ></BR
  57407. ><P
  57408. >      Tato funkce vrßtφ <TT
  57409. CLASS="constant"
  57410. ><B
  57411. >TRUE</B
  57412. ></TT
  57413. >, pokud je t°φda
  57414.      <TT
  57415. CLASS="parameter"
  57416. ><I
  57417. >class_name</I
  57418. ></TT
  57419. > definovßna, jinak <TT
  57420. CLASS="constant"
  57421. ><B
  57422. >FALSE</B
  57423. ></TT
  57424. >.
  57425.     </P
  57426. ></DIV
  57427. ><H1
  57428. ><A
  57429. NAME="function.get-class-methods"
  57430. ></A
  57431. >get_class_methods</H1
  57432. ><DIV
  57433. CLASS="refnamediv"
  57434. ><A
  57435. NAME="AEN11640"
  57436. ></A
  57437. ><P
  57438. >    (PHP 4 )</P
  57439. >get_class_methods -- Vrßtit pole nßzv∙ metod t°φdy</DIV
  57440. ><DIV
  57441. CLASS="refsect1"
  57442. ><A
  57443. NAME="AEN11643"
  57444. ></A
  57445. ><H2
  57446. >Popis</H2
  57447. >array <B
  57448. CLASS="methodname"
  57449. >get_class_methods</B
  57450. > ( string class_name)<BR
  57451. ></BR
  57452. ><P
  57453. >      Tato funkce vracφ pole nßzv∙ metod definovan²ch pro t°φdu specifikovanou
  57454.      argumentem <TT
  57455. CLASS="parameter"
  57456. ><I
  57457. >class_name</I
  57458. ></TT
  57459. >.
  57460.     </P
  57461. ><P
  57462. >      Viz takΘ <A
  57463. HREF="#function.get-class-vars"
  57464. ><B
  57465. CLASS="function"
  57466. >get_class_vars()</B
  57467. ></A
  57468. >,
  57469.      <A
  57470. HREF="#function.get-object-vars"
  57471. ><B
  57472. CLASS="function"
  57473. >get_object_vars()</B
  57474. ></A
  57475. >
  57476.     </P
  57477. ></DIV
  57478. ><H1
  57479. ><A
  57480. NAME="function.get-class-vars"
  57481. ></A
  57482. >get_class_vars</H1
  57483. ><DIV
  57484. CLASS="refnamediv"
  57485. ><A
  57486. NAME="AEN11657"
  57487. ></A
  57488. ><P
  57489. >    (PHP 4 )</P
  57490. >get_class_vars -- Vrßtit pole defaultnφch vlastnostφ t°φdy</DIV
  57491. ><DIV
  57492. CLASS="refsect1"
  57493. ><A
  57494. NAME="AEN11660"
  57495. ></A
  57496. ><H2
  57497. >Popis</H2
  57498. >array <B
  57499. CLASS="methodname"
  57500. >get_class_vars</B
  57501. > ( string class_name)<BR
  57502. ></BR
  57503. ><P
  57504. >      Tato funkce vracφ pole defaultnφch vlastnostφ t°φdy
  57505.      <TT
  57506. CLASS="parameter"
  57507. ><I
  57508. >class_name</I
  57509. ></TT
  57510. >.
  57511.     </P
  57512. ><P
  57513. >      Viz takΘ <A
  57514. HREF="#function.get-class-methods"
  57515. ><B
  57516. CLASS="function"
  57517. >get_class_methods()</B
  57518. ></A
  57519. >,
  57520.      <A
  57521. HREF="#function.get-object-vars"
  57522. ><B
  57523. CLASS="function"
  57524. >get_object_vars()</B
  57525. ></A
  57526. >
  57527.     </P
  57528. ></DIV
  57529. ><H1
  57530. ><A
  57531. NAME="function.get-class"
  57532. ></A
  57533. >get_class</H1
  57534. ><DIV
  57535. CLASS="refnamediv"
  57536. ><A
  57537. NAME="AEN11674"
  57538. ></A
  57539. ><P
  57540. >    (PHP 4 )</P
  57541. >get_class -- Vrßtit jmΘno t°φdy objektu</DIV
  57542. ><DIV
  57543. CLASS="refsect1"
  57544. ><A
  57545. NAME="AEN11677"
  57546. ></A
  57547. ><H2
  57548. >Popis</H2
  57549. >string <B
  57550. CLASS="methodname"
  57551. >get_class</B
  57552. > ( object obj)<BR
  57553. ></BR
  57554. ><P
  57555. >      Tato funkce vracφ nßzev t°φdy jφ╛ je objekt <TT
  57556. CLASS="parameter"
  57557. ><I
  57558. >obj</I
  57559. ></TT
  57560. >
  57561.      instancφ.
  57562.     </P
  57563. ><P
  57564. >      Viz takΘ <A
  57565. HREF="#function.get-parent-class"
  57566. ><B
  57567. CLASS="function"
  57568. >get_parent_class()</B
  57569. ></A
  57570. >,
  57571.      <A
  57572. HREF="#function.is-subclass-of"
  57573. ><B
  57574. CLASS="function"
  57575. >is_subclass_of()</B
  57576. ></A
  57577. >
  57578.     </P
  57579. ></DIV
  57580. ><H1
  57581. ><A
  57582. NAME="function.get-declared-classes"
  57583. ></A
  57584. >get_declared_classes</H1
  57585. ><DIV
  57586. CLASS="refnamediv"
  57587. ><A
  57588. NAME="AEN11691"
  57589. ></A
  57590. ><P
  57591. >    (PHP 4 )</P
  57592. >get_declared_classes -- Vrßtit pole nßzv∙ definovan²ch t°φd</DIV
  57593. ><DIV
  57594. CLASS="refsect1"
  57595. ><A
  57596. NAME="AEN11694"
  57597. ></A
  57598. ><H2
  57599. >Popis</H2
  57600. >array <B
  57601. CLASS="methodname"
  57602. >get_declared_classes</B
  57603. > ( void )<BR
  57604. ></BR
  57605. ><P
  57606. >      Tato funkce vracφ pole nßzv∙ t°φd definovan²ch v souΦasnΘm skriptu.
  57607.     </P
  57608. ><DIV
  57609. CLASS="note"
  57610. ><BLOCKQUOTE
  57611. CLASS="note"
  57612. ><P
  57613. ><B
  57614. >Poznßmka: </B
  57615. >
  57616.       V PHP 4.0.1pl2 jsou na zaΦßtku pole vrßceny je╣t∞ t°i dal╣φ t°φdy:
  57617.       <B
  57618. CLASS="classname"
  57619. >stdClass</B
  57620. > (definovanß v
  57621.       <TT
  57622. CLASS="filename"
  57623. >Zend/zend.c</TT
  57624. >),
  57625.       <B
  57626. CLASS="classname"
  57627. >OverloadedTestClass</B
  57628. > (definovanß v
  57629.       <TT
  57630. CLASS="filename"
  57631. >ext/standard/basic_functions.c</TT
  57632. >)
  57633.       a <B
  57634. CLASS="classname"
  57635. >Directory</B
  57636. >
  57637.       (definovanß v <TT
  57638. CLASS="filename"
  57639. >ext/standard/dir.c</TT
  57640. >).
  57641.      </P
  57642. ></BLOCKQUOTE
  57643. ></DIV
  57644. ></DIV
  57645. ><H1
  57646. ><A
  57647. NAME="function.get-object-vars"
  57648. ></A
  57649. >get_object_vars</H1
  57650. ><DIV
  57651. CLASS="refnamediv"
  57652. ><A
  57653. NAME="AEN11710"
  57654. ></A
  57655. ><P
  57656. >    (PHP 4 )</P
  57657. >get_object_vars -- Vrßtit asociativnφ pole vlastnostφ objektu</DIV
  57658. ><DIV
  57659. CLASS="refsect1"
  57660. ><A
  57661. NAME="AEN11713"
  57662. ></A
  57663. ><H2
  57664. >Popis</H2
  57665. >array <B
  57666. CLASS="methodname"
  57667. >get_object_vars</B
  57668. > ( object obj)<BR
  57669. ></BR
  57670. ><P
  57671. >      Tato funkce vracφ asociativnφ pole definovan²ch vlastnostφ objektu
  57672.      <TT
  57673. CLASS="parameter"
  57674. ><I
  57675. >obj</I
  57676. ></TT
  57677. >. Prom∞nn²m deklarovan²m v t°φd∞ jφ╛ je
  57678.      <TT
  57679. CLASS="parameter"
  57680. ><I
  57681. >obj</I
  57682. ></TT
  57683. > instancφ, kter²m nebyla p°i°azena hodnota,
  57684.      nejsou ve vrßcenΘm poli obsa╛eny.
  57685.      <TABLE
  57686. WIDTH="100%"
  57687. BORDER="0"
  57688. CELLPADDING="0"
  57689. CELLSPACING="0"
  57690. CLASS="EXAMPLE"
  57691. ><TR
  57692. ><TD
  57693. ><DIV
  57694. CLASS="example"
  57695. ><A
  57696. NAME="AEN11724"
  57697. ></A
  57698. ><P
  57699. ><B
  57700. >P°φklad 1. Pou╛itφ <B
  57701. CLASS="function"
  57702. >get_object_vars()</B
  57703. ></B
  57704. ></P
  57705. ><TABLE
  57706. BORDER="0"
  57707. BGCOLOR="#E0E0E0"
  57708. CELLPADDING="5"
  57709. ><TR
  57710. ><TD
  57711. ><PRE
  57712. CLASS="php"
  57713. ><?php
  57714. class Point2D {
  57715.     var $x, $y;
  57716.     var $label;
  57717.  
  57718.     function Point2D($x, $y) {
  57719.         $this->x = $x;
  57720.         $this->y = $y;
  57721.     }
  57722.  
  57723.     function setLabel($label) {
  57724.         $this->label = $label;
  57725.     }
  57726.  
  57727.     function getPoint() {
  57728.         return array("x" => $this->x,
  57729.                      "y" => $this->y,
  57730.                      "label" => $this->label);
  57731.     }
  57732. }
  57733.  
  57734. $p1 = new Point2D(1.233, 3.445);
  57735. print_r(get_object_vars($p1));
  57736. // "$label" is declared but not defined
  57737. // Array
  57738. // (
  57739. //     [x] => 1.233
  57740. //     [y] => 3.445
  57741. // )
  57742.  
  57743. $p1->setLabel("point #1");
  57744. print_r(get_object_vars($p1));
  57745. // Array
  57746. // (
  57747. //     [x] => 1.233
  57748. //     [y] => 3.445
  57749. //     [label] => point #1
  57750. // )
  57751.  
  57752. ?></PRE
  57753. ></TD
  57754. ></TR
  57755. ></TABLE
  57756. ></DIV
  57757. ></TD
  57758. ></TR
  57759. ></TABLE
  57760. >
  57761.     </P
  57762. ><P
  57763. >      Viz takΘ <A
  57764. HREF="#function.get-class-methods"
  57765. ><B
  57766. CLASS="function"
  57767. >get_class_methods()</B
  57768. ></A
  57769. >,
  57770.      <A
  57771. HREF="#function.get-class-vars"
  57772. ><B
  57773. CLASS="function"
  57774. >get_class_vars()</B
  57775. ></A
  57776. >
  57777.     </P
  57778. ></DIV
  57779. ><H1
  57780. ><A
  57781. NAME="function.get-parent-class"
  57782. ></A
  57783. >get_parent_class</H1
  57784. ><DIV
  57785. CLASS="refnamediv"
  57786. ><A
  57787. NAME="AEN11732"
  57788. ></A
  57789. ><P
  57790. >    (PHP 4 )</P
  57791. >get_parent_class -- Vrßtit nßzev rodiΦovskΘ t°φdy objektu</DIV
  57792. ><DIV
  57793. CLASS="refsect1"
  57794. ><A
  57795. NAME="AEN11735"
  57796. ></A
  57797. ><H2
  57798. >Popis</H2
  57799. >string <B
  57800. CLASS="methodname"
  57801. >get_parent_class</B
  57802. > ( object obj)<BR
  57803. ></BR
  57804. ><P
  57805. >      Tato funkce vracφ nßzev rodiΦovskΘ t°φdy objektu
  57806.      <TT
  57807. CLASS="parameter"
  57808. ><I
  57809. >obj</I
  57810. ></TT
  57811. >.
  57812.     </P
  57813. ><P
  57814. >      Viz takΘ <A
  57815. HREF="#function.get-class"
  57816. ><B
  57817. CLASS="function"
  57818. >get_class()</B
  57819. ></A
  57820. >,
  57821.      <A
  57822. HREF="#function.is-subclass-of"
  57823. ><B
  57824. CLASS="function"
  57825. >is_subclass_of()</B
  57826. ></A
  57827. >
  57828.     </P
  57829. ></DIV
  57830. ><H1
  57831. ><A
  57832. NAME="function.is-a"
  57833. ></A
  57834. >is_a</H1
  57835. ><DIV
  57836. CLASS="refnamediv"
  57837. ><A
  57838. NAME="AEN11749"
  57839. ></A
  57840. ><P
  57841. >    (PHP 4 >= 4.2.0)</P
  57842. >is_a -- 
  57843.      Returns <TT
  57844. CLASS="constant"
  57845. ><B
  57846. >TRUE</B
  57847. ></TT
  57848. > if the object is of this class or has this class as 
  57849.      one of its parents
  57850.     </DIV
  57851. ><DIV
  57852. CLASS="refsect1"
  57853. ><A
  57854. NAME="AEN11753"
  57855. ></A
  57856. ><H2
  57857. >Description</H2
  57858. >bool <B
  57859. CLASS="methodname"
  57860. >is_a</B
  57861. > ( object object, string class_name)<BR
  57862. ></BR
  57863. ><P
  57864. >      This function returns <TT
  57865. CLASS="constant"
  57866. ><B
  57867. >TRUE</B
  57868. ></TT
  57869. > if the object is of this class or 
  57870.      has this class as one of its parents, <TT
  57871. CLASS="constant"
  57872. ><B
  57873. >FALSE</B
  57874. ></TT
  57875. > otherwise.
  57876.     </P
  57877. ><P
  57878. >      See also <A
  57879. HREF="#function.get-class"
  57880. ><B
  57881. CLASS="function"
  57882. >get_class()</B
  57883. ></A
  57884. >, 
  57885.      <A
  57886. HREF="#function.get-parent-class"
  57887. ><B
  57888. CLASS="function"
  57889. >get_parent_class()</B
  57890. ></A
  57891. >, and 
  57892.      <A
  57893. HREF="#function.is-subclass-of"
  57894. ><B
  57895. CLASS="function"
  57896. >is_subclass_of()</B
  57897. ></A
  57898. >.
  57899.     </P
  57900. ></DIV
  57901. ><H1
  57902. ><A
  57903. NAME="function.is-subclass-of"
  57904. ></A
  57905. >is_subclass_of</H1
  57906. ><DIV
  57907. CLASS="refnamediv"
  57908. ><A
  57909. NAME="AEN11772"
  57910. ></A
  57911. ><P
  57912. >    (PHP 4 )</P
  57913. >is_subclass_of -- 
  57914.      Zjistit, jestli objekt pat°φ do podt°φdy urΦitΘ t°φdy
  57915.     </DIV
  57916. ><DIV
  57917. CLASS="refsect1"
  57918. ><A
  57919. NAME="AEN11775"
  57920. ></A
  57921. ><H2
  57922. >Popis</H2
  57923. >bool <B
  57924. CLASS="methodname"
  57925. >is_subclass_of</B
  57926. > ( object obj, string superclass)<BR
  57927. ></BR
  57928. ><P
  57929. >      Tato funkce vracφ <TT
  57930. CLASS="constant"
  57931. ><B
  57932. >TRUE</B
  57933. ></TT
  57934. >, pokud je objekt
  57935.      <TT
  57936. CLASS="parameter"
  57937. ><I
  57938. >obj</I
  57939. ></TT
  57940. > instancφ t°φdy, kterß je podt°φdou
  57941.      <TT
  57942. CLASS="parameter"
  57943. ><I
  57944. >superclass</I
  57945. ></TT
  57946. >, jinak <TT
  57947. CLASS="constant"
  57948. ><B
  57949. >FALSE</B
  57950. ></TT
  57951. >.
  57952.     </P
  57953. ><P
  57954. >      Viz takΘ <A
  57955. HREF="#function.get-class"
  57956. ><B
  57957. CLASS="function"
  57958. >get_class()</B
  57959. ></A
  57960. >,
  57961.      <A
  57962. HREF="#function.get-parent-class"
  57963. ><B
  57964. CLASS="function"
  57965. >get_parent_class()</B
  57966. ></A
  57967. >
  57968.     </P
  57969. ></DIV
  57970. ><H1
  57971. ><A
  57972. NAME="function.method-exists"
  57973. ></A
  57974. >method_exists</H1
  57975. ><DIV
  57976. CLASS="refnamediv"
  57977. ><A
  57978. NAME="AEN11795"
  57979. ></A
  57980. ><P
  57981. >    (PHP 4 )</P
  57982. >method_exists -- Zjistit, jestli mß t°φda urΦitou metodu</DIV
  57983. ><DIV
  57984. CLASS="refsect1"
  57985. ><A
  57986. NAME="AEN11798"
  57987. ></A
  57988. ><H2
  57989. >Popis</H2
  57990. >bool <B
  57991. CLASS="methodname"
  57992. >method_exists</B
  57993. > ( object object, string method_name)<BR
  57994. ></BR
  57995. ><P
  57996. >      Tato funkce vracφ <TT
  57997. CLASS="constant"
  57998. ><B
  57999. >TRUE</B
  58000. ></TT
  58001. >, pokud mß
  58002.      <TT
  58003. CLASS="parameter"
  58004. ><I
  58005. >object</I
  58006. ></TT
  58007. > definovßnu metodu
  58008.      <TT
  58009. CLASS="parameter"
  58010. ><I
  58011. >method_name</I
  58012. ></TT
  58013. >, jinak <TT
  58014. CLASS="constant"
  58015. ><B
  58016. >FALSE</B
  58017. ></TT
  58018. >.
  58019.     </P
  58020. ></DIV
  58021. ></DIV
  58022. ><DIV
  58023. CLASS="reference"
  58024. ><A
  58025. NAME="ref.cpdf"
  58026. ></A
  58027. ><DIV
  58028. CLASS="TITLEPAGE"
  58029. ><H1
  58030. CLASS="title"
  58031. >X. ClibPDF functions</H1
  58032. ><DIV
  58033. CLASS="PARTINTRO"
  58034. ><A
  58035. NAME="AEN11817"
  58036. ></A
  58037. ><DIV
  58038. CLASS="section"
  58039. ><H1
  58040. CLASS="section"
  58041. ><A
  58042. NAME="cpdf.intro"
  58043. ></A
  58044. >┌vod</H1
  58045. ><P
  58046. >      ClibPDF lets you create PDF documents with PHP. ClibPDF functionality
  58047.      and API are similar to <A
  58048. HREF="#ref.pdf"
  58049. >PDFlib</A
  58050. >.
  58051.      This documentation should be read alongside the ClibPDF manual since it
  58052.      explains the library in much greater detail.
  58053.     </P
  58054. ><P
  58055. >      Many functions in the native ClibPDF and the PHP module, as well
  58056.      as in <A
  58057. HREF="#ref.pdf"
  58058. >PDFlib</A
  58059. >, have the same name.
  58060.      All functions except for <A
  58061. HREF="#function.cpdf-open"
  58062. ><B
  58063. CLASS="function"
  58064. >cpdf_open()</B
  58065. ></A
  58066. > take the
  58067.      handle for the document as their first parameter.
  58068.     </P
  58069. ><P
  58070. >      Currently this handle is not used internally since ClibPDF does
  58071.      not support the creation of several PDF documents at the same time.
  58072.      Actually, you should not even try it, the results are unpredictable. I
  58073.      can't oversee what the consequences in a multi threaded environment
  58074.      are. According to the author of ClibPDF this will change in one of
  58075.      the next releases (current version when this was written is 1.10).
  58076.      If you need this functionality use the pdflib module.
  58077.     </P
  58078. ><P
  58079. >      A nice feature of ClibPDF (and <A
  58080. HREF="#ref.pdf"
  58081. >PDFlib</A
  58082. >) is the ability to create the pdf
  58083.      document completely in memory without using temporary files. It
  58084.      also provides the ability to pass coordinates in a predefined unit
  58085.      length. (This feature can also be simulated by
  58086.      <A
  58087. HREF="#function.pdf-translate"
  58088. ><B
  58089. CLASS="function"
  58090. >pdf_translate()</B
  58091. ></A
  58092. > when using the <A
  58093. HREF="#ref.pdf"
  58094. >PDFlib</A
  58095. > functions.)
  58096.     </P
  58097. ><P
  58098. >      Another nice feature of ClibPDF is the fact that any page can be modified
  58099.      at any time even if a new page has been already opened. The function
  58100.      <A
  58101. HREF="#function.cpdf-set-current-page"
  58102. ><B
  58103. CLASS="function"
  58104. >cpdf_set_current_page()</B
  58105. ></A
  58106. > allows to leave the current
  58107.      page and presume modifying an other page.
  58108.     </P
  58109. ><P
  58110. >      Most of the functions are fairly easy to use. The most difficult part
  58111.      is probably creating a very simple PDF document at all. The following
  58112.      example should help you to get started. It creates a document
  58113.      with one page. The page contains the text "Times-Roman" in an
  58114.      outlined 30pt font. The text is underlined.
  58115.     </P
  58116. ><DIV
  58117. CLASS="note"
  58118. ><BLOCKQUOTE
  58119. CLASS="note"
  58120. ><P
  58121. ><B
  58122. >Poznßmka: </B
  58123. >
  58124.       If you're interested in alternative free PDF generators that do not
  58125.       utilize external PDF libraries, see <A
  58126. HREF="#faq.using.freepdf"
  58127. >       this related FAQ</A
  58128. >.
  58129.      </P
  58130. ></BLOCKQUOTE
  58131. ></DIV
  58132. ></DIV
  58133. ><DIV
  58134. CLASS="section"
  58135. ><HR><H1
  58136. CLASS="section"
  58137. ><A
  58138. NAME="cpdf.requirements"
  58139. ></A
  58140. >Po╛adavky</H1
  58141. ><P
  58142. >      In order to use the ClibPDF functions you need to install the ClibPDF
  58143.      package. It is available for download from <A
  58144. HREF="http://www.fastio.com/"
  58145. TARGET="_top"
  58146. >      FastIO</A
  58147. >, but requires that you purchase a license for commercial
  58148.      use. PHP requires that you use cpdflib >= 2.
  58149.     </P
  58150. ></DIV
  58151. ><DIV
  58152. CLASS="section"
  58153. ><HR><H1
  58154. CLASS="section"
  58155. ><A
  58156. NAME="cpdf.installation"
  58157. ></A
  58158. >Instalace</H1
  58159. ><P
  58160. >   To get these functions to work, you have to compile PHP with
  58161.   <TT
  58162. CLASS="option"
  58163. >--with-cpdflib[=DIR]</TT
  58164. >. DIR is the cpdflib
  58165.   install directory, defaults to <TT
  58166. CLASS="filename"
  58167. >/usr</TT
  58168. >. In addition you
  58169.   can specify the jpeg library and the tiff library for ClibPDF to use. To do
  58170.   so add to your configure line the options
  58171.   <TT
  58172. CLASS="option"
  58173. >--with-jpeg-dir[=DIR]</TT
  58174. >
  58175.   <TT
  58176. CLASS="option"
  58177. >--with-tiff-dir[=DIR]</TT
  58178. >.
  58179.  </P
  58180. ></DIV
  58181. ><DIV
  58182. CLASS="section"
  58183. ><HR><H1
  58184. CLASS="section"
  58185. ><A
  58186. NAME="cpdf.configuration"
  58187. ></A
  58188. >Konfigurace b∞hu</H1
  58189. ><P
  58190. >Toto roz╣φ°enφ nemß definovßno ╛ßdnΘ konfiguraΦnφ
  58191. direktivy.</P
  58192. ></DIV
  58193. ><DIV
  58194. CLASS="section"
  58195. ><HR><H1
  58196. CLASS="section"
  58197. ><A
  58198. NAME="cpdf.constants"
  58199. ></A
  58200. >P°eddefinovanΘ konstanty</H1
  58201. ><P
  58202. > Tyto konstanty jsou definovßny tφmto roz╣φ°enφm a budou k dispozici pouze
  58203. tehdy, bylo-li roz╣φ°enφ zkompilovßno spoleΦn∞ s PHP nebo dynamicky zavedeno
  58204. za b∞hu.
  58205. </P
  58206. ><P
  58207. ></P
  58208. ><DIV
  58209. CLASS="variablelist"
  58210. ><DL
  58211. ><DT
  58212. ><TT
  58213. CLASS="constant"
  58214. ><B
  58215. >CPDF_PM_NONE</B
  58216. ></TT
  58217.     (<A
  58218. HREF="#language.types.integer"
  58219. ><B
  58220. CLASS="type"
  58221. >integer</B
  58222. ></A
  58223. >)</DT
  58224. ><DD
  58225. ><P
  58226. >      
  58227.     </P
  58228. ></DD
  58229. ><DT
  58230. ><TT
  58231. CLASS="constant"
  58232. ><B
  58233. >CPDF_PM_OUTLINES</B
  58234. ></TT
  58235.     (<A
  58236. HREF="#language.types.integer"
  58237. ><B
  58238. CLASS="type"
  58239. >integer</B
  58240. ></A
  58241. >)</DT
  58242. ><DD
  58243. ><P
  58244. >      
  58245.     </P
  58246. ></DD
  58247. ><DT
  58248. ><TT
  58249. CLASS="constant"
  58250. ><B
  58251. >CPDF_PM_THUMBS</B
  58252. ></TT
  58253.     (<A
  58254. HREF="#language.types.integer"
  58255. ><B
  58256. CLASS="type"
  58257. >integer</B
  58258. ></A
  58259. >)</DT
  58260. ><DD
  58261. ><P
  58262. >      
  58263.     </P
  58264. ></DD
  58265. ><DT
  58266. ><TT
  58267. CLASS="constant"
  58268. ><B
  58269. >CPDF_PM_FULLSCREEN</B
  58270. ></TT
  58271.     (<A
  58272. HREF="#language.types.integer"
  58273. ><B
  58274. CLASS="type"
  58275. >integer</B
  58276. ></A
  58277. >)</DT
  58278. ><DD
  58279. ><P
  58280. >      
  58281.     </P
  58282. ></DD
  58283. ><DT
  58284. ><TT
  58285. CLASS="constant"
  58286. ><B
  58287. >CPDF_PL_SINGLE</B
  58288. ></TT
  58289.     (<A
  58290. HREF="#language.types.integer"
  58291. ><B
  58292. CLASS="type"
  58293. >integer</B
  58294. ></A
  58295. >)</DT
  58296. ><DD
  58297. ><P
  58298. >      
  58299.     </P
  58300. ></DD
  58301. ><DT
  58302. ><TT
  58303. CLASS="constant"
  58304. ><B
  58305. >CPDF_PL_1COLUMN</B
  58306. ></TT
  58307.     (<A
  58308. HREF="#language.types.integer"
  58309. ><B
  58310. CLASS="type"
  58311. >integer</B
  58312. ></A
  58313. >)</DT
  58314. ><DD
  58315. ><P
  58316. >      
  58317.     </P
  58318. ></DD
  58319. ><DT
  58320. ><TT
  58321. CLASS="constant"
  58322. ><B
  58323. >CPDF_PL_2LCOLUMN</B
  58324. ></TT
  58325.     (<A
  58326. HREF="#language.types.integer"
  58327. ><B
  58328. CLASS="type"
  58329. >integer</B
  58330. ></A
  58331. >)</DT
  58332. ><DD
  58333. ><P
  58334. >      
  58335.     </P
  58336. ></DD
  58337. ><DT
  58338. ><TT
  58339. CLASS="constant"
  58340. ><B
  58341. >CPDF_PL_2RCOLUMN</B
  58342. ></TT
  58343.     (<A
  58344. HREF="#language.types.integer"
  58345. ><B
  58346. CLASS="type"
  58347. >integer</B
  58348. ></A
  58349. >)</DT
  58350. ><DD
  58351. ><P
  58352. >      
  58353.     </P
  58354. ></DD
  58355. ></DL
  58356. ></DIV
  58357. ></DIV
  58358. ><DIV
  58359. CLASS="section"
  58360. ><HR><H1
  58361. CLASS="section"
  58362. ><A
  58363. NAME="cpdf.examples"
  58364. ></A
  58365. >P°φklady</H1
  58366. ><TABLE
  58367. WIDTH="100%"
  58368. BORDER="0"
  58369. CELLPADDING="0"
  58370. CELLSPACING="0"
  58371. CLASS="EXAMPLE"
  58372. ><TR
  58373. ><TD
  58374. ><DIV
  58375. CLASS="example"
  58376. ><A
  58377. NAME="AEN11904"
  58378. ></A
  58379. ><P
  58380. ><B
  58381. >P°φklad 1. Simple ClibPDF Example</B
  58382. ></P
  58383. ><TABLE
  58384. BORDER="0"
  58385. BGCOLOR="#E0E0E0"
  58386. CELLPADDING="5"
  58387. ><TR
  58388. ><TD
  58389. ><PRE
  58390. CLASS="php"
  58391. ><?php
  58392. $cpdf = cpdf_open(0);
  58393. cpdf_page_init($cpdf, 1, 0, 595, 842, 1.0);
  58394. cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1");
  58395. cpdf_begin_text($cpdf);
  58396. cpdf_set_font($cpdf, "Times-Roman", 30, "WinAnsiEncoding");
  58397. cpdf_set_text_rendering($cpdf, 1);
  58398. cpdf_text($cpdf, "Times Roman outlined", 50, 750);
  58399. cpdf_end_text($cpdf);
  58400. cpdf_moveto($cpdf, 50, 740);
  58401. cpdf_lineto($cpdf, 330, 740);
  58402. cpdf_stroke($cpdf);
  58403. cpdf_finalize($cpdf);
  58404. Header("Content-type: application/pdf");
  58405. cpdf_output_buffer($cpdf);
  58406. cpdf_close($cpdf);
  58407. ?></PRE
  58408. ></TD
  58409. ></TR
  58410. ></TABLE
  58411. ></DIV
  58412. ></TD
  58413. ></TR
  58414. ></TABLE
  58415. ><P
  58416. >      The pdflib distribution contains a more complex example which creates a
  58417.      series of pages with an analog clock. Here is that example converted
  58418.      into PHP using the ClibPDF extension:
  58419.     </P
  58420. ><TABLE
  58421. WIDTH="100%"
  58422. BORDER="0"
  58423. CELLPADDING="0"
  58424. CELLSPACING="0"
  58425. CLASS="EXAMPLE"
  58426. ><TR
  58427. ><TD
  58428. ><DIV
  58429. CLASS="example"
  58430. ><A
  58431. NAME="AEN11908"
  58432. ></A
  58433. ><P
  58434. ><B
  58435. >P°φklad 2. pdfclock example from pdflib 2.0 distribution</B
  58436. ></P
  58437. ><TABLE
  58438. BORDER="0"
  58439. BGCOLOR="#E0E0E0"
  58440. CELLPADDING="5"
  58441. ><TR
  58442. ><TD
  58443. ><PRE
  58444. CLASS="php"
  58445. ><?php
  58446. $radius = 200;
  58447. $margin = 20;
  58448. $pagecount = 40;
  58449.  
  58450. $pdf = cpdf_open(0);
  58451. cpdf_set_creator($pdf, "pdf_clock.php3");
  58452. cpdf_set_title($pdf, "Analog Clock");
  58453.   
  58454. while ($pagecount-- > 0) {
  58455.   cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0);
  58456.   
  58457.   cpdf_set_page_animation($pdf, 4, 0.5, 0, 0, 0);  /* wipe */
  58458.   
  58459.   cpdf_translate($pdf, $radius + $margin, $radius + $margin);
  58460.   cpdf_save($pdf);
  58461.   cpdf_setrgbcolor($pdf, 0.0, 0.0, 1.0);
  58462.   
  58463.   /* minute strokes */
  58464.   cpdf_setlinewidth($pdf, 2.0);
  58465.   for ($alpha = 0; $alpha < 360; $alpha += 6) {
  58466.     cpdf_rotate($pdf, 6.0);
  58467.     cpdf_moveto($pdf, $radius, 0.0);
  58468.     cpdf_lineto($pdf, $radius-$margin/3, 0.0);
  58469.     cpdf_stroke($pdf);
  58470.   }
  58471.   
  58472.   cpdf_restore($pdf);
  58473.   cpdf_save($pdf);
  58474.  
  58475.   /* 5 minute strokes */
  58476.   cpdf_setlinewidth($pdf, 3.0);
  58477.   for ($alpha = 0; $alpha < 360; $alpha += 30) {
  58478.     cpdf_rotate($pdf, 30.0);
  58479.     cpdf_moveto($pdf, $radius, 0.0);
  58480.     cpdf_lineto($pdf, $radius-$margin, 0.0);
  58481.     cpdf_stroke($pdf);
  58482.   }
  58483.  
  58484.   $ltime = getdate();
  58485.  
  58486.   /* draw hour hand */
  58487.   cpdf_save($pdf);
  58488.   cpdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0);
  58489.   cpdf_moveto($pdf, -$radius/10, -$radius/20);
  58490.   cpdf_lineto($pdf, $radius/2, 0.0);
  58491.   cpdf_lineto($pdf, -$radius/10, $radius/20);
  58492.   cpdf_closepath($pdf);
  58493.   cpdf_fill($pdf);
  58494.   cpdf_restore($pdf);
  58495.  
  58496.   /* draw minute hand */
  58497.   cpdf_save($pdf);
  58498.   cpdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0);
  58499.   cpdf_moveto($pdf, -$radius/10, -$radius/20);
  58500.   cpdf_lineto($pdf, $radius * 0.8, 0.0);
  58501.   cpdf_lineto($pdf, -$radius/10, $radius/20);
  58502.   cpdf_closepath($pdf);
  58503.   cpdf_fill($pdf);
  58504.   cpdf_restore($pdf);
  58505.  
  58506.   /* draw second hand */
  58507.   cpdf_setrgbcolor($pdf, 1.0, 0.0, 0.0);
  58508.   cpdf_setlinewidth($pdf, 2);
  58509.   cpdf_save($pdf);
  58510.   cpdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0));
  58511.   cpdf_moveto($pdf, -$radius/5, 0.0);
  58512.   cpdf_lineto($pdf, $radius, 0.0);
  58513.   cpdf_stroke($pdf);
  58514.   cpdf_restore($pdf);
  58515.  
  58516.   /* draw little circle at center */
  58517.   cpdf_circle($pdf, 0, 0, $radius/30);
  58518.   cpdf_fill($pdf);
  58519.  
  58520.   cpdf_restore($pdf);
  58521.  
  58522.   cpdf_finalize_page($pdf, $pagecount+1);
  58523. }
  58524.  
  58525. cpdf_finalize($pdf);
  58526. Header("Content-type: application/pdf");
  58527. cpdf_output_buffer($pdf);
  58528. cpdf_close($pdf);
  58529. ?></PRE
  58530. ></TD
  58531. ></TR
  58532. ></TABLE
  58533. ></DIV
  58534. ></TD
  58535. ></TR
  58536. ></TABLE
  58537. ></DIV
  58538. ><DIV
  58539. CLASS="section"
  58540. ><HR><H1
  58541. CLASS="section"
  58542. ><A
  58543. NAME="cpdf.seealso"
  58544. ></A
  58545. >Viz takΘ</H1
  58546. ><P
  58547. >      See also the <A
  58548. HREF="#ref.pdf"
  58549. >PDFlib</A
  58550. >
  58551.      extension documentation.
  58552.     </P
  58553. ></DIV
  58554. ></DIV
  58555. ><DIV
  58556. CLASS="TOC"
  58557. ><DL
  58558. ><DT
  58559. ><B
  58560. >Obsah</B
  58561. ></DT
  58562. ><DT
  58563. ><A
  58564. HREF="#function.cpdf-add-annotation"
  58565. >cpdf_add_annotation</A
  58566. > -- Adds annotation</DT
  58567. ><DT
  58568. ><A
  58569. HREF="#function.cpdf-add-outline"
  58570. >cpdf_add_outline</A
  58571. > -- Adds bookmark for current page</DT
  58572. ><DT
  58573. ><A
  58574. HREF="#function.cpdf-arc"
  58575. >cpdf_arc</A
  58576. > -- Draws an arc</DT
  58577. ><DT
  58578. ><A
  58579. HREF="#function.cpdf-begin-text"
  58580. >cpdf_begin_text</A
  58581. > -- Starts text section</DT
  58582. ><DT
  58583. ><A
  58584. HREF="#function.cpdf-circle"
  58585. >cpdf_circle</A
  58586. > -- Draw a circle</DT
  58587. ><DT
  58588. ><A
  58589. HREF="#function.cpdf-clip"
  58590. >cpdf_clip</A
  58591. > -- Clips to current path</DT
  58592. ><DT
  58593. ><A
  58594. HREF="#function.cpdf-close"
  58595. >cpdf_close</A
  58596. > -- Closes the pdf document</DT
  58597. ><DT
  58598. ><A
  58599. HREF="#function.cpdf-closepath-fill-stroke"
  58600. >cpdf_closepath_fill_stroke</A
  58601. > -- Close, fill and stroke current path</DT
  58602. ><DT
  58603. ><A
  58604. HREF="#function.cpdf-closepath-stroke"
  58605. >cpdf_closepath_stroke</A
  58606. > -- Close path and draw line along path</DT
  58607. ><DT
  58608. ><A
  58609. HREF="#function.cpdf-closepath"
  58610. >cpdf_closepath</A
  58611. > -- Close path</DT
  58612. ><DT
  58613. ><A
  58614. HREF="#function.cpdf-continue-text"
  58615. >cpdf_continue_text</A
  58616. > -- Output text in next line</DT
  58617. ><DT
  58618. ><A
  58619. HREF="#function.cpdf-curveto"
  58620. >cpdf_curveto</A
  58621. > -- Draws a curve</DT
  58622. ><DT
  58623. ><A
  58624. HREF="#function.cpdf-end-text"
  58625. >cpdf_end_text</A
  58626. > -- Ends text section</DT
  58627. ><DT
  58628. ><A
  58629. HREF="#function.cpdf-fill-stroke"
  58630. >cpdf_fill_stroke</A
  58631. > -- Fill and stroke current path</DT
  58632. ><DT
  58633. ><A
  58634. HREF="#function.cpdf-fill"
  58635. >cpdf_fill</A
  58636. > -- Fill current path</DT
  58637. ><DT
  58638. ><A
  58639. HREF="#function.cpdf-finalize-page"
  58640. >cpdf_finalize_page</A
  58641. > -- Ends page</DT
  58642. ><DT
  58643. ><A
  58644. HREF="#function.cpdf-finalize"
  58645. >cpdf_finalize</A
  58646. > -- Ends document</DT
  58647. ><DT
  58648. ><A
  58649. HREF="#function.cpdf-global-set-document-limits"
  58650. >cpdf_global_set_document_limits</A
  58651. > -- Sets document limits for any pdf document</DT
  58652. ><DT
  58653. ><A
  58654. HREF="#function.cpdf-import-jpeg"
  58655. >cpdf_import_jpeg</A
  58656. > -- Opens a JPEG image</DT
  58657. ><DT
  58658. ><A
  58659. HREF="#function.cpdf-lineto"
  58660. >cpdf_lineto</A
  58661. > -- Draws a line</DT
  58662. ><DT
  58663. ><A
  58664. HREF="#function.cpdf-moveto"
  58665. >cpdf_moveto</A
  58666. > -- Sets current point</DT
  58667. ><DT
  58668. ><A
  58669. HREF="#function.cpdf-newpath"
  58670. >cpdf_newpath</A
  58671. > -- Starts a new path</DT
  58672. ><DT
  58673. ><A
  58674. HREF="#function.cpdf-open"
  58675. >cpdf_open</A
  58676. > -- Opens a new pdf document</DT
  58677. ><DT
  58678. ><A
  58679. HREF="#function.cpdf-output-buffer"
  58680. >cpdf_output_buffer</A
  58681. > -- Outputs the pdf document in memory buffer</DT
  58682. ><DT
  58683. ><A
  58684. HREF="#function.cpdf-page-init"
  58685. >cpdf_page_init</A
  58686. > -- Starts new page</DT
  58687. ><DT
  58688. ><A
  58689. HREF="#function.cpdf-place-inline-image"
  58690. >cpdf_place_inline_image</A
  58691. > -- Places an image on the page</DT
  58692. ><DT
  58693. ><A
  58694. HREF="#function.cpdf-rect"
  58695. >cpdf_rect</A
  58696. > -- Draw a rectangle</DT
  58697. ><DT
  58698. ><A
  58699. HREF="#function.cpdf-restore"
  58700. >cpdf_restore</A
  58701. > -- Restores formerly saved environment</DT
  58702. ><DT
  58703. ><A
  58704. HREF="#function.cpdf-rlineto"
  58705. >cpdf_rlineto</A
  58706. > -- Draws a line</DT
  58707. ><DT
  58708. ><A
  58709. HREF="#function.cpdf-rmoveto"
  58710. >cpdf_rmoveto</A
  58711. > -- Sets current point</DT
  58712. ><DT
  58713. ><A
  58714. HREF="#function.cpdf-rotate-text"
  58715. >cpdf_rotate_text</A
  58716. > -- 
  58717.      Sets text rotation angle
  58718.     </DT
  58719. ><DT
  58720. ><A
  58721. HREF="#function.cpdf-rotate"
  58722. >cpdf_rotate</A
  58723. > -- Sets rotation</DT
  58724. ><DT
  58725. ><A
  58726. HREF="#function.cpdf-save-to-file"
  58727. >cpdf_save_to_file</A
  58728. > -- Writes the pdf document into a file</DT
  58729. ><DT
  58730. ><A
  58731. HREF="#function.cpdf-save"
  58732. >cpdf_save</A
  58733. > -- Saves current environment</DT
  58734. ><DT
  58735. ><A
  58736. HREF="#function.cpdf-scale"
  58737. >cpdf_scale</A
  58738. > -- Sets scaling</DT
  58739. ><DT
  58740. ><A
  58741. HREF="#function.cpdf-set-action-url"
  58742. >cpdf_set_action_url</A
  58743. > -- 
  58744.      Sets hyperlink
  58745.     </DT
  58746. ><DT
  58747. ><A
  58748. HREF="#function.cpdf-set-char-spacing"
  58749. >cpdf_set_char_spacing</A
  58750. > -- Sets character spacing</DT
  58751. ><DT
  58752. ><A
  58753. HREF="#function.cpdf-set-creator"
  58754. >cpdf_set_creator</A
  58755. > -- Sets the creator field in the pdf document</DT
  58756. ><DT
  58757. ><A
  58758. HREF="#function.cpdf-set-current-page"
  58759. >cpdf_set_current_page</A
  58760. > -- Sets current page</DT
  58761. ><DT
  58762. ><A
  58763. HREF="#function.cpdf-set-font-directories"
  58764. >cpdf_set_font_directories</A
  58765. > -- 
  58766.      Sets directories to search when using external fonts
  58767.     </DT
  58768. ><DT
  58769. ><A
  58770. HREF="#function.cpdf-set-font-map-file"
  58771. >cpdf_set_font_map_file</A
  58772. > -- 
  58773.      Sets fontname to filename translation map when using external fonts
  58774.     </DT
  58775. ><DT
  58776. ><A
  58777. HREF="#function.cpdf-set-font"
  58778. >cpdf_set_font</A
  58779. > -- Select the current font face and size</DT
  58780. ><DT
  58781. ><A
  58782. HREF="#function.cpdf-set-horiz-scaling"
  58783. >cpdf_set_horiz_scaling</A
  58784. > -- Sets horizontal scaling of text</DT
  58785. ><DT
  58786. ><A
  58787. HREF="#function.cpdf-set-keywords"
  58788. >cpdf_set_keywords</A
  58789. > -- Sets the keywords field of the pdf document</DT
  58790. ><DT
  58791. ><A
  58792. HREF="#function.cpdf-set-leading"
  58793. >cpdf_set_leading</A
  58794. > -- Sets distance between text lines</DT
  58795. ><DT
  58796. ><A
  58797. HREF="#function.cpdf-set-page-animation"
  58798. >cpdf_set_page_animation</A
  58799. > -- Sets duration between pages</DT
  58800. ><DT
  58801. ><A
  58802. HREF="#function.cpdf-set-subject"
  58803. >cpdf_set_subject</A
  58804. > -- Sets the subject field of the pdf document</DT
  58805. ><DT
  58806. ><A
  58807. HREF="#function.cpdf-set-text-matrix"
  58808. >cpdf_set_text_matrix</A
  58809. > -- Sets the text matrix</DT
  58810. ><DT
  58811. ><A
  58812. HREF="#function.cpdf-set-text-pos"
  58813. >cpdf_set_text_pos</A
  58814. > -- Sets text position</DT
  58815. ><DT
  58816. ><A
  58817. HREF="#function.cpdf-set-text-rendering"
  58818. >cpdf_set_text_rendering</A
  58819. > -- Determines how text is rendered</DT
  58820. ><DT
  58821. ><A
  58822. HREF="#function.cpdf-set-text-rise"
  58823. >cpdf_set_text_rise</A
  58824. > -- Sets the text rise</DT
  58825. ><DT
  58826. ><A
  58827. HREF="#function.cpdf-set-title"
  58828. >cpdf_set_title</A
  58829. > -- Sets the title field of the pdf document</DT
  58830. ><DT
  58831. ><A
  58832. HREF="#function.cpdf-set-viewer-preferences"
  58833. >cpdf_set_viewer_preferences</A
  58834. > -- 
  58835.      How to show the document in the viewer
  58836.     </DT
  58837. ><DT
  58838. ><A
  58839. HREF="#function.cpdf-set-word-spacing"
  58840. >cpdf_set_word_spacing</A
  58841. > -- Sets spacing between words</DT
  58842. ><DT
  58843. ><A
  58844. HREF="#function.cpdf-setdash"
  58845. >cpdf_setdash</A
  58846. > -- Sets dash pattern</DT
  58847. ><DT
  58848. ><A
  58849. HREF="#function.cpdf-setflat"
  58850. >cpdf_setflat</A
  58851. > -- Sets flatness</DT
  58852. ><DT
  58853. ><A
  58854. HREF="#function.cpdf-setgray-fill"
  58855. >cpdf_setgray_fill</A
  58856. > -- Sets filling color to gray value</DT
  58857. ><DT
  58858. ><A
  58859. HREF="#function.cpdf-setgray-stroke"
  58860. >cpdf_setgray_stroke</A
  58861. > -- Sets drawing color to gray value</DT
  58862. ><DT
  58863. ><A
  58864. HREF="#function.cpdf-setgray"
  58865. >cpdf_setgray</A
  58866. > -- Sets drawing and filling color to gray value</DT
  58867. ><DT
  58868. ><A
  58869. HREF="#function.cpdf-setlinecap"
  58870. >cpdf_setlinecap</A
  58871. > -- Sets linecap parameter</DT
  58872. ><DT
  58873. ><A
  58874. HREF="#function.cpdf-setlinejoin"
  58875. >cpdf_setlinejoin</A
  58876. > -- Sets linejoin parameter</DT
  58877. ><DT
  58878. ><A
  58879. HREF="#function.cpdf-setlinewidth"
  58880. >cpdf_setlinewidth</A
  58881. > -- Sets line width</DT
  58882. ><DT
  58883. ><A
  58884. HREF="#function.cpdf-setmiterlimit"
  58885. >cpdf_setmiterlimit</A
  58886. > -- Sets miter limit</DT
  58887. ><DT
  58888. ><A
  58889. HREF="#function.cpdf-setrgbcolor-fill"
  58890. >cpdf_setrgbcolor_fill</A
  58891. > -- Sets filling color to rgb color value</DT
  58892. ><DT
  58893. ><A
  58894. HREF="#function.cpdf-setrgbcolor-stroke"
  58895. >cpdf_setrgbcolor_stroke</A
  58896. > -- Sets drawing color to rgb color value</DT
  58897. ><DT
  58898. ><A
  58899. HREF="#function.cpdf-setrgbcolor"
  58900. >cpdf_setrgbcolor</A
  58901. > -- Sets drawing and filling color to rgb color value</DT
  58902. ><DT
  58903. ><A
  58904. HREF="#function.cpdf-show-xy"
  58905. >cpdf_show_xy</A
  58906. > -- Output text at position</DT
  58907. ><DT
  58908. ><A
  58909. HREF="#function.cpdf-show"
  58910. >cpdf_show</A
  58911. > -- Output text at current position</DT
  58912. ><DT
  58913. ><A
  58914. HREF="#function.cpdf-stringwidth"
  58915. >cpdf_stringwidth</A
  58916. > -- Returns width of text in current font</DT
  58917. ><DT
  58918. ><A
  58919. HREF="#function.cpdf-stroke"
  58920. >cpdf_stroke</A
  58921. > -- Draw line along path</DT
  58922. ><DT
  58923. ><A
  58924. HREF="#function.cpdf-text"
  58925. >cpdf_text</A
  58926. > -- Output text with parameters</DT
  58927. ><DT
  58928. ><A
  58929. HREF="#function.cpdf-translate"
  58930. >cpdf_translate</A
  58931. > -- Sets origin of coordinate system</DT
  58932. ></DL
  58933. ></DIV
  58934. ></DIV
  58935. ><H1
  58936. ><A
  58937. NAME="function.cpdf-add-annotation"
  58938. ></A
  58939. >cpdf_add_annotation</H1
  58940. ><DIV
  58941. CLASS="refnamediv"
  58942. ><A
  58943. NAME="AEN11916"
  58944. ></A
  58945. ><P
  58946. >    (PHP 3>= 3.0.12, PHP 4 )</P
  58947. >cpdf_add_annotation -- Adds annotation</DIV
  58948. ><DIV
  58949. CLASS="refsect1"
  58950. ><A
  58951. NAME="AEN11919"
  58952. ></A
  58953. ><H2
  58954. >Description</H2
  58955. >bool <B
  58956. CLASS="methodname"
  58957. >cpdf_add_annotation</B
  58958. > ( int pdf_document, float llx, float lly, float urx, float ury, string title, string content [, int mode])<BR
  58959. ></BR
  58960. ><P
  58961. >      The <B
  58962. CLASS="function"
  58963. >cpdf_add_annotation()</B
  58964. > adds a note with the
  58965.      lower left corner at (<TT
  58966. CLASS="parameter"
  58967. ><I
  58968. >llx</I
  58969. ></TT
  58970. >,
  58971.      <TT
  58972. CLASS="parameter"
  58973. ><I
  58974. >lly</I
  58975. ></TT
  58976. >) and the upper right corner at
  58977.      (<TT
  58978. CLASS="parameter"
  58979. ><I
  58980. >urx</I
  58981. ></TT
  58982. >, <TT
  58983. CLASS="parameter"
  58984. ><I
  58985. >ury</I
  58986. ></TT
  58987. >).
  58988.      Vracφ <TT
  58989. CLASS="constant"
  58990. ><B
  58991. >TRUE</B
  58992. ></TT
  58993. > p°i ·sp∞chu, <TT
  58994. CLASS="constant"
  58995. ><B
  58996. >FALSE</B
  58997. ></TT
  58998. > p°i selhßnφ.
  58999.     </P
  59000. ><P
  59001. >Nepovinn² parametr <TT
  59002. CLASS="parameter"
  59003. ><I
  59004. >mode</I
  59005. ></TT
  59006. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  59007. ></DIV
  59008. ><H1
  59009. ><A
  59010. NAME="function.cpdf-add-outline"
  59011. ></A
  59012. >cpdf_add_outline</H1
  59013. ><DIV
  59014. CLASS="refnamediv"
  59015. ><A
  59016. NAME="AEN11959"
  59017. ></A
  59018. ><P
  59019. >    (PHP 3>= 3.0.9, PHP 4 )</P
  59020. >cpdf_add_outline -- Adds bookmark for current page</DIV
  59021. ><DIV
  59022. CLASS="refsect1"
  59023. ><A
  59024. NAME="AEN11962"
  59025. ></A
  59026. ><H2
  59027. >Description</H2
  59028. >int <B
  59029. CLASS="methodname"
  59030. >cpdf_add_outline</B
  59031. > ( int pdf_document, int lastoutline, int sublevel, int open, int pagenr, string text)<BR
  59032. ></BR
  59033. ><P
  59034. >      The <B
  59035. CLASS="function"
  59036. >cpdf_add_outline()</B
  59037. > function adds a bookmark
  59038.      with text <TT
  59039. CLASS="parameter"
  59040. ><I
  59041. >text</I
  59042. ></TT
  59043. > that points to the current page.
  59044.     </P
  59045. ><P
  59046. >      <TABLE
  59047. WIDTH="100%"
  59048. BORDER="0"
  59049. CELLPADDING="0"
  59050. CELLSPACING="0"
  59051. CLASS="EXAMPLE"
  59052. ><TR
  59053. ><TD
  59054. ><DIV
  59055. CLASS="example"
  59056. ><A
  59057. NAME="AEN11989"
  59058. ></A
  59059. ><P
  59060. ><B
  59061. >P°φklad 1. Adding a page outline</B
  59062. ></P
  59063. ><TABLE
  59064. BORDER="0"
  59065. BGCOLOR="#E0E0E0"
  59066. CELLPADDING="5"
  59067. ><TR
  59068. ><TD
  59069. ><PRE
  59070. CLASS="php"
  59071. ><?php
  59072. $cpdf = cpdf_open(0);
  59073. cpdf_page_init($cpdf, 1, 0, 595, 842);
  59074. cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1");
  59075. // ...
  59076. // some drawing
  59077. // ...
  59078. cpdf_finalize($cpdf);
  59079. Header("Content-type: application/pdf");
  59080. cpdf_output_buffer($cpdf);
  59081. cpdf_close($cpdf);
  59082. ?></PRE
  59083. ></TD
  59084. ></TR
  59085. ></TABLE
  59086. ></DIV
  59087. ></TD
  59088. ></TR
  59089. ></TABLE
  59090. >
  59091.     </P
  59092. ></DIV
  59093. ><H1
  59094. ><A
  59095. NAME="function.cpdf-arc"
  59096. ></A
  59097. >cpdf_arc</H1
  59098. ><DIV
  59099. CLASS="refnamediv"
  59100. ><A
  59101. NAME="AEN11993"
  59102. ></A
  59103. ><P
  59104. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59105. >cpdf_arc -- Draws an arc</DIV
  59106. ><DIV
  59107. CLASS="refsect1"
  59108. ><A
  59109. NAME="AEN11996"
  59110. ></A
  59111. ><H2
  59112. >Description</H2
  59113. >bool <B
  59114. CLASS="methodname"
  59115. >cpdf_arc</B
  59116. > ( int pdf_document, float x-coor, float y-coor, float radius, float start, float end [, int mode])<BR
  59117. ></BR
  59118. ><P
  59119. >      The <B
  59120. CLASS="function"
  59121. >cpdf_arc()</B
  59122. > function draws an arc with
  59123.      center at point 
  59124.      (<TT
  59125. CLASS="parameter"
  59126. ><I
  59127. >x-coor</I
  59128. ></TT
  59129. >, <TT
  59130. CLASS="parameter"
  59131. ><I
  59132. >y-coor</I
  59133. ></TT
  59134. >)
  59135.      and radius <TT
  59136. CLASS="parameter"
  59137. ><I
  59138. >radius</I
  59139. ></TT
  59140. >, starting at angle
  59141.      <TT
  59142. CLASS="parameter"
  59143. ><I
  59144. >start</I
  59145. ></TT
  59146. > and ending at angle
  59147.      <TT
  59148. CLASS="parameter"
  59149. ><I
  59150. >end</I
  59151. ></TT
  59152. >. Vracφ <TT
  59153. CLASS="constant"
  59154. ><B
  59155. >TRUE</B
  59156. ></TT
  59157. > p°i ·sp∞chu, <TT
  59158. CLASS="constant"
  59159. ><B
  59160. >FALSE</B
  59161. ></TT
  59162. > p°i selhßnφ.
  59163.     </P
  59164. ><P
  59165. >Nepovinn² parametr <TT
  59166. CLASS="parameter"
  59167. ><I
  59168. >mode</I
  59169. ></TT
  59170. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  59171. ><P
  59172. >      See also <A
  59173. HREF="#function.cpdf-circle"
  59174. ><B
  59175. CLASS="function"
  59176. >cpdf_circle()</B
  59177. ></A
  59178. >.
  59179.     </P
  59180. ></DIV
  59181. ><H1
  59182. ><A
  59183. NAME="function.cpdf-begin-text"
  59184. ></A
  59185. >cpdf_begin_text</H1
  59186. ><DIV
  59187. CLASS="refnamediv"
  59188. ><A
  59189. NAME="AEN12036"
  59190. ></A
  59191. ><P
  59192. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59193. >cpdf_begin_text -- Starts text section</DIV
  59194. ><DIV
  59195. CLASS="refsect1"
  59196. ><A
  59197. NAME="AEN12039"
  59198. ></A
  59199. ><H2
  59200. >Description</H2
  59201. >bool <B
  59202. CLASS="methodname"
  59203. >cpdf_begin_text</B
  59204. > ( int pdf_document)<BR
  59205. ></BR
  59206. ><P
  59207. >      The <B
  59208. CLASS="function"
  59209. >cpdf_begin_text()</B
  59210. > function starts a text
  59211.      section. Vracφ <TT
  59212. CLASS="constant"
  59213. ><B
  59214. >TRUE</B
  59215. ></TT
  59216. > p°i ·sp∞chu, <TT
  59217. CLASS="constant"
  59218. ><B
  59219. >FALSE</B
  59220. ></TT
  59221. > p°i selhßnφ.
  59222.      The created text section must be ended with 
  59223.      <A
  59224. HREF="#function.cpdf-end-text"
  59225. ><B
  59226. CLASS="function"
  59227. >cpdf_end_text()</B
  59228. ></A
  59229. >.
  59230.     </P
  59231. ><P
  59232. >      <TABLE
  59233. WIDTH="100%"
  59234. BORDER="0"
  59235. CELLPADDING="0"
  59236. CELLSPACING="0"
  59237. CLASS="EXAMPLE"
  59238. ><TR
  59239. ><TD
  59240. ><DIV
  59241. CLASS="example"
  59242. ><A
  59243. NAME="AEN12053"
  59244. ></A
  59245. ><P
  59246. ><B
  59247. >P°φklad 1. Text output</B
  59248. ></P
  59249. ><TABLE
  59250. BORDER="0"
  59251. BGCOLOR="#E0E0E0"
  59252. CELLPADDING="5"
  59253. ><TR
  59254. ><TD
  59255. ><PRE
  59256. CLASS="php"
  59257. ><?php
  59258. cpdf_begin_text($pdf);
  59259. cpdf_set_font($pdf, 16, "Helvetica", "WinAnsiEncoding");
  59260. cpdf_text($pdf, 100, 100, "Some text");
  59261. cpdf_end_text($pdf)
  59262. ?></PRE
  59263. ></TD
  59264. ></TR
  59265. ></TABLE
  59266. ></DIV
  59267. ></TD
  59268. ></TR
  59269. ></TABLE
  59270. >
  59271.     </P
  59272. ><P
  59273. >      See also <A
  59274. HREF="#function.cpdf-end-text"
  59275. ><B
  59276. CLASS="function"
  59277. >cpdf_end_text()</B
  59278. ></A
  59279. >.
  59280.     </P
  59281. ></DIV
  59282. ><H1
  59283. ><A
  59284. NAME="function.cpdf-circle"
  59285. ></A
  59286. >cpdf_circle</H1
  59287. ><DIV
  59288. CLASS="refnamediv"
  59289. ><A
  59290. NAME="AEN12059"
  59291. ></A
  59292. ><P
  59293. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59294. >cpdf_circle -- Draw a circle</DIV
  59295. ><DIV
  59296. CLASS="refsect1"
  59297. ><A
  59298. NAME="AEN12062"
  59299. ></A
  59300. ><H2
  59301. >Description</H2
  59302. >bool <B
  59303. CLASS="methodname"
  59304. >cpdf_circle</B
  59305. > ( int pdf_document, float x-coor, float y-coor, float radius [, int mode])<BR
  59306. ></BR
  59307. ><P
  59308. >      The <B
  59309. CLASS="function"
  59310. >cpdf_circle()</B
  59311. > function draws a circle with
  59312.      center at point 
  59313.      (<TT
  59314. CLASS="parameter"
  59315. ><I
  59316. >x-coor</I
  59317. ></TT
  59318. >, <TT
  59319. CLASS="parameter"
  59320. ><I
  59321. >y-coor</I
  59322. ></TT
  59323. >)
  59324.      and radius <TT
  59325. CLASS="parameter"
  59326. ><I
  59327. >radius</I
  59328. ></TT
  59329. >. Vracφ <TT
  59330. CLASS="constant"
  59331. ><B
  59332. >TRUE</B
  59333. ></TT
  59334. > p°i ·sp∞chu, <TT
  59335. CLASS="constant"
  59336. ><B
  59337. >FALSE</B
  59338. ></TT
  59339. > p°i selhßnφ.
  59340.     </P
  59341. ><P
  59342. >Nepovinn² parametr <TT
  59343. CLASS="parameter"
  59344. ><I
  59345. >mode</I
  59346. ></TT
  59347. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  59348. ><P
  59349. >      See also <A
  59350. HREF="#function.cpdf-arc"
  59351. ><B
  59352. CLASS="function"
  59353. >cpdf_arc()</B
  59354. ></A
  59355. >.
  59356.     </P
  59357. ></DIV
  59358. ><H1
  59359. ><A
  59360. NAME="function.cpdf-clip"
  59361. ></A
  59362. >cpdf_clip</H1
  59363. ><DIV
  59364. CLASS="refnamediv"
  59365. ><A
  59366. NAME="AEN12094"
  59367. ></A
  59368. ><P
  59369. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59370. >cpdf_clip -- Clips to current path</DIV
  59371. ><DIV
  59372. CLASS="refsect1"
  59373. ><A
  59374. NAME="AEN12097"
  59375. ></A
  59376. ><H2
  59377. >Description</H2
  59378. >bool <B
  59379. CLASS="methodname"
  59380. >cpdf_clip</B
  59381. > ( int pdf_document)<BR
  59382. ></BR
  59383. ><P
  59384. >      The <B
  59385. CLASS="function"
  59386. >cpdf_clip()</B
  59387. > function clips all drawing
  59388.      to the current path. Vracφ <TT
  59389. CLASS="constant"
  59390. ><B
  59391. >TRUE</B
  59392. ></TT
  59393. > p°i ·sp∞chu, <TT
  59394. CLASS="constant"
  59395. ><B
  59396. >FALSE</B
  59397. ></TT
  59398. > p°i selhßnφ.
  59399.     </P
  59400. ></DIV
  59401. ><H1
  59402. ><A
  59403. NAME="function.cpdf-close"
  59404. ></A
  59405. >cpdf_close</H1
  59406. ><DIV
  59407. CLASS="refnamediv"
  59408. ><A
  59409. NAME="AEN12110"
  59410. ></A
  59411. ><P
  59412. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59413. >cpdf_close -- Closes the pdf document</DIV
  59414. ><DIV
  59415. CLASS="refsect1"
  59416. ><A
  59417. NAME="AEN12113"
  59418. ></A
  59419. ><H2
  59420. >Description</H2
  59421. >bool <B
  59422. CLASS="methodname"
  59423. >cpdf_close</B
  59424. > ( int pdf_document)<BR
  59425. ></BR
  59426. ><P
  59427. >      The <B
  59428. CLASS="function"
  59429. >cpdf_close()</B
  59430. > function closes the pdf document.
  59431.      Vracφ <TT
  59432. CLASS="constant"
  59433. ><B
  59434. >TRUE</B
  59435. ></TT
  59436. > p°i ·sp∞chu, <TT
  59437. CLASS="constant"
  59438. ><B
  59439. >FALSE</B
  59440. ></TT
  59441. > p°i selhßnφ. This should be the last function even after
  59442.      <A
  59443. HREF="#function.cpdf-finalize"
  59444. ><B
  59445. CLASS="function"
  59446. >cpdf_finalize()</B
  59447. ></A
  59448. >, <A
  59449. HREF="#function.cpdf-output-buffer"
  59450. ><B
  59451. CLASS="function"
  59452. >cpdf_output_buffer()</B
  59453. ></A
  59454. >
  59455.      and <A
  59456. HREF="#function.cpdf-save-to-file"
  59457. ><B
  59458. CLASS="function"
  59459. >cpdf_save_to_file()</B
  59460. ></A
  59461. >.
  59462.     </P
  59463. ><P
  59464. >      See also <A
  59465. HREF="#function.cpdf-open"
  59466. ><B
  59467. CLASS="function"
  59468. >cpdf_open()</B
  59469. ></A
  59470. >.
  59471.     </P
  59472. ></DIV
  59473. ><H1
  59474. ><A
  59475. NAME="function.cpdf-closepath-fill-stroke"
  59476. ></A
  59477. >cpdf_closepath_fill_stroke</H1
  59478. ><DIV
  59479. CLASS="refnamediv"
  59480. ><A
  59481. NAME="AEN12131"
  59482. ></A
  59483. ><P
  59484. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59485. >cpdf_closepath_fill_stroke -- Close, fill and stroke current path</DIV
  59486. ><DIV
  59487. CLASS="refsect1"
  59488. ><A
  59489. NAME="AEN12134"
  59490. ></A
  59491. ><H2
  59492. >Description</H2
  59493. >bool <B
  59494. CLASS="methodname"
  59495. >cpdf_closepath_fill_stroke</B
  59496. > ( int pdf_document)<BR
  59497. ></BR
  59498. ><P
  59499. >      The <B
  59500. CLASS="function"
  59501. >cpdf_closepath_fill_stroke()</B
  59502. > function closes,
  59503.      fills the interior of the current path with the current fill color and
  59504.      draws current path. Vracφ <TT
  59505. CLASS="constant"
  59506. ><B
  59507. >TRUE</B
  59508. ></TT
  59509. > p°i ·sp∞chu, <TT
  59510. CLASS="constant"
  59511. ><B
  59512. >FALSE</B
  59513. ></TT
  59514. > p°i selhßnφ.
  59515.     </P
  59516. ><P
  59517. >      See also <A
  59518. HREF="#function.cpdf-closepath"
  59519. ><B
  59520. CLASS="function"
  59521. >cpdf_closepath()</B
  59522. ></A
  59523. >,
  59524.      <A
  59525. HREF="#function.cpdf-stroke"
  59526. ><B
  59527. CLASS="function"
  59528. >cpdf_stroke()</B
  59529. ></A
  59530. >,
  59531.      <A
  59532. HREF="#function.cpdf-fill"
  59533. ><B
  59534. CLASS="function"
  59535. >cpdf_fill()</B
  59536. ></A
  59537. >,
  59538.      <A
  59539. HREF="#function.cpdf-setgray-fill"
  59540. ><B
  59541. CLASS="function"
  59542. >cpdf_setgray_fill()</B
  59543. ></A
  59544. >,
  59545.      <A
  59546. HREF="#function.cpdf-setgray"
  59547. ><B
  59548. CLASS="function"
  59549. >cpdf_setgray()</B
  59550. ></A
  59551. >,
  59552.      <A
  59553. HREF="#function.cpdf-setrgbcolor-fill"
  59554. ><B
  59555. CLASS="function"
  59556. >cpdf_setrgbcolor_fill()</B
  59557. ></A
  59558. > and
  59559.      <A
  59560. HREF="#function.cpdf-setrgbcolor"
  59561. ><B
  59562. CLASS="function"
  59563. >cpdf_setrgbcolor()</B
  59564. ></A
  59565. >.
  59566.     </P
  59567. ></DIV
  59568. ><H1
  59569. ><A
  59570. NAME="function.cpdf-closepath-stroke"
  59571. ></A
  59572. >cpdf_closepath_stroke</H1
  59573. ><DIV
  59574. CLASS="refnamediv"
  59575. ><A
  59576. NAME="AEN12155"
  59577. ></A
  59578. ><P
  59579. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59580. >cpdf_closepath_stroke -- Close path and draw line along path</DIV
  59581. ><DIV
  59582. CLASS="refsect1"
  59583. ><A
  59584. NAME="AEN12158"
  59585. ></A
  59586. ><H2
  59587. >Description</H2
  59588. >bool <B
  59589. CLASS="methodname"
  59590. >cpdf_closepath_stroke</B
  59591. > ( int pdf_document)<BR
  59592. ></BR
  59593. ><P
  59594. >      The <B
  59595. CLASS="function"
  59596. >cpdf_closepath_stroke()</B
  59597. > function is a
  59598.      combination of <A
  59599. HREF="#function.cpdf-closepath"
  59600. ><B
  59601. CLASS="function"
  59602. >cpdf_closepath()</B
  59603. ></A
  59604. > and
  59605.      <A
  59606. HREF="#function.cpdf-stroke"
  59607. ><B
  59608. CLASS="function"
  59609. >cpdf_stroke()</B
  59610. ></A
  59611. >. Then clears the path.
  59612.      Vracφ <TT
  59613. CLASS="constant"
  59614. ><B
  59615. >TRUE</B
  59616. ></TT
  59617. > p°i ·sp∞chu, <TT
  59618. CLASS="constant"
  59619. ><B
  59620. >FALSE</B
  59621. ></TT
  59622. > p°i selhßnφ.
  59623.     </P
  59624. ><P
  59625. >      See also <A
  59626. HREF="#function.cpdf-closepath"
  59627. ><B
  59628. CLASS="function"
  59629. >cpdf_closepath()</B
  59630. ></A
  59631. > and
  59632.      <A
  59633. HREF="#function.cpdf-stroke"
  59634. ><B
  59635. CLASS="function"
  59636. >cpdf_stroke()</B
  59637. ></A
  59638. >.
  59639.     </P
  59640. ></DIV
  59641. ><H1
  59642. ><A
  59643. NAME="function.cpdf-closepath"
  59644. ></A
  59645. >cpdf_closepath</H1
  59646. ><DIV
  59647. CLASS="refnamediv"
  59648. ><A
  59649. NAME="AEN12176"
  59650. ></A
  59651. ><P
  59652. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59653. >cpdf_closepath -- Close path</DIV
  59654. ><DIV
  59655. CLASS="refsect1"
  59656. ><A
  59657. NAME="AEN12179"
  59658. ></A
  59659. ><H2
  59660. >Description</H2
  59661. >bool <B
  59662. CLASS="methodname"
  59663. >cpdf_closepath</B
  59664. > ( int pdf_document)<BR
  59665. ></BR
  59666. ><P
  59667. >      The <B
  59668. CLASS="function"
  59669. >cpdf_closepath()</B
  59670. > function closes the
  59671.      current path. Vracφ <TT
  59672. CLASS="constant"
  59673. ><B
  59674. >TRUE</B
  59675. ></TT
  59676. > p°i ·sp∞chu, <TT
  59677. CLASS="constant"
  59678. ><B
  59679. >FALSE</B
  59680. ></TT
  59681. > p°i selhßnφ.
  59682.     </P
  59683. ></DIV
  59684. ><H1
  59685. ><A
  59686. NAME="function.cpdf-continue-text"
  59687. ></A
  59688. >cpdf_continue_text</H1
  59689. ><DIV
  59690. CLASS="refnamediv"
  59691. ><A
  59692. NAME="AEN12192"
  59693. ></A
  59694. ><P
  59695. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59696. >cpdf_continue_text -- Output text in next line</DIV
  59697. ><DIV
  59698. CLASS="refsect1"
  59699. ><A
  59700. NAME="AEN12195"
  59701. ></A
  59702. ><H2
  59703. >Description</H2
  59704. >bool <B
  59705. CLASS="methodname"
  59706. >cpdf_continue_text</B
  59707. > ( int pdf_document, string text)<BR
  59708. ></BR
  59709. ><P
  59710. >      The <B
  59711. CLASS="function"
  59712. >cpdf_continue_text()</B
  59713. > function outputs the
  59714.      string in <TT
  59715. CLASS="parameter"
  59716. ><I
  59717. >text</I
  59718. ></TT
  59719. > in the next line. Vracφ <TT
  59720. CLASS="constant"
  59721. ><B
  59722. >TRUE</B
  59723. ></TT
  59724. > p°i ·sp∞chu, <TT
  59725. CLASS="constant"
  59726. ><B
  59727. >FALSE</B
  59728. ></TT
  59729. > p°i selhßnφ.
  59730.     </P
  59731. ><P
  59732. >      See also <A
  59733. HREF="#function.cpdf-show-xy"
  59734. ><B
  59735. CLASS="function"
  59736. >cpdf_show_xy()</B
  59737. ></A
  59738. >,
  59739.      <A
  59740. HREF="#function.cpdf-text"
  59741. ><B
  59742. CLASS="function"
  59743. >cpdf_text()</B
  59744. ></A
  59745. >,
  59746.      <A
  59747. HREF="#function.cpdf-set-leading"
  59748. ><B
  59749. CLASS="function"
  59750. >cpdf_set_leading()</B
  59751. ></A
  59752. > and
  59753.      <A
  59754. HREF="#function.cpdf-set-text-pos"
  59755. ><B
  59756. CLASS="function"
  59757. >cpdf_set_text_pos()</B
  59758. ></A
  59759. >.
  59760.     </P
  59761. ></DIV
  59762. ><H1
  59763. ><A
  59764. NAME="function.cpdf-curveto"
  59765. ></A
  59766. >cpdf_curveto</H1
  59767. ><DIV
  59768. CLASS="refnamediv"
  59769. ><A
  59770. NAME="AEN12217"
  59771. ></A
  59772. ><P
  59773. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59774. >cpdf_curveto -- Draws a curve</DIV
  59775. ><DIV
  59776. CLASS="refsect1"
  59777. ><A
  59778. NAME="AEN12220"
  59779. ></A
  59780. ><H2
  59781. >Description</H2
  59782. >bool <B
  59783. CLASS="methodname"
  59784. >cpdf_curveto</B
  59785. > ( int pdf_document, float x1, float y1, float x2, float y2, float x3, float y3 [, int mode])<BR
  59786. ></BR
  59787. ><P
  59788. >      The <B
  59789. CLASS="function"
  59790. >cpdf_curveto()</B
  59791. > function draws a Bezier curve
  59792.      from the current point to the point
  59793.      (<TT
  59794. CLASS="parameter"
  59795. ><I
  59796. >x3</I
  59797. ></TT
  59798. >, <TT
  59799. CLASS="parameter"
  59800. ><I
  59801. >y3</I
  59802. ></TT
  59803. >) using
  59804.      (<TT
  59805. CLASS="parameter"
  59806. ><I
  59807. >x1</I
  59808. ></TT
  59809. >, <TT
  59810. CLASS="parameter"
  59811. ><I
  59812. >y1</I
  59813. ></TT
  59814. >) and
  59815.      (<TT
  59816. CLASS="parameter"
  59817. ><I
  59818. >x2</I
  59819. ></TT
  59820. >, <TT
  59821. CLASS="parameter"
  59822. ><I
  59823. >y2</I
  59824. ></TT
  59825. >) as control
  59826.      points. Vracφ <TT
  59827. CLASS="constant"
  59828. ><B
  59829. >TRUE</B
  59830. ></TT
  59831. > p°i ·sp∞chu, <TT
  59832. CLASS="constant"
  59833. ><B
  59834. >FALSE</B
  59835. ></TT
  59836. > p°i selhßnφ.
  59837.     </P
  59838. ><P
  59839. >Nepovinn² parametr <TT
  59840. CLASS="parameter"
  59841. ><I
  59842. >mode</I
  59843. ></TT
  59844. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  59845. ><P
  59846. >      See also <A
  59847. HREF="#function.cpdf-moveto"
  59848. ><B
  59849. CLASS="function"
  59850. >cpdf_moveto()</B
  59851. ></A
  59852. >,
  59853.      <A
  59854. HREF="#function.cpdf-rmoveto"
  59855. ><B
  59856. CLASS="function"
  59857. >cpdf_rmoveto()</B
  59858. ></A
  59859. >,
  59860.      <A
  59861. HREF="#function.cpdf-rlineto"
  59862. ><B
  59863. CLASS="function"
  59864. >cpdf_rlineto()</B
  59865. ></A
  59866. > and
  59867.      <A
  59868. HREF="#function.cpdf-lineto"
  59869. ><B
  59870. CLASS="function"
  59871. >cpdf_lineto()</B
  59872. ></A
  59873. >.
  59874.     </P
  59875. ></DIV
  59876. ><H1
  59877. ><A
  59878. NAME="function.cpdf-end-text"
  59879. ></A
  59880. >cpdf_end_text</H1
  59881. ><DIV
  59882. CLASS="refnamediv"
  59883. ><A
  59884. NAME="AEN12267"
  59885. ></A
  59886. ><P
  59887. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59888. >cpdf_end_text -- Ends text section</DIV
  59889. ><DIV
  59890. CLASS="refsect1"
  59891. ><A
  59892. NAME="AEN12270"
  59893. ></A
  59894. ><H2
  59895. >Description</H2
  59896. >bool <B
  59897. CLASS="methodname"
  59898. >cpdf_end_text</B
  59899. > ( int pdf_document)<BR
  59900. ></BR
  59901. ><P
  59902. >      The <B
  59903. CLASS="function"
  59904. >cpdf_end_text()</B
  59905. > function ends a text
  59906.      section which was started with <A
  59907. HREF="#function.cpdf-begin-text"
  59908. ><B
  59909. CLASS="function"
  59910. >cpdf_begin_text()</B
  59911. ></A
  59912. >.
  59913.      Vracφ <TT
  59914. CLASS="constant"
  59915. ><B
  59916. >TRUE</B
  59917. ></TT
  59918. > p°i ·sp∞chu, <TT
  59919. CLASS="constant"
  59920. ><B
  59921. >FALSE</B
  59922. ></TT
  59923. > p°i selhßnφ.
  59924.     </P
  59925. ><P
  59926. >      <TABLE
  59927. WIDTH="100%"
  59928. BORDER="0"
  59929. CELLPADDING="0"
  59930. CELLSPACING="0"
  59931. CLASS="EXAMPLE"
  59932. ><TR
  59933. ><TD
  59934. ><DIV
  59935. CLASS="example"
  59936. ><A
  59937. NAME="AEN12284"
  59938. ></A
  59939. ><P
  59940. ><B
  59941. >P°φklad 1. Text output</B
  59942. ></P
  59943. ><TABLE
  59944. BORDER="0"
  59945. BGCOLOR="#E0E0E0"
  59946. CELLPADDING="5"
  59947. ><TR
  59948. ><TD
  59949. ><PRE
  59950. CLASS="php"
  59951. ><?php
  59952. cpdf_begin_text($pdf);
  59953. cpdf_set_font($pdf, 16, "Helvetica", "WinAnsiEncoding");
  59954. cpdf_text($pdf, 100, 100, "Some text");
  59955. cpdf_end_text($pdf)
  59956. ?></PRE
  59957. ></TD
  59958. ></TR
  59959. ></TABLE
  59960. ></DIV
  59961. ></TD
  59962. ></TR
  59963. ></TABLE
  59964. >
  59965.     </P
  59966. ><P
  59967. >      See also <A
  59968. HREF="#function.cpdf-begin-text"
  59969. ><B
  59970. CLASS="function"
  59971. >cpdf_begin_text()</B
  59972. ></A
  59973. >.
  59974.     </P
  59975. ></DIV
  59976. ><H1
  59977. ><A
  59978. NAME="function.cpdf-fill-stroke"
  59979. ></A
  59980. >cpdf_fill_stroke</H1
  59981. ><DIV
  59982. CLASS="refnamediv"
  59983. ><A
  59984. NAME="AEN12290"
  59985. ></A
  59986. ><P
  59987. >    (PHP 3>= 3.0.8, PHP 4 )</P
  59988. >cpdf_fill_stroke -- Fill and stroke current path</DIV
  59989. ><DIV
  59990. CLASS="refsect1"
  59991. ><A
  59992. NAME="AEN12293"
  59993. ></A
  59994. ><H2
  59995. >Description</H2
  59996. >bool <B
  59997. CLASS="methodname"
  59998. >cpdf_fill_stroke</B
  59999. > ( int pdf_document)<BR
  60000. ></BR
  60001. ><P
  60002. >      The <B
  60003. CLASS="function"
  60004. >cpdf_fill_stroke()</B
  60005. > function fills the interior of
  60006.      the current path with the current fill color and draws current path.
  60007.      Vracφ <TT
  60008. CLASS="constant"
  60009. ><B
  60010. >TRUE</B
  60011. ></TT
  60012. > p°i ·sp∞chu, <TT
  60013. CLASS="constant"
  60014. ><B
  60015. >FALSE</B
  60016. ></TT
  60017. > p°i selhßnφ.
  60018.     </P
  60019. ><P
  60020. >      See also <A
  60021. HREF="#function.cpdf-closepath"
  60022. ><B
  60023. CLASS="function"
  60024. >cpdf_closepath()</B
  60025. ></A
  60026. >,
  60027.      <A
  60028. HREF="#function.cpdf-stroke"
  60029. ><B
  60030. CLASS="function"
  60031. >cpdf_stroke()</B
  60032. ></A
  60033. >,
  60034.      <A
  60035. HREF="#function.cpdf-fill"
  60036. ><B
  60037. CLASS="function"
  60038. >cpdf_fill()</B
  60039. ></A
  60040. >,
  60041.      <A
  60042. HREF="#function.cpdf-setgray-fill"
  60043. ><B
  60044. CLASS="function"
  60045. >cpdf_setgray_fill()</B
  60046. ></A
  60047. >,
  60048.      <A
  60049. HREF="#function.cpdf-setgray"
  60050. ><B
  60051. CLASS="function"
  60052. >cpdf_setgray()</B
  60053. ></A
  60054. >,
  60055.      <A
  60056. HREF="#function.cpdf-setrgbcolor-fill"
  60057. ><B
  60058. CLASS="function"
  60059. >cpdf_setrgbcolor_fill()</B
  60060. ></A
  60061. > and
  60062.      <A
  60063. HREF="#function.cpdf-setrgbcolor"
  60064. ><B
  60065. CLASS="function"
  60066. >cpdf_setrgbcolor()</B
  60067. ></A
  60068. >.
  60069.     </P
  60070. ></DIV
  60071. ><H1
  60072. ><A
  60073. NAME="function.cpdf-fill"
  60074. ></A
  60075. >cpdf_fill</H1
  60076. ><DIV
  60077. CLASS="refnamediv"
  60078. ><A
  60079. NAME="AEN12314"
  60080. ></A
  60081. ><P
  60082. >    (PHP 3>= 3.0.8, PHP 4 )</P
  60083. >cpdf_fill -- Fill current path</DIV
  60084. ><DIV
  60085. CLASS="refsect1"
  60086. ><A
  60087. NAME="AEN12317"
  60088. ></A
  60089. ><H2
  60090. >Description</H2
  60091. >bool <B
  60092. CLASS="methodname"
  60093. >cpdf_fill</B
  60094. > ( int pdf_document)<BR
  60095. ></BR
  60096. ><P
  60097. >      The <B
  60098. CLASS="function"
  60099. >cpdf_fill()</B
  60100. > function fills the interior of
  60101.      the current path with the current fill color. Vracφ <TT
  60102. CLASS="constant"
  60103. ><B
  60104. >TRUE</B
  60105. ></TT
  60106. > p°i ·sp∞chu, <TT
  60107. CLASS="constant"
  60108. ><B
  60109. >FALSE</B
  60110. ></TT
  60111. > p°i selhßnφ.
  60112.     </P
  60113. ><P
  60114. >      See also <A
  60115. HREF="#function.cpdf-closepath"
  60116. ><B
  60117. CLASS="function"
  60118. >cpdf_closepath()</B
  60119. ></A
  60120. >,
  60121.      <A
  60122. HREF="#function.cpdf-stroke"
  60123. ><B
  60124. CLASS="function"
  60125. >cpdf_stroke()</B
  60126. ></A
  60127. >,
  60128.      <A
  60129. HREF="#function.cpdf-setgray-fill"
  60130. ><B
  60131. CLASS="function"
  60132. >cpdf_setgray_fill()</B
  60133. ></A
  60134. >,
  60135.      <A
  60136. HREF="#function.cpdf-setgray"
  60137. ><B
  60138. CLASS="function"
  60139. >cpdf_setgray()</B
  60140. ></A
  60141. >,
  60142.      <A
  60143. HREF="#function.cpdf-setrgbcolor-fill"
  60144. ><B
  60145. CLASS="function"
  60146. >cpdf_setrgbcolor_fill()</B
  60147. ></A
  60148. > and
  60149.      <A
  60150. HREF="#function.cpdf-setrgbcolor"
  60151. ><B
  60152. CLASS="function"
  60153. >cpdf_setrgbcolor()</B
  60154. ></A
  60155. >.
  60156.     </P
  60157. ></DIV
  60158. ><H1
  60159. ><A
  60160. NAME="function.cpdf-finalize-page"
  60161. ></A
  60162. >cpdf_finalize_page</H1
  60163. ><DIV
  60164. CLASS="refnamediv"
  60165. ><A
  60166. NAME="AEN12337"
  60167. ></A
  60168. ><P
  60169. >    (PHP 3>= 3.0.10, PHP 4 )</P
  60170. >cpdf_finalize_page -- Ends page</DIV
  60171. ><DIV
  60172. CLASS="refsect1"
  60173. ><A
  60174. NAME="AEN12340"
  60175. ></A
  60176. ><H2
  60177. >Description</H2
  60178. >bool <B
  60179. CLASS="methodname"
  60180. >cpdf_finalize_page</B
  60181. > ( int pdf_document, int page_number)<BR
  60182. ></BR
  60183. ><P
  60184. >      The <B
  60185. CLASS="function"
  60186. >cpdf_finalize_page()</B
  60187. > function ends the page
  60188.      with page number <TT
  60189. CLASS="parameter"
  60190. ><I
  60191. >page_number</I
  60192. ></TT
  60193. >. Vracφ <TT
  60194. CLASS="constant"
  60195. ><B
  60196. >TRUE</B
  60197. ></TT
  60198. > p°i ·sp∞chu, <TT
  60199. CLASS="constant"
  60200. ><B
  60201. >FALSE</B
  60202. ></TT
  60203. > p°i selhßnφ.
  60204.     </P
  60205. ><P
  60206. >      This function is only for saving memory. A finalized page takes
  60207.      less memory but cannot be modified anymore.
  60208.     </P
  60209. ><P
  60210. >      See also <A
  60211. HREF="#function.cpdf-page-init"
  60212. ><B
  60213. CLASS="function"
  60214. >cpdf_page_init()</B
  60215. ></A
  60216. >.
  60217.     </P
  60218. ></DIV
  60219. ><H1
  60220. ><A
  60221. NAME="function.cpdf-finalize"
  60222. ></A
  60223. >cpdf_finalize</H1
  60224. ><DIV
  60225. CLASS="refnamediv"
  60226. ><A
  60227. NAME="AEN12360"
  60228. ></A
  60229. ><P
  60230. >    (PHP 3>= 3.0.8, PHP 4 )</P
  60231. >cpdf_finalize -- Ends document</DIV
  60232. ><DIV
  60233. CLASS="refsect1"
  60234. ><A
  60235. NAME="AEN12363"
  60236. ></A
  60237. ><H2
  60238. >Description</H2
  60239. >bool <B
  60240. CLASS="methodname"
  60241. >cpdf_finalize</B
  60242. > ( int pdf_document)<BR
  60243. ></BR
  60244. ><P
  60245. >      The <B
  60246. CLASS="function"
  60247. >cpdf_finalize()</B
  60248. > function ends the document.
  60249.      You still have to call <A
  60250. HREF="#function.cpdf-close"
  60251. ><B
  60252. CLASS="function"
  60253. >cpdf_close()</B
  60254. ></A
  60255. >. Vracφ <TT
  60256. CLASS="constant"
  60257. ><B
  60258. >TRUE</B
  60259. ></TT
  60260. > p°i ·sp∞chu, <TT
  60261. CLASS="constant"
  60262. ><B
  60263. >FALSE</B
  60264. ></TT
  60265. > p°i selhßnφ.
  60266.     </P
  60267. ><P
  60268. >      See also <A
  60269. HREF="#function.cpdf-close"
  60270. ><B
  60271. CLASS="function"
  60272. >cpdf_close()</B
  60273. ></A
  60274. >.
  60275.     </P
  60276. ></DIV
  60277. ><H1
  60278. ><A
  60279. NAME="function.cpdf-global-set-document-limits"
  60280. ></A
  60281. >cpdf_global_set_document_limits</H1
  60282. ><DIV
  60283. CLASS="refnamediv"
  60284. ><A
  60285. NAME="AEN12379"
  60286. ></A
  60287. ><P
  60288. >    (PHP 4 )</P
  60289. >cpdf_global_set_document_limits -- Sets document limits for any pdf document</DIV
  60290. ><DIV
  60291. CLASS="refsect1"
  60292. ><A
  60293. NAME="AEN12382"
  60294. ></A
  60295. ><H2
  60296. >Description</H2
  60297. >bool <B
  60298. CLASS="methodname"
  60299. >cpdf_global_set_document_limits</B
  60300. > ( int maxpages, int maxfonts, int maximages, int maxannotations, int maxobjects)<BR
  60301. ></BR
  60302. ><P
  60303. >      The <B
  60304. CLASS="function"
  60305. >cpdf_global_set_document_limits()</B
  60306. > function sets
  60307.      several document limits. This function has to be called before
  60308.      <A
  60309. HREF="#function.cpdf-open"
  60310. ><B
  60311. CLASS="function"
  60312. >cpdf_open()</B
  60313. ></A
  60314. > to take effect. It sets the limits
  60315.      for any document open afterwards. Vracφ <TT
  60316. CLASS="constant"
  60317. ><B
  60318. >TRUE</B
  60319. ></TT
  60320. > p°i ·sp∞chu, <TT
  60321. CLASS="constant"
  60322. ><B
  60323. >FALSE</B
  60324. ></TT
  60325. > p°i selhßnφ.
  60326.     </P
  60327. ><P
  60328. >      See also <A
  60329. HREF="#function.cpdf-open"
  60330. ><B
  60331. CLASS="function"
  60332. >cpdf_open()</B
  60333. ></A
  60334. >.
  60335.     </P
  60336. ></DIV
  60337. ><H1
  60338. ><A
  60339. NAME="function.cpdf-import-jpeg"
  60340. ></A
  60341. >cpdf_import_jpeg</H1
  60342. ><DIV
  60343. CLASS="refnamediv"
  60344. ><A
  60345. NAME="AEN12410"
  60346. ></A
  60347. ><P
  60348. >    (PHP 3>= 3.0.9, PHP 4 )</P
  60349. >cpdf_import_jpeg -- Opens a JPEG image</DIV
  60350. ><DIV
  60351. CLASS="refsect1"
  60352. ><A
  60353. NAME="AEN12413"
  60354. ></A
  60355. ><H2
  60356. >Description</H2
  60357. >int <B
  60358. CLASS="methodname"
  60359. >cpdf_import_jpeg</B
  60360. > ( int pdf_document, string file_name, float x-coor, float y-coor, float angle, float width, float height, float x-scale, float y-scale, int gsave [, int mode])<BR
  60361. ></BR
  60362. ><P
  60363. >      The <B
  60364. CLASS="function"
  60365. >cpdf_import_jpeg()</B
  60366. > function opens an image
  60367.      stored in the file with the name <TT
  60368. CLASS="parameter"
  60369. ><I
  60370. >file
  60371.      name</I
  60372. ></TT
  60373. >.  The format of the image has to be jpeg. The
  60374.      image is placed on the current page at position
  60375.      (<TT
  60376. CLASS="parameter"
  60377. ><I
  60378. >x-coor</I
  60379. ></TT
  60380. >, <TT
  60381. CLASS="parameter"
  60382. ><I
  60383. >y-coor</I
  60384. ></TT
  60385. >).
  60386.      The image is rotated by <TT
  60387. CLASS="parameter"
  60388. ><I
  60389. >angle</I
  60390. ></TT
  60391. > degrees.
  60392.      <TT
  60393. CLASS="parameter"
  60394. ><I
  60395. >gsave</I
  60396. ></TT
  60397. > should be non-zero to allow this
  60398.      function to operate correctly.
  60399.     </P
  60400. ><P
  60401. >Nepovinn² parametr <TT
  60402. CLASS="parameter"
  60403. ><I
  60404. >mode</I
  60405. ></TT
  60406. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  60407. ><P
  60408. >      See also <A
  60409. HREF="#function.cpdf-place-inline-image"
  60410. ><B
  60411. CLASS="function"
  60412. >cpdf_place_inline_image()</B
  60413. ></A
  60414. >.
  60415.     </P
  60416. ></DIV
  60417. ><H1
  60418. ><A
  60419. NAME="function.cpdf-lineto"
  60420. ></A
  60421. >cpdf_lineto</H1
  60422. ><DIV
  60423. CLASS="refnamediv"
  60424. ><A
  60425. NAME="AEN12463"
  60426. ></A
  60427. ><P
  60428. >    (PHP 3>= 3.0.8, PHP 4 )</P
  60429. >cpdf_lineto -- Draws a line</DIV
  60430. ><DIV
  60431. CLASS="refsect1"
  60432. ><A
  60433. NAME="AEN12466"
  60434. ></A
  60435. ><H2
  60436. >Description</H2
  60437. >bool <B
  60438. CLASS="methodname"
  60439. >cpdf_lineto</B
  60440. > ( int pdf_document, float x-coor, float y-coor [, int mode])<BR
  60441. ></BR
  60442. ><P
  60443. >      The <B
  60444. CLASS="function"
  60445. >cpdf_lineto()</B
  60446. > function draws a line from
  60447.      the current point to the point with coordinates
  60448.      (<TT
  60449. CLASS="parameter"
  60450. ><I
  60451. >x-coor</I
  60452. ></TT
  60453. >, <TT
  60454. CLASS="parameter"
  60455. ><I
  60456. >y-coor</I
  60457. ></TT
  60458. >).
  60459.      Vracφ <TT
  60460. CLASS="constant"
  60461. ><B
  60462. >TRUE</B
  60463. ></TT
  60464. > p°i ·sp∞chu, <TT
  60465. CLASS="constant"
  60466. ><B
  60467. >FALSE</B
  60468. ></TT
  60469. > p°i selhßnφ.
  60470.     </P
  60471. ><P
  60472. >Nepovinn² parametr <TT
  60473. CLASS="parameter"
  60474. ><I
  60475. >mode</I
  60476. ></TT
  60477. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  60478. ><P
  60479. >      See also <A
  60480. HREF="#function.cpdf-moveto"
  60481. ><B
  60482. CLASS="function"
  60483. >cpdf_moveto()</B
  60484. ></A
  60485. >,
  60486.      <A
  60487. HREF="#function.cpdf-rmoveto"
  60488. ><B
  60489. CLASS="function"
  60490. >cpdf_rmoveto()</B
  60491. ></A
  60492. > and
  60493.      <A
  60494. HREF="#function.cpdf-curveto"
  60495. ><B
  60496. CLASS="function"
  60497. >cpdf_curveto()</B
  60498. ></A
  60499. >.
  60500.     </P
  60501. ></DIV
  60502. ><H1
  60503. ><A
  60504. NAME="function.cpdf-moveto"
  60505. ></A
  60506. >cpdf_moveto</H1
  60507. ><DIV
  60508. CLASS="refnamediv"
  60509. ><A
  60510. NAME="AEN12496"
  60511. ></A
  60512. ><P
  60513. >    (PHP 3>= 3.0.8, PHP 4 )</P
  60514. >cpdf_moveto -- Sets current point</DIV
  60515. ><DIV
  60516. CLASS="refsect1"
  60517. ><A
  60518. NAME="AEN12499"
  60519. ></A
  60520. ><H2
  60521. >Description</H2
  60522. >bool <B
  60523. CLASS="methodname"
  60524. >cpdf_moveto</B
  60525. > ( int pdf_document, float x-coor, float y-coor [, int mode])<BR
  60526. ></BR
  60527. ><P
  60528. >      The <B
  60529. CLASS="function"
  60530. >cpdf_moveto()</B
  60531. > function set the current
  60532.      point to the coordinates <TT
  60533. CLASS="parameter"
  60534. ><I
  60535. >x-coor</I
  60536. ></TT
  60537. > and
  60538.      <TT
  60539. CLASS="parameter"
  60540. ><I
  60541. >y-coor</I
  60542. ></TT
  60543. >. Vracφ <TT
  60544. CLASS="constant"
  60545. ><B
  60546. >TRUE</B
  60547. ></TT
  60548. > p°i ·sp∞chu, <TT
  60549. CLASS="constant"
  60550. ><B
  60551. >FALSE</B
  60552. ></TT
  60553. > p°i selhßnφ.
  60554.     </P
  60555. ><P
  60556. >Nepovinn² parametr <TT
  60557. CLASS="parameter"
  60558. ><I
  60559. >mode</I
  60560. ></TT
  60561. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  60562. ></DIV
  60563. ><H1
  60564. ><A
  60565. NAME="function.cpdf-newpath"
  60566. ></A
  60567. >cpdf_newpath</H1
  60568. ><DIV
  60569. CLASS="refnamediv"
  60570. ><A
  60571. NAME="AEN12525"
  60572. ></A
  60573. ><P
  60574. >    (PHP 3>= 3.0.9, PHP 4 )</P
  60575. >cpdf_newpath -- Starts a new path</DIV
  60576. ><DIV
  60577. CLASS="refsect1"
  60578. ><A
  60579. NAME="AEN12528"
  60580. ></A
  60581. ><H2
  60582. >Description</H2
  60583. >bool <B
  60584. CLASS="methodname"
  60585. >cpdf_newpath</B
  60586. > ( int pdf_document)<BR
  60587. ></BR
  60588. ><P
  60589. >      The <B
  60590. CLASS="function"
  60591. >cpdf_newpath()</B
  60592. > starts a new path on the
  60593.      document given by the <TT
  60594. CLASS="parameter"
  60595. ><I
  60596. >pdf_document</I
  60597. ></TT
  60598. >
  60599.      parameter. Vracφ <TT
  60600. CLASS="constant"
  60601. ><B
  60602. >TRUE</B
  60603. ></TT
  60604. > p°i ·sp∞chu, <TT
  60605. CLASS="constant"
  60606. ><B
  60607. >FALSE</B
  60608. ></TT
  60609. > p°i selhßnφ.
  60610.     </P
  60611. ></DIV
  60612. ><H1
  60613. ><A
  60614. NAME="function.cpdf-open"
  60615. ></A
  60616. >cpdf_open</H1
  60617. ><DIV
  60618. CLASS="refnamediv"
  60619. ><A
  60620. NAME="AEN12542"
  60621. ></A
  60622. ><P
  60623. >    (PHP 3>= 3.0.8, PHP 4 )</P
  60624. >cpdf_open -- Opens a new pdf document</DIV
  60625. ><DIV
  60626. CLASS="refsect1"
  60627. ><A
  60628. NAME="AEN12545"
  60629. ></A
  60630. ><H2
  60631. >Description</H2
  60632. >int <B
  60633. CLASS="methodname"
  60634. >cpdf_open</B
  60635. > ( int compression [, string filename])<BR
  60636. ></BR
  60637. ><P
  60638. >      The <B
  60639. CLASS="function"
  60640. >cpdf_open()</B
  60641. > function opens
  60642.      a new pdf document. The first parameter turns document compression
  60643.      on if it is unequal to 0. The second optional parameter sets the
  60644.      file in which the document is written. If it is omitted the document
  60645.      is created in memory and can either be written into a file with
  60646.      the <A
  60647. HREF="#function.cpdf-save-to-file"
  60648. ><B
  60649. CLASS="function"
  60650. >cpdf_save_to_file()</B
  60651. ></A
  60652. > or written to standard
  60653.      output with <A
  60654. HREF="#function.cpdf-output-buffer"
  60655. ><B
  60656. CLASS="function"
  60657. >cpdf_output_buffer()</B
  60658. ></A
  60659. >.
  60660.      <DIV
  60661. CLASS="note"
  60662. ><BLOCKQUOTE
  60663. CLASS="note"
  60664. ><P
  60665. ><B
  60666. >Poznßmka: </B
  60667. >
  60668.        The return value will be needed in further versions of ClibPDF
  60669.        as the first parameter in all other functions which are writing
  60670.        to the pdf document.
  60671.       </P
  60672. ><P
  60673. >        The ClibPDF library takes the filename "-" as a synonym for
  60674.        stdout. If PHP is compiled as an apache module this will not
  60675.        work because the way ClibPDF outputs to stdout does not work
  60676.        with apache. You can solve this problem by skipping the
  60677.        filename and using <A
  60678. HREF="#function.cpdf-output-buffer"
  60679. ><B
  60680. CLASS="function"
  60681. >cpdf_output_buffer()</B
  60682. ></A
  60683. > to
  60684.        output the pdf document.
  60685.       </P
  60686. ></BLOCKQUOTE
  60687. ></DIV
  60688. >
  60689.     </P
  60690. ><P
  60691. >      See also <A
  60692. HREF="#function.cpdf-close"
  60693. ><B
  60694. CLASS="function"
  60695. >cpdf_close()</B
  60696. ></A
  60697. > and
  60698.      <A
  60699. HREF="#function.cpdf-output-buffer"
  60700. ><B
  60701. CLASS="function"
  60702. >cpdf_output_buffer()</B
  60703. ></A
  60704. >.
  60705.     </P
  60706. ></DIV
  60707. ><H1
  60708. ><A
  60709. NAME="function.cpdf-output-buffer"
  60710. ></A
  60711. >cpdf_output_buffer</H1
  60712. ><DIV
  60713. CLASS="refnamediv"
  60714. ><A
  60715. NAME="AEN12568"
  60716. ></A
  60717. ><P
  60718. >    (PHP 3>= 3.0.9, PHP 4 )</P
  60719. >cpdf_output_buffer -- Outputs the pdf document in memory buffer</DIV
  60720. ><DIV
  60721. CLASS="refsect1"
  60722. ><A
  60723. NAME="AEN12571"
  60724. ></A
  60725. ><H2
  60726. >Description</H2
  60727. >bool <B
  60728. CLASS="methodname"
  60729. >cpdf_output_buffer</B
  60730. > ( int pdf_document)<BR
  60731. ></BR
  60732. ><P
  60733. >      The <B
  60734. CLASS="function"
  60735. >cpdf_output_buffer()</B
  60736. > function outputs
  60737.      the pdf document to stdout. The document has to be created in memory which
  60738.      is the case if <A
  60739. HREF="#function.cpdf-open"
  60740. ><B
  60741. CLASS="function"
  60742. >cpdf_open()</B
  60743. ></A
  60744. > has been called with
  60745.      no filename parameter. Vracφ <TT
  60746. CLASS="constant"
  60747. ><B
  60748. >TRUE</B
  60749. ></TT
  60750. > p°i ·sp∞chu, <TT
  60751. CLASS="constant"
  60752. ><B
  60753. >FALSE</B
  60754. ></TT
  60755. > p°i selhßnφ.
  60756.     </P
  60757. ><P
  60758. >      See also <A
  60759. HREF="#function.cpdf-open"
  60760. ><B
  60761. CLASS="function"
  60762. >cpdf_open()</B
  60763. ></A
  60764. >.
  60765.     </P
  60766. ></DIV
  60767. ><H1
  60768. ><A
  60769. NAME="function.cpdf-page-init"
  60770. ></A
  60771. >cpdf_page_init</H1
  60772. ><DIV
  60773. CLASS="refnamediv"
  60774. ><A
  60775. NAME="AEN12587"
  60776. ></A
  60777. ><P
  60778. >    (PHP 3>= 3.0.8, PHP 4 )</P
  60779. >cpdf_page_init -- Starts new page</DIV
  60780. ><DIV
  60781. CLASS="refsect1"
  60782. ><A
  60783. NAME="AEN12590"
  60784. ></A
  60785. ><H2
  60786. >Description</H2
  60787. >bool <B
  60788. CLASS="methodname"
  60789. >cpdf_page_init</B
  60790. > ( int pdf_document, int page_number, int orientation, float height, float width [, float unit])<BR
  60791. ></BR
  60792. ><P
  60793. >      The <B
  60794. CLASS="function"
  60795. >cpdf_page_init()</B
  60796. > function starts a new
  60797.      page with height <TT
  60798. CLASS="parameter"
  60799. ><I
  60800. >height</I
  60801. ></TT
  60802. > and width
  60803.      <TT
  60804. CLASS="parameter"
  60805. ><I
  60806. >width</I
  60807. ></TT
  60808. >. Vracφ <TT
  60809. CLASS="constant"
  60810. ><B
  60811. >TRUE</B
  60812. ></TT
  60813. > p°i ·sp∞chu, <TT
  60814. CLASS="constant"
  60815. ><B
  60816. >FALSE</B
  60817. ></TT
  60818. > p°i selhßnφ. 
  60819.      The page has number <TT
  60820. CLASS="parameter"
  60821. ><I
  60822. >page_number</I
  60823. ></TT
  60824. > and orientation
  60825.      <TT
  60826. CLASS="parameter"
  60827. ><I
  60828. >orientation</I
  60829. ></TT
  60830. >. <TT
  60831. CLASS="parameter"
  60832. ><I
  60833. >orientation</I
  60834. ></TT
  60835. >
  60836.      can be 0 for portrait and 1 for landscape. The last optional parameter
  60837.      <TT
  60838. CLASS="parameter"
  60839. ><I
  60840. >unit</I
  60841. ></TT
  60842. > sets the unit for the coordinate system.
  60843.      The value should be the number of postscript points per unit. Since
  60844.      one inch is equal to 72 points, a value of 72 would set the unit
  60845.      to one inch. The default is also 72.
  60846.     </P
  60847. ><P
  60848. >      See also <A
  60849. HREF="#function.cpdf-set-current-page"
  60850. ><B
  60851. CLASS="function"
  60852. >cpdf_set_current_page()</B
  60853. ></A
  60854. >.
  60855.     </P
  60856. ></DIV
  60857. ><H1
  60858. ><A
  60859. NAME="function.cpdf-place-inline-image"
  60860. ></A
  60861. >cpdf_place_inline_image</H1
  60862. ><DIV
  60863. CLASS="refnamediv"
  60864. ><A
  60865. NAME="AEN12626"
  60866. ></A
  60867. ><P
  60868. >    (PHP 3>= 3.0.9, PHP 4 )</P
  60869. >cpdf_place_inline_image -- Places an image on the page</DIV
  60870. ><DIV
  60871. CLASS="refsect1"
  60872. ><A
  60873. NAME="AEN12629"
  60874. ></A
  60875. ><H2
  60876. >Description</H2
  60877. >bool <B
  60878. CLASS="methodname"
  60879. >cpdf_place_inline_image</B
  60880. > ( int pdf_document, int image, float x-coor, float y-coor, float angle, float width, float height [, int mode])<BR
  60881. ></BR
  60882. ><P
  60883. >      The <B
  60884. CLASS="function"
  60885. >cpdf_place_inline_image()</B
  60886. > function places
  60887.      an image created with the PHP image functions on the page at
  60888.      position (<TT
  60889. CLASS="parameter"
  60890. ><I
  60891. >x-coor</I
  60892. ></TT
  60893. >,
  60894.      <TT
  60895. CLASS="parameter"
  60896. ><I
  60897. >y-coor</I
  60898. ></TT
  60899. >). The image can be scaled at the
  60900.      same time. Vracφ <TT
  60901. CLASS="constant"
  60902. ><B
  60903. >TRUE</B
  60904. ></TT
  60905. > p°i ·sp∞chu, <TT
  60906. CLASS="constant"
  60907. ><B
  60908. >FALSE</B
  60909. ></TT
  60910. > p°i selhßnφ.
  60911.     </P
  60912. ><P
  60913. >Nepovinn² parametr <TT
  60914. CLASS="parameter"
  60915. ><I
  60916. >mode</I
  60917. ></TT
  60918. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  60919. ><P
  60920. >      See also <A
  60921. HREF="#function.cpdf-import-jpeg"
  60922. ><B
  60923. CLASS="function"
  60924. >cpdf_import_jpeg()</B
  60925. ></A
  60926. >.
  60927.     </P
  60928. ></DIV
  60929. ><H1
  60930. ><A
  60931. NAME="function.cpdf-rect"
  60932. ></A
  60933. >cpdf_rect</H1
  60934. ><DIV
  60935. CLASS="refnamediv"
  60936. ><A
  60937. NAME="AEN12669"
  60938. ></A
  60939. ><P
  60940. >    (PHP 3>= 3.0.8, PHP 4 )</P
  60941. >cpdf_rect -- Draw a rectangle</DIV
  60942. ><DIV
  60943. CLASS="refsect1"
  60944. ><A
  60945. NAME="AEN12672"
  60946. ></A
  60947. ><H2
  60948. >Description</H2
  60949. >bool <B
  60950. CLASS="methodname"
  60951. >cpdf_rect</B
  60952. > ( int pdf_document, float x-coor, float y-coor, float width, float height [, int mode])<BR
  60953. ></BR
  60954. ><P
  60955. >      The <B
  60956. CLASS="function"
  60957. >cpdf_rect()</B
  60958. > function draws a rectangle with
  60959.      its lower left corner at point 
  60960.      (<TT
  60961. CLASS="parameter"
  60962. ><I
  60963. >x-coor</I
  60964. ></TT
  60965. >, <TT
  60966. CLASS="parameter"
  60967. ><I
  60968. >y-coor</I
  60969. ></TT
  60970. >).
  60971.      This width is set to <TT
  60972. CLASS="parameter"
  60973. ><I
  60974. >width</I
  60975. ></TT
  60976. >.
  60977.      This height is set to <TT
  60978. CLASS="parameter"
  60979. ><I
  60980. >height</I
  60981. ></TT
  60982. >. Vracφ <TT
  60983. CLASS="constant"
  60984. ><B
  60985. >TRUE</B
  60986. ></TT
  60987. > p°i ·sp∞chu, <TT
  60988. CLASS="constant"
  60989. ><B
  60990. >FALSE</B
  60991. ></TT
  60992. > p°i selhßnφ.
  60993.     </P
  60994. ><P
  60995. >Nepovinn² parametr <TT
  60996. CLASS="parameter"
  60997. ><I
  60998. >mode</I
  60999. ></TT
  61000. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  61001. ><P
  61002. >      <TABLE
  61003. WIDTH="100%"
  61004. BORDER="0"
  61005. CELLPADDING="0"
  61006. CELLSPACING="0"
  61007. CLASS="EXAMPLE"
  61008. ><TR
  61009. ><TD
  61010. ><DIV
  61011. CLASS="example"
  61012. ><A
  61013. NAME="AEN12706"
  61014. ></A
  61015. ><P
  61016. ><B
  61017. >P°φklad 1. Drawing a rectangle</B
  61018. ></P
  61019. ><TABLE
  61020. BORDER="0"
  61021. BGCOLOR="#E0E0E0"
  61022. CELLPADDING="5"
  61023. ><TR
  61024. ><TD
  61025. ><PRE
  61026. CLASS="php"
  61027. ><?php
  61028.  
  61029. $cpdf = cpdf_open(0);
  61030. cpdf_page_init($cpdf, 1, 0, 595, 842, 1.0);
  61031.  
  61032. // set the fill color to red
  61033. cpdf_setrgbcolor($cpdf, 1, 0, 0);
  61034.  
  61035. // draw a (180 * 100) rectangle
  61036. cpdf_rect($cpdf, 645, 400, 180, 100);
  61037.  
  61038. // fill the rectangle
  61039. cpdf_fill($cpdf);
  61040.  
  61041. cpdf_finalize($cpdf);
  61042. Header("Content-type: application/pdf");
  61043. cpdf_output_buffer($cpdf);
  61044. cpdf_close($cpdf);
  61045.  
  61046. ?></PRE
  61047. ></TD
  61048. ></TR
  61049. ></TABLE
  61050. ></DIV
  61051. ></TD
  61052. ></TR
  61053. ></TABLE
  61054. >
  61055.     </P
  61056. ></DIV
  61057. ><H1
  61058. ><A
  61059. NAME="function.cpdf-restore"
  61060. ></A
  61061. >cpdf_restore</H1
  61062. ><DIV
  61063. CLASS="refnamediv"
  61064. ><A
  61065. NAME="AEN12710"
  61066. ></A
  61067. ><P
  61068. >    (PHP 3>= 3.0.8, PHP 4 )</P
  61069. >cpdf_restore -- Restores formerly saved environment</DIV
  61070. ><DIV
  61071. CLASS="refsect1"
  61072. ><A
  61073. NAME="AEN12713"
  61074. ></A
  61075. ><H2
  61076. >Description</H2
  61077. >bool <B
  61078. CLASS="methodname"
  61079. >cpdf_restore</B
  61080. > ( int pdf_document)<BR
  61081. ></BR
  61082. ><P
  61083. >      The <B
  61084. CLASS="function"
  61085. >cpdf_restore()</B
  61086. > function restores the
  61087.      environment saved with <A
  61088. HREF="#function.cpdf-save"
  61089. ><B
  61090. CLASS="function"
  61091. >cpdf_save()</B
  61092. ></A
  61093. >. It works
  61094.      like the postscript command grestore. Very useful if you want
  61095.      to translate or rotate an object without effecting other objects.
  61096.      Vracφ <TT
  61097. CLASS="constant"
  61098. ><B
  61099. >TRUE</B
  61100. ></TT
  61101. > p°i ·sp∞chu, <TT
  61102. CLASS="constant"
  61103. ><B
  61104. >FALSE</B
  61105. ></TT
  61106. > p°i selhßnφ.
  61107.     </P
  61108. ><P
  61109. >      <TABLE
  61110. WIDTH="100%"
  61111. BORDER="0"
  61112. CELLPADDING="0"
  61113. CELLSPACING="0"
  61114. CLASS="EXAMPLE"
  61115. ><TR
  61116. ><TD
  61117. ><DIV
  61118. CLASS="example"
  61119. ><A
  61120. NAME="AEN12727"
  61121. ></A
  61122. ><P
  61123. ><B
  61124. >P°φklad 1. Save/Restore</B
  61125. ></P
  61126. ><TABLE
  61127. BORDER="0"
  61128. BGCOLOR="#E0E0E0"
  61129. CELLPADDING="5"
  61130. ><TR
  61131. ><TD
  61132. ><PRE
  61133. CLASS="php"
  61134. ><?php
  61135. cpdf_save($pdf);
  61136. // do all kinds of rotations, transformations, ...
  61137. cpdf_restore($pdf)
  61138. ?></PRE
  61139. ></TD
  61140. ></TR
  61141. ></TABLE
  61142. ></DIV
  61143. ></TD
  61144. ></TR
  61145. ></TABLE
  61146. >
  61147.     </P
  61148. ><P
  61149. >      See also <A
  61150. HREF="#function.cpdf-save"
  61151. ><B
  61152. CLASS="function"
  61153. >cpdf_save()</B
  61154. ></A
  61155. >.
  61156.     </P
  61157. ></DIV
  61158. ><H1
  61159. ><A
  61160. NAME="function.cpdf-rlineto"
  61161. ></A
  61162. >cpdf_rlineto</H1
  61163. ><DIV
  61164. CLASS="refnamediv"
  61165. ><A
  61166. NAME="AEN12733"
  61167. ></A
  61168. ><P
  61169. >    (PHP 3>= 3.0.9, PHP 4 )</P
  61170. >cpdf_rlineto -- Draws a line</DIV
  61171. ><DIV
  61172. CLASS="refsect1"
  61173. ><A
  61174. NAME="AEN12736"
  61175. ></A
  61176. ><H2
  61177. >Description</H2
  61178. >bool <B
  61179. CLASS="methodname"
  61180. >cpdf_rlineto</B
  61181. > ( int pdf_document, float x-coor, float y-coor [, int mode])<BR
  61182. ></BR
  61183. ><P
  61184. >      The <B
  61185. CLASS="function"
  61186. >cpdf_rlineto()</B
  61187. > function draws a line from
  61188.      the current point to the relative point with coordinates
  61189.      (<TT
  61190. CLASS="parameter"
  61191. ><I
  61192. >x-coor</I
  61193. ></TT
  61194. >, <TT
  61195. CLASS="parameter"
  61196. ><I
  61197. >y-coor</I
  61198. ></TT
  61199. >).
  61200.      Vracφ <TT
  61201. CLASS="constant"
  61202. ><B
  61203. >TRUE</B
  61204. ></TT
  61205. > p°i ·sp∞chu, <TT
  61206. CLASS="constant"
  61207. ><B
  61208. >FALSE</B
  61209. ></TT
  61210. > p°i selhßnφ.
  61211.     </P
  61212. ><P
  61213. >Nepovinn² parametr <TT
  61214. CLASS="parameter"
  61215. ><I
  61216. >mode</I
  61217. ></TT
  61218. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  61219. ><P
  61220. >      See also <A
  61221. HREF="#function.cpdf-moveto"
  61222. ><B
  61223. CLASS="function"
  61224. >cpdf_moveto()</B
  61225. ></A
  61226. >,
  61227.      <A
  61228. HREF="#function.cpdf-rmoveto"
  61229. ><B
  61230. CLASS="function"
  61231. >cpdf_rmoveto()</B
  61232. ></A
  61233. > and
  61234.      <A
  61235. HREF="#function.cpdf-curveto"
  61236. ><B
  61237. CLASS="function"
  61238. >cpdf_curveto()</B
  61239. ></A
  61240. >.
  61241.     </P
  61242. ></DIV
  61243. ><H1
  61244. ><A
  61245. NAME="function.cpdf-rmoveto"
  61246. ></A
  61247. >cpdf_rmoveto</H1
  61248. ><DIV
  61249. CLASS="refnamediv"
  61250. ><A
  61251. NAME="AEN12766"
  61252. ></A
  61253. ><P
  61254. >    (PHP 3>= 3.0.9, PHP 4 )</P
  61255. >cpdf_rmoveto -- Sets current point</DIV
  61256. ><DIV
  61257. CLASS="refsect1"
  61258. ><A
  61259. NAME="AEN12769"
  61260. ></A
  61261. ><H2
  61262. >Description</H2
  61263. >bool <B
  61264. CLASS="methodname"
  61265. >cpdf_rmoveto</B
  61266. > ( int pdf_document, float x-coor, float y-coor [, int mode])<BR
  61267. ></BR
  61268. ><P
  61269. >      The <B
  61270. CLASS="function"
  61271. >cpdf_rmoveto()</B
  61272. > function set the current point
  61273.      relative to the coordinates <TT
  61274. CLASS="parameter"
  61275. ><I
  61276. >x-coor</I
  61277. ></TT
  61278. > and
  61279.      <TT
  61280. CLASS="parameter"
  61281. ><I
  61282. >y-coor</I
  61283. ></TT
  61284. >. Vracφ <TT
  61285. CLASS="constant"
  61286. ><B
  61287. >TRUE</B
  61288. ></TT
  61289. > p°i ·sp∞chu, <TT
  61290. CLASS="constant"
  61291. ><B
  61292. >FALSE</B
  61293. ></TT
  61294. > p°i selhßnφ.
  61295.     </P
  61296. ><P
  61297. >Nepovinn² parametr <TT
  61298. CLASS="parameter"
  61299. ><I
  61300. >mode</I
  61301. ></TT
  61302. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  61303. ><P
  61304. >      See also <A
  61305. HREF="#function.cpdf-moveto"
  61306. ><B
  61307. CLASS="function"
  61308. >cpdf_moveto()</B
  61309. ></A
  61310. >.
  61311.     </P
  61312. ></DIV
  61313. ><H1
  61314. ><A
  61315. NAME="function.cpdf-rotate-text"
  61316. ></A
  61317. >cpdf_rotate_text</H1
  61318. ><DIV
  61319. CLASS="refnamediv"
  61320. ><A
  61321. NAME="AEN12797"
  61322. ></A
  61323. ><P
  61324. >    (PHP 3>= 3.0.9, PHP 4 )</P
  61325. >cpdf_rotate_text -- 
  61326.      Sets text rotation angle
  61327.     </DIV
  61328. ><DIV
  61329. CLASS="refsect1"
  61330. ><A
  61331. NAME="AEN12800"
  61332. ></A
  61333. ><H2
  61334. >Description</H2
  61335. >bool <B
  61336. CLASS="methodname"
  61337. >cpdf_rotate_text</B
  61338. > ( int pdfdoc, float angle)<BR
  61339. ></BR
  61340. ><P
  61341. >      <DIV
  61342. CLASS="warning"
  61343. ><P
  61344. ></P
  61345. ><TABLE
  61346. CLASS="warning"
  61347. BORDER="1"
  61348. WIDTH="100%"
  61349. ><TR
  61350. ><TD
  61351. ALIGN="CENTER"
  61352. ><B
  61353. >Varovßnφ</B
  61354. ></TD
  61355. ></TR
  61356. ><TR
  61357. ><TD
  61358. ALIGN="LEFT"
  61359. ><P
  61360. >Tato funkce je╣t∞ nenφ
  61361. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  61362. ></TD
  61363. ></TR
  61364. ></TABLE
  61365. ></DIV
  61366. >
  61367.     </P
  61368. ></DIV
  61369. ><H1
  61370. ><A
  61371. NAME="function.cpdf-rotate"
  61372. ></A
  61373. >cpdf_rotate</H1
  61374. ><DIV
  61375. CLASS="refnamediv"
  61376. ><A
  61377. NAME="AEN12815"
  61378. ></A
  61379. ><P
  61380. >    (PHP 3>= 3.0.8, PHP 4 )</P
  61381. >cpdf_rotate -- Sets rotation</DIV
  61382. ><DIV
  61383. CLASS="refsect1"
  61384. ><A
  61385. NAME="AEN12818"
  61386. ></A
  61387. ><H2
  61388. >Description</H2
  61389. >bool <B
  61390. CLASS="methodname"
  61391. >cpdf_rotate</B
  61392. > ( int pdf_document, float angle)<BR
  61393. ></BR
  61394. ><P
  61395. >      The <B
  61396. CLASS="function"
  61397. >cpdf_rotate()</B
  61398. > function set the rotation in
  61399.      degrees to <TT
  61400. CLASS="parameter"
  61401. ><I
  61402. >angle</I
  61403. ></TT
  61404. >. Vracφ <TT
  61405. CLASS="constant"
  61406. ><B
  61407. >TRUE</B
  61408. ></TT
  61409. > p°i ·sp∞chu, <TT
  61410. CLASS="constant"
  61411. ><B
  61412. >FALSE</B
  61413. ></TT
  61414. > p°i selhßnφ.
  61415.     </P
  61416. ></DIV
  61417. ><H1
  61418. ><A
  61419. NAME="function.cpdf-save-to-file"
  61420. ></A
  61421. >cpdf_save_to_file</H1
  61422. ><DIV
  61423. CLASS="refnamediv"
  61424. ><A
  61425. NAME="AEN12835"
  61426. ></A
  61427. ><P
  61428. >    (PHP 3>= 3.0.8, PHP 4 )</P
  61429. >cpdf_save_to_file -- Writes the pdf document into a file</DIV
  61430. ><DIV
  61431. CLASS="refsect1"
  61432. ><A
  61433. NAME="AEN12838"
  61434. ></A
  61435. ><H2
  61436. >Description</H2
  61437. >bool <B
  61438. CLASS="methodname"
  61439. >cpdf_save_to_file</B
  61440. > ( int pdf_document, string filename)<BR
  61441. ></BR
  61442. ><P
  61443. >      The <B
  61444. CLASS="function"
  61445. >cpdf_save_to_file()</B
  61446. > function outputs
  61447.      the pdf document into a file if it has been created in memory.
  61448.      Vracφ <TT
  61449. CLASS="constant"
  61450. ><B
  61451. >TRUE</B
  61452. ></TT
  61453. > p°i ·sp∞chu, <TT
  61454. CLASS="constant"
  61455. ><B
  61456. >FALSE</B
  61457. ></TT
  61458. > p°i selhßnφ.
  61459.     </P
  61460. ><P
  61461. >      This function is not needed if the pdf document has been open
  61462.      by specifying a filename as a parameter of <A
  61463. HREF="#function.cpdf-open"
  61464. ><B
  61465. CLASS="function"
  61466. >cpdf_open()</B
  61467. ></A
  61468. >.
  61469.     </P
  61470. ><P
  61471. >      See also <A
  61472. HREF="#function.cpdf-output-buffer"
  61473. ><B
  61474. CLASS="function"
  61475. >cpdf_output_buffer()</B
  61476. ></A
  61477. > and
  61478.      <A
  61479. HREF="#function.cpdf-open"
  61480. ><B
  61481. CLASS="function"
  61482. >cpdf_open()</B
  61483. ></A
  61484. >.
  61485.     </P
  61486. ></DIV
  61487. ><H1
  61488. ><A
  61489. NAME="function.cpdf-save"
  61490. ></A
  61491. >cpdf_save</H1
  61492. ><DIV
  61493. CLASS="refnamediv"
  61494. ><A
  61495. NAME="AEN12859"
  61496. ></A
  61497. ><P
  61498. >    (PHP 3>= 3.0.8, PHP 4 )</P
  61499. >cpdf_save -- Saves current environment</DIV
  61500. ><DIV
  61501. CLASS="refsect1"
  61502. ><A
  61503. NAME="AEN12862"
  61504. ></A
  61505. ><H2
  61506. >Description</H2
  61507. >bool <B
  61508. CLASS="methodname"
  61509. >cpdf_save</B
  61510. > ( int pdf_document)<BR
  61511. ></BR
  61512. ><P
  61513. >      The <B
  61514. CLASS="function"
  61515. >cpdf_save()</B
  61516. > function saves the current
  61517.      environment. It works like the postscript command gsave. Very
  61518.      useful if you want to translate or rotate an object without effecting
  61519.      other objects. Vracφ <TT
  61520. CLASS="constant"
  61521. ><B
  61522. >TRUE</B
  61523. ></TT
  61524. > p°i ·sp∞chu, <TT
  61525. CLASS="constant"
  61526. ><B
  61527. >FALSE</B
  61528. ></TT
  61529. > p°i selhßnφ.
  61530.     </P
  61531. ><P
  61532. >      See also <A
  61533. HREF="#function.cpdf-restore"
  61534. ><B
  61535. CLASS="function"
  61536. >cpdf_restore()</B
  61537. ></A
  61538. >.
  61539.     </P
  61540. ></DIV
  61541. ><H1
  61542. ><A
  61543. NAME="function.cpdf-scale"
  61544. ></A
  61545. >cpdf_scale</H1
  61546. ><DIV
  61547. CLASS="refnamediv"
  61548. ><A
  61549. NAME="AEN12877"
  61550. ></A
  61551. ><P
  61552. >    (PHP 3>= 3.0.8, PHP 4 )</P
  61553. >cpdf_scale -- Sets scaling</DIV
  61554. ><DIV
  61555. CLASS="refsect1"
  61556. ><A
  61557. NAME="AEN12880"
  61558. ></A
  61559. ><H2
  61560. >Description</H2
  61561. >bool <B
  61562. CLASS="methodname"
  61563. >cpdf_scale</B
  61564. > ( int pdf_document, float x-scale, float y-scale)<BR
  61565. ></BR
  61566. ><P
  61567. >      The <B
  61568. CLASS="function"
  61569. >cpdf_scale()</B
  61570. > function set the scaling factor
  61571.      in both directions. Vracφ <TT
  61572. CLASS="constant"
  61573. ><B
  61574. >TRUE</B
  61575. ></TT
  61576. > p°i ·sp∞chu, <TT
  61577. CLASS="constant"
  61578. ><B
  61579. >FALSE</B
  61580. ></TT
  61581. > p°i selhßnφ.
  61582.     </P
  61583. ></DIV
  61584. ><H1
  61585. ><A
  61586. NAME="function.cpdf-set-action-url"
  61587. ></A
  61588. >cpdf_set_action_url</H1
  61589. ><DIV
  61590. CLASS="refnamediv"
  61591. ><A
  61592. NAME="AEN12899"
  61593. ></A
  61594. ><P
  61595. >    (PHP 3>= 3.0.9, PHP 4 )</P
  61596. >cpdf_set_action_url -- 
  61597.      Sets hyperlink
  61598.     </DIV
  61599. ><DIV
  61600. CLASS="refsect1"
  61601. ><A
  61602. NAME="AEN12902"
  61603. ></A
  61604. ><H2
  61605. >Description</H2
  61606. >bool <B
  61607. CLASS="methodname"
  61608. >cpdf_set_action_url</B
  61609. > ( int pdfdoc, float xll, float yll, float xur, float xur, string url [, int mode])<BR
  61610. ></BR
  61611. ><P
  61612. >      <DIV
  61613. CLASS="warning"
  61614. ><P
  61615. ></P
  61616. ><TABLE
  61617. CLASS="warning"
  61618. BORDER="1"
  61619. WIDTH="100%"
  61620. ><TR
  61621. ><TD
  61622. ALIGN="CENTER"
  61623. ><B
  61624. >Varovßnφ</B
  61625. ></TD
  61626. ></TR
  61627. ><TR
  61628. ><TD
  61629. ALIGN="LEFT"
  61630. ><P
  61631. >Tato funkce je╣t∞ nenφ
  61632. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  61633. ></TD
  61634. ></TR
  61635. ></TABLE
  61636. ></DIV
  61637. >
  61638.     </P
  61639. ></DIV
  61640. ><H1
  61641. ><A
  61642. NAME="function.cpdf-set-char-spacing"
  61643. ></A
  61644. >cpdf_set_char_spacing</H1
  61645. ><DIV
  61646. CLASS="refnamediv"
  61647. ><A
  61648. NAME="AEN12932"
  61649. ></A
  61650. ><P
  61651. >    (PHP 3>= 3.0.8, PHP 4 )</P
  61652. >cpdf_set_char_spacing -- Sets character spacing</DIV
  61653. ><DIV
  61654. CLASS="refsect1"
  61655. ><A
  61656. NAME="AEN12935"
  61657. ></A
  61658. ><H2
  61659. >Description</H2
  61660. >bool <B
  61661. CLASS="methodname"
  61662. >cpdf_set_char_spacing</B
  61663. > ( int pdf_document, float space)<BR
  61664. ></BR
  61665. ><P
  61666. >      The <B
  61667. CLASS="function"
  61668. >cpdf_set_char_spacing()</B
  61669. > function sets the
  61670.      spacing between characters. Vracφ <TT
  61671. CLASS="constant"
  61672. ><B
  61673. >TRUE</B
  61674. ></TT
  61675. > p°i ·sp∞chu, <TT
  61676. CLASS="constant"
  61677. ><B
  61678. >FALSE</B
  61679. ></TT
  61680. > p°i selhßnφ.
  61681.     </P
  61682. ><P
  61683. >      See also <A
  61684. HREF="#function.cpdf-set-word-spacing"
  61685. ><B
  61686. CLASS="function"
  61687. >cpdf_set_word_spacing()</B
  61688. ></A
  61689. > and
  61690.      <A
  61691. HREF="#function.cpdf-set-leading"
  61692. ><B
  61693. CLASS="function"
  61694. >cpdf_set_leading()</B
  61695. ></A
  61696. >.
  61697.     </P
  61698. ></DIV
  61699. ><H1
  61700. ><A
  61701. NAME="function.cpdf-set-creator"
  61702. ></A
  61703. >cpdf_set_creator</H1
  61704. ><DIV
  61705. CLASS="refnamediv"
  61706. ><A
  61707. NAME="AEN12954"
  61708. ></A
  61709. ><P
  61710. >    (PHP 3>= 3.0.8, PHP 4 )</P
  61711. >cpdf_set_creator -- Sets the creator field in the pdf document</DIV
  61712. ><DIV
  61713. CLASS="refsect1"
  61714. ><A
  61715. NAME="AEN12957"
  61716. ></A
  61717. ><H2
  61718. >Description</H2
  61719. >bool <B
  61720. CLASS="methodname"
  61721. >cpdf_set_creator</B
  61722. > ( string creator)<BR
  61723. ></BR
  61724. ><P
  61725. >      The <B
  61726. CLASS="function"
  61727. >cpdf_set_creator()</B
  61728. > function sets the
  61729.      creator of a pdf document. Vracφ <TT
  61730. CLASS="constant"
  61731. ><B
  61732. >TRUE</B
  61733. ></TT
  61734. > p°i ·sp∞chu, <TT
  61735. CLASS="constant"
  61736. ><B
  61737. >FALSE</B
  61738. ></TT
  61739. > p°i selhßnφ.
  61740.     </P
  61741. ><P
  61742. >      See also <A
  61743. HREF="#function.cpdf-set-subject"
  61744. ><B
  61745. CLASS="function"
  61746. >cpdf_set_subject()</B
  61747. ></A
  61748. >,
  61749.      <A
  61750. HREF="#function.cpdf-set-title"
  61751. ><B
  61752. CLASS="function"
  61753. >cpdf_set_title()</B
  61754. ></A
  61755. > and
  61756.      <A
  61757. HREF="#function.cpdf-set-keywords"
  61758. ><B
  61759. CLASS="function"
  61760. >cpdf_set_keywords()</B
  61761. ></A
  61762. >.
  61763.     </P
  61764. ></DIV
  61765. ><H1
  61766. ><A
  61767. NAME="function.cpdf-set-current-page"
  61768. ></A
  61769. >cpdf_set_current_page</H1
  61770. ><DIV
  61771. CLASS="refnamediv"
  61772. ><A
  61773. NAME="AEN12974"
  61774. ></A
  61775. ><P
  61776. >    (PHP 3>= 3.0.9, PHP 4 )</P
  61777. >cpdf_set_current_page -- Sets current page</DIV
  61778. ><DIV
  61779. CLASS="refsect1"
  61780. ><A
  61781. NAME="AEN12977"
  61782. ></A
  61783. ><H2
  61784. >Description</H2
  61785. >bool <B
  61786. CLASS="methodname"
  61787. >cpdf_set_current_page</B
  61788. > ( int pdf_document, int page_number)<BR
  61789. ></BR
  61790. ><P
  61791. >      The <B
  61792. CLASS="function"
  61793. >cpdf_set_current_page()</B
  61794. > function set the page
  61795.      on which all operations are performed. One can switch between pages
  61796.      until a page is finished with <A
  61797. HREF="#function.cpdf-finalize-page"
  61798. ><B
  61799. CLASS="function"
  61800. >cpdf_finalize_page()</B
  61801. ></A
  61802. >.
  61803.      Vracφ <TT
  61804. CLASS="constant"
  61805. ><B
  61806. >TRUE</B
  61807. ></TT
  61808. > p°i ·sp∞chu, <TT
  61809. CLASS="constant"
  61810. ><B
  61811. >FALSE</B
  61812. ></TT
  61813. > p°i selhßnφ.
  61814.     </P
  61815. ><P
  61816. >      See also <A
  61817. HREF="#function.cpdf-finalize-page"
  61818. ><B
  61819. CLASS="function"
  61820. >cpdf_finalize_page()</B
  61821. ></A
  61822. >.
  61823.     </P
  61824. ></DIV
  61825. ><H1
  61826. ><A
  61827. NAME="function.cpdf-set-font-directories"
  61828. ></A
  61829. >cpdf_set_font_directories</H1
  61830. ><DIV
  61831. CLASS="refnamediv"
  61832. ><A
  61833. NAME="AEN12996"
  61834. ></A
  61835. ><P
  61836. >    (PHP 4 >= 4.0.6)</P
  61837. >cpdf_set_font_directories -- 
  61838.      Sets directories to search when using external fonts
  61839.     </DIV
  61840. ><DIV
  61841. CLASS="refsect1"
  61842. ><A
  61843. NAME="AEN12999"
  61844. ></A
  61845. ><H2
  61846. >Description</H2
  61847. >bool <B
  61848. CLASS="methodname"
  61849. >cpdf_set_font_directories</B
  61850. > ( int pdfdoc, string pfmdir, string pfbdir)<BR
  61851. ></BR
  61852. ><P
  61853. >      <DIV
  61854. CLASS="warning"
  61855. ><P
  61856. ></P
  61857. ><TABLE
  61858. CLASS="warning"
  61859. BORDER="1"
  61860. WIDTH="100%"
  61861. ><TR
  61862. ><TD
  61863. ALIGN="CENTER"
  61864. ><B
  61865. >Varovßnφ</B
  61866. ></TD
  61867. ></TR
  61868. ><TR
  61869. ><TD
  61870. ALIGN="LEFT"
  61871. ><P
  61872. >Tato funkce je╣t∞ nenφ
  61873. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  61874. ></TD
  61875. ></TR
  61876. ></TABLE
  61877. ></DIV
  61878. >
  61879.     </P
  61880. ></DIV
  61881. ><H1
  61882. ><A
  61883. NAME="function.cpdf-set-font-map-file"
  61884. ></A
  61885. >cpdf_set_font_map_file</H1
  61886. ><DIV
  61887. CLASS="refnamediv"
  61888. ><A
  61889. NAME="AEN13017"
  61890. ></A
  61891. ><P
  61892. >    (PHP 4 >= 4.0.6)</P
  61893. >cpdf_set_font_map_file -- 
  61894.      Sets fontname to filename translation map when using external fonts
  61895.     </DIV
  61896. ><DIV
  61897. CLASS="refsect1"
  61898. ><A
  61899. NAME="AEN13020"
  61900. ></A
  61901. ><H2
  61902. >Description</H2
  61903. >bool <B
  61904. CLASS="methodname"
  61905. >cpdf_set_font_map_file</B
  61906. > ( int pdfdoc, string filename)<BR
  61907. ></BR
  61908. ><P
  61909. >      <DIV
  61910. CLASS="warning"
  61911. ><P
  61912. ></P
  61913. ><TABLE
  61914. CLASS="warning"
  61915. BORDER="1"
  61916. WIDTH="100%"
  61917. ><TR
  61918. ><TD
  61919. ALIGN="CENTER"
  61920. ><B
  61921. >Varovßnφ</B
  61922. ></TD
  61923. ></TR
  61924. ><TR
  61925. ><TD
  61926. ALIGN="LEFT"
  61927. ><P
  61928. >Tato funkce je╣t∞ nenφ
  61929. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  61930. ></TD
  61931. ></TR
  61932. ></TABLE
  61933. ></DIV
  61934. >
  61935.     </P
  61936. ></DIV
  61937. ><H1
  61938. ><A
  61939. NAME="function.cpdf-set-font"
  61940. ></A
  61941. >cpdf_set_font</H1
  61942. ><DIV
  61943. CLASS="refnamediv"
  61944. ><A
  61945. NAME="AEN13035"
  61946. ></A
  61947. ><P
  61948. >    (PHP 3>= 3.0.8, PHP 4 )</P
  61949. >cpdf_set_font -- Select the current font face and size</DIV
  61950. ><DIV
  61951. CLASS="refsect1"
  61952. ><A
  61953. NAME="AEN13038"
  61954. ></A
  61955. ><H2
  61956. >Description</H2
  61957. >bool <B
  61958. CLASS="methodname"
  61959. >cpdf_set_font</B
  61960. > ( int pdf_document, string font_name, float size, string encoding)<BR
  61961. ></BR
  61962. ><P
  61963. >      The <B
  61964. CLASS="function"
  61965. >cpdf_set_font()</B
  61966. > function sets the
  61967.      current font face, font size and encoding. Currently only
  61968.      the standard postscript fonts are supported. Vracφ <TT
  61969. CLASS="constant"
  61970. ><B
  61971. >TRUE</B
  61972. ></TT
  61973. > p°i ·sp∞chu, <TT
  61974. CLASS="constant"
  61975. ><B
  61976. >FALSE</B
  61977. ></TT
  61978. > p°i selhßnφ.
  61979.     </P
  61980. ><P
  61981. >      The last parameter <TT
  61982. CLASS="parameter"
  61983. ><I
  61984. >encoding</I
  61985. ></TT
  61986. > can take the
  61987.      following values: "MacRomanEncoding", "MacExpertEncoding",
  61988.      "WinAnsiEncoding", and "<TT
  61989. CLASS="constant"
  61990. ><B
  61991. >NULL</B
  61992. ></TT
  61993. >". "<TT
  61994. CLASS="constant"
  61995. ><B
  61996. >NULL</B
  61997. ></TT
  61998. >" stands for the font's
  61999.      built-in encoding.
  62000.     </P
  62001. ><P
  62002. >      See the ClibPDF Manual for more information, especially how to support
  62003.      Asian fonts.
  62004.     </P
  62005. ></DIV
  62006. ><H1
  62007. ><A
  62008. NAME="function.cpdf-set-horiz-scaling"
  62009. ></A
  62010. >cpdf_set_horiz_scaling</H1
  62011. ><DIV
  62012. CLASS="refnamediv"
  62013. ><A
  62014. NAME="AEN13065"
  62015. ></A
  62016. ><P
  62017. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62018. >cpdf_set_horiz_scaling -- Sets horizontal scaling of text</DIV
  62019. ><DIV
  62020. CLASS="refsect1"
  62021. ><A
  62022. NAME="AEN13068"
  62023. ></A
  62024. ><H2
  62025. >Description</H2
  62026. >bool <B
  62027. CLASS="methodname"
  62028. >cpdf_set_horiz_scaling</B
  62029. > ( int pdf_document, float scale)<BR
  62030. ></BR
  62031. ><P
  62032. >      The <B
  62033. CLASS="function"
  62034. >cpdf_set_horiz_scaling()</B
  62035. > function sets the
  62036.      horizontal scaling to <TT
  62037. CLASS="parameter"
  62038. ><I
  62039. >scale</I
  62040. ></TT
  62041. > percent.
  62042.      Vracφ <TT
  62043. CLASS="constant"
  62044. ><B
  62045. >TRUE</B
  62046. ></TT
  62047. > p°i ·sp∞chu, <TT
  62048. CLASS="constant"
  62049. ><B
  62050. >FALSE</B
  62051. ></TT
  62052. > p°i selhßnφ.
  62053.     </P
  62054. ></DIV
  62055. ><H1
  62056. ><A
  62057. NAME="function.cpdf-set-keywords"
  62058. ></A
  62059. >cpdf_set_keywords</H1
  62060. ><DIV
  62061. CLASS="refnamediv"
  62062. ><A
  62063. NAME="AEN13085"
  62064. ></A
  62065. ><P
  62066. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62067. >cpdf_set_keywords -- Sets the keywords field of the pdf document</DIV
  62068. ><DIV
  62069. CLASS="refsect1"
  62070. ><A
  62071. NAME="AEN13088"
  62072. ></A
  62073. ><H2
  62074. >Description</H2
  62075. >bool <B
  62076. CLASS="methodname"
  62077. >cpdf_set_keywords</B
  62078. > ( string keywords)<BR
  62079. ></BR
  62080. ><P
  62081. >      The <B
  62082. CLASS="function"
  62083. >cpdf_set_keywords()</B
  62084. > function sets the
  62085.      keywords of a pdf document. Vracφ <TT
  62086. CLASS="constant"
  62087. ><B
  62088. >TRUE</B
  62089. ></TT
  62090. > p°i ·sp∞chu, <TT
  62091. CLASS="constant"
  62092. ><B
  62093. >FALSE</B
  62094. ></TT
  62095. > p°i selhßnφ.
  62096.     </P
  62097. ><P
  62098. >      See also <A
  62099. HREF="#function.cpdf-set-title"
  62100. ><B
  62101. CLASS="function"
  62102. >cpdf_set_title()</B
  62103. ></A
  62104. >,
  62105.      <A
  62106. HREF="#function.cpdf-set-creator"
  62107. ><B
  62108. CLASS="function"
  62109. >cpdf_set_creator()</B
  62110. ></A
  62111. > and
  62112.      <A
  62113. HREF="#function.cpdf-set-subject"
  62114. ><B
  62115. CLASS="function"
  62116. >cpdf_set_subject()</B
  62117. ></A
  62118. >.
  62119.     </P
  62120. ></DIV
  62121. ><H1
  62122. ><A
  62123. NAME="function.cpdf-set-leading"
  62124. ></A
  62125. >cpdf_set_leading</H1
  62126. ><DIV
  62127. CLASS="refnamediv"
  62128. ><A
  62129. NAME="AEN13105"
  62130. ></A
  62131. ><P
  62132. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62133. >cpdf_set_leading -- Sets distance between text lines</DIV
  62134. ><DIV
  62135. CLASS="refsect1"
  62136. ><A
  62137. NAME="AEN13108"
  62138. ></A
  62139. ><H2
  62140. >Description</H2
  62141. >bool <B
  62142. CLASS="methodname"
  62143. >cpdf_set_leading</B
  62144. > ( int pdf_document, float distance)<BR
  62145. ></BR
  62146. ><P
  62147. >      The <B
  62148. CLASS="function"
  62149. >cpdf_set_leading()</B
  62150. > function sets the 
  62151.      <TT
  62152. CLASS="parameter"
  62153. ><I
  62154. >distance</I
  62155. ></TT
  62156. > between text lines. This will 
  62157.      be used if text is output by <A
  62158. HREF="#function.cpdf-continue-text"
  62159. ><B
  62160. CLASS="function"
  62161. >cpdf_continue_text()</B
  62162. ></A
  62163. >.
  62164.      Vracφ <TT
  62165. CLASS="constant"
  62166. ><B
  62167. >TRUE</B
  62168. ></TT
  62169. > p°i ·sp∞chu, <TT
  62170. CLASS="constant"
  62171. ><B
  62172. >FALSE</B
  62173. ></TT
  62174. > p°i selhßnφ.
  62175.     </P
  62176. ><P
  62177. >      See also <A
  62178. HREF="#function.cpdf-continue-text"
  62179. ><B
  62180. CLASS="function"
  62181. >cpdf_continue_text()</B
  62182. ></A
  62183. >.
  62184.     </P
  62185. ></DIV
  62186. ><H1
  62187. ><A
  62188. NAME="function.cpdf-set-page-animation"
  62189. ></A
  62190. >cpdf_set_page_animation</H1
  62191. ><DIV
  62192. CLASS="refnamediv"
  62193. ><A
  62194. NAME="AEN13128"
  62195. ></A
  62196. ><P
  62197. >    (PHP 3>= 3.0.9, PHP 4 )</P
  62198. >cpdf_set_page_animation -- Sets duration between pages</DIV
  62199. ><DIV
  62200. CLASS="refsect1"
  62201. ><A
  62202. NAME="AEN13131"
  62203. ></A
  62204. ><H2
  62205. >Description</H2
  62206. >bool <B
  62207. CLASS="methodname"
  62208. >cpdf_set_page_animation</B
  62209. > ( int pdf_document, int transition, float duration)<BR
  62210. ></BR
  62211. ><P
  62212. >      The <B
  62213. CLASS="function"
  62214. >cpdf_set_page_animation()</B
  62215. > function set the
  62216.      transition between following pages. Vracφ <TT
  62217. CLASS="constant"
  62218. ><B
  62219. >TRUE</B
  62220. ></TT
  62221. > p°i ·sp∞chu, <TT
  62222. CLASS="constant"
  62223. ><B
  62224. >FALSE</B
  62225. ></TT
  62226. > p°i selhßnφ.
  62227.     </P
  62228. ><P
  62229. >      The value of <TT
  62230. CLASS="parameter"
  62231. ><I
  62232. >transition</I
  62233. ></TT
  62234. >
  62235.      can be
  62236.      <P
  62237. ></P
  62238. ><TABLE
  62239. BORDER="0"
  62240. ><TBODY
  62241. ><TR
  62242. ><TD
  62243. >0 for none,</TD
  62244. ></TR
  62245. ><TR
  62246. ><TD
  62247. >        1 for two lines sweeping across the screen reveal the page,
  62248.       </TD
  62249. ></TR
  62250. ><TR
  62251. ><TD
  62252. >        2 for multiple lines sweeping across the screen reveal the page,
  62253.       </TD
  62254. ></TR
  62255. ><TR
  62256. ><TD
  62257. >3 for a box reveals the page,</TD
  62258. ></TR
  62259. ><TR
  62260. ><TD
  62261. >        4 for a single line sweeping across the screen reveals the page,
  62262.       </TD
  62263. ></TR
  62264. ><TR
  62265. ><TD
  62266. >5 for the old page dissolves to reveal the page,</TD
  62267. ></TR
  62268. ><TR
  62269. ><TD
  62270. >        6 for the dissolve effect moves from one screen edge to another,
  62271.       </TD
  62272. ></TR
  62273. ><TR
  62274. ><TD
  62275. >        7 for the old page is simply replaced by the new page (default)
  62276.       </TD
  62277. ></TR
  62278. ></TBODY
  62279. ></TABLE
  62280. ><P
  62281. ></P
  62282. >
  62283.     </P
  62284. ><P
  62285. >      The value of <TT
  62286. CLASS="parameter"
  62287. ><I
  62288. >duration</I
  62289. ></TT
  62290. > is the number of seconds
  62291.      between page flipping.
  62292.     </P
  62293. ></DIV
  62294. ><H1
  62295. ><A
  62296. NAME="function.cpdf-set-subject"
  62297. ></A
  62298. >cpdf_set_subject</H1
  62299. ><DIV
  62300. CLASS="refnamediv"
  62301. ><A
  62302. NAME="AEN13163"
  62303. ></A
  62304. ><P
  62305. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62306. >cpdf_set_subject -- Sets the subject field of the pdf document</DIV
  62307. ><DIV
  62308. CLASS="refsect1"
  62309. ><A
  62310. NAME="AEN13166"
  62311. ></A
  62312. ><H2
  62313. >Description</H2
  62314. >bool <B
  62315. CLASS="methodname"
  62316. >cpdf_set_subject</B
  62317. > ( int pdf_document, string subject)<BR
  62318. ></BR
  62319. ><P
  62320. >      The <B
  62321. CLASS="function"
  62322. >cpdf_set_subject()</B
  62323. > function sets the
  62324.      <TT
  62325. CLASS="parameter"
  62326. ><I
  62327. >subject</I
  62328. ></TT
  62329. > of a pdf document. Vracφ <TT
  62330. CLASS="constant"
  62331. ><B
  62332. >TRUE</B
  62333. ></TT
  62334. > p°i ·sp∞chu, <TT
  62335. CLASS="constant"
  62336. ><B
  62337. >FALSE</B
  62338. ></TT
  62339. > p°i selhßnφ.
  62340.     </P
  62341. ><P
  62342. >      See also <A
  62343. HREF="#function.cpdf-set-title"
  62344. ><B
  62345. CLASS="function"
  62346. >cpdf_set_title()</B
  62347. ></A
  62348. >,
  62349.      <A
  62350. HREF="#function.cpdf-set-creator"
  62351. ><B
  62352. CLASS="function"
  62353. >cpdf_set_creator()</B
  62354. ></A
  62355. > and
  62356.      <A
  62357. HREF="#function.cpdf-set-keywords"
  62358. ><B
  62359. CLASS="function"
  62360. >cpdf_set_keywords()</B
  62361. ></A
  62362. >.
  62363.     </P
  62364. ></DIV
  62365. ><H1
  62366. ><A
  62367. NAME="function.cpdf-set-text-matrix"
  62368. ></A
  62369. >cpdf_set_text_matrix</H1
  62370. ><DIV
  62371. CLASS="refnamediv"
  62372. ><A
  62373. NAME="AEN13187"
  62374. ></A
  62375. ><P
  62376. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62377. >cpdf_set_text_matrix -- Sets the text matrix</DIV
  62378. ><DIV
  62379. CLASS="refsect1"
  62380. ><A
  62381. NAME="AEN13190"
  62382. ></A
  62383. ><H2
  62384. >Description</H2
  62385. >bool <B
  62386. CLASS="methodname"
  62387. >cpdf_set_text_matrix</B
  62388. > ( int pdf_document, array matrix)<BR
  62389. ></BR
  62390. ><P
  62391. >      The <B
  62392. CLASS="function"
  62393. >cpdf_set_text_matrix()</B
  62394. > function sets
  62395.      a <TT
  62396. CLASS="parameter"
  62397. ><I
  62398. >matrix</I
  62399. ></TT
  62400. > which describes a transformation 
  62401.      applied on the current text font. Vracφ <TT
  62402. CLASS="constant"
  62403. ><B
  62404. >TRUE</B
  62405. ></TT
  62406. > p°i ·sp∞chu, <TT
  62407. CLASS="constant"
  62408. ><B
  62409. >FALSE</B
  62410. ></TT
  62411. > p°i selhßnφ.
  62412.     </P
  62413. ></DIV
  62414. ><H1
  62415. ><A
  62416. NAME="function.cpdf-set-text-pos"
  62417. ></A
  62418. >cpdf_set_text_pos</H1
  62419. ><DIV
  62420. CLASS="refnamediv"
  62421. ><A
  62422. NAME="AEN13207"
  62423. ></A
  62424. ><P
  62425. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62426. >cpdf_set_text_pos -- Sets text position</DIV
  62427. ><DIV
  62428. CLASS="refsect1"
  62429. ><A
  62430. NAME="AEN13210"
  62431. ></A
  62432. ><H2
  62433. >Description</H2
  62434. >bool <B
  62435. CLASS="methodname"
  62436. >cpdf_set_text_pos</B
  62437. > ( int pdf_document, float x-coor, float y-coor [, int mode])<BR
  62438. ></BR
  62439. ><P
  62440. >      The <B
  62441. CLASS="function"
  62442. >cpdf_set_text_pos()</B
  62443. > function sets the
  62444.      position of text for the next <A
  62445. HREF="#function.cpdf-show"
  62446. ><B
  62447. CLASS="function"
  62448. >cpdf_show()</B
  62449. ></A
  62450.      function call. Vracφ <TT
  62451. CLASS="constant"
  62452. ><B
  62453. >TRUE</B
  62454. ></TT
  62455. > p°i ·sp∞chu, <TT
  62456. CLASS="constant"
  62457. ><B
  62458. >FALSE</B
  62459. ></TT
  62460. > p°i selhßnφ.
  62461.     </P
  62462. ><P
  62463. >Nepovinn² parametr <TT
  62464. CLASS="parameter"
  62465. ><I
  62466. >mode</I
  62467. ></TT
  62468. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  62469. ><P
  62470. >      See also <A
  62471. HREF="#function.cpdf-show"
  62472. ><B
  62473. CLASS="function"
  62474. >cpdf_show()</B
  62475. ></A
  62476. > and
  62477.      <A
  62478. HREF="#function.cpdf-text"
  62479. ><B
  62480. CLASS="function"
  62481. >cpdf_text()</B
  62482. ></A
  62483. >.
  62484.     </P
  62485. ></DIV
  62486. ><H1
  62487. ><A
  62488. NAME="function.cpdf-set-text-rendering"
  62489. ></A
  62490. >cpdf_set_text_rendering</H1
  62491. ><DIV
  62492. CLASS="refnamediv"
  62493. ><A
  62494. NAME="AEN13238"
  62495. ></A
  62496. ><P
  62497. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62498. >cpdf_set_text_rendering -- Determines how text is rendered</DIV
  62499. ><DIV
  62500. CLASS="refsect1"
  62501. ><A
  62502. NAME="AEN13241"
  62503. ></A
  62504. ><H2
  62505. >Description</H2
  62506. >bool <B
  62507. CLASS="methodname"
  62508. >cpdf_set_text_rendering</B
  62509. > ( int pdf_document, int rendermode)<BR
  62510. ></BR
  62511. ><P
  62512. >      The <B
  62513. CLASS="function"
  62514. >cpdf_set_text_rendering()</B
  62515. > function
  62516.      determines how text is rendered. Vracφ <TT
  62517. CLASS="constant"
  62518. ><B
  62519. >TRUE</B
  62520. ></TT
  62521. > p°i ·sp∞chu, <TT
  62522. CLASS="constant"
  62523. ><B
  62524. >FALSE</B
  62525. ></TT
  62526. > p°i selhßnφ.
  62527.     </P
  62528. ><P
  62529. >      The possible values for <TT
  62530. CLASS="parameter"
  62531. ><I
  62532. >rendermode</I
  62533. ></TT
  62534. > are 0=fill
  62535.      text, 1=stroke text, 2=fill and stroke text, 3=invisible, 4=fill
  62536.      text and add it to clipping path, 5=stroke text and add it to
  62537.      clipping path, 6=fill and stroke text and add it to clipping
  62538.      path, 7=add it to clipping path.
  62539.     </P
  62540. ></DIV
  62541. ><H1
  62542. ><A
  62543. NAME="function.cpdf-set-text-rise"
  62544. ></A
  62545. >cpdf_set_text_rise</H1
  62546. ><DIV
  62547. CLASS="refnamediv"
  62548. ><A
  62549. NAME="AEN13259"
  62550. ></A
  62551. ><P
  62552. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62553. >cpdf_set_text_rise -- Sets the text rise</DIV
  62554. ><DIV
  62555. CLASS="refsect1"
  62556. ><A
  62557. NAME="AEN13262"
  62558. ></A
  62559. ><H2
  62560. >Description</H2
  62561. >bool <B
  62562. CLASS="methodname"
  62563. >cpdf_set_text_rise</B
  62564. > ( int pdf_document, float value)<BR
  62565. ></BR
  62566. ><P
  62567. >      The <B
  62568. CLASS="function"
  62569. >cpdf_set_text_rise()</B
  62570. > function sets the
  62571.      text rising to <TT
  62572. CLASS="parameter"
  62573. ><I
  62574. >value</I
  62575. ></TT
  62576. > units. Vracφ <TT
  62577. CLASS="constant"
  62578. ><B
  62579. >TRUE</B
  62580. ></TT
  62581. > p°i ·sp∞chu, <TT
  62582. CLASS="constant"
  62583. ><B
  62584. >FALSE</B
  62585. ></TT
  62586. > p°i selhßnφ.
  62587.     </P
  62588. ></DIV
  62589. ><H1
  62590. ><A
  62591. NAME="function.cpdf-set-title"
  62592. ></A
  62593. >cpdf_set_title</H1
  62594. ><DIV
  62595. CLASS="refnamediv"
  62596. ><A
  62597. NAME="AEN13279"
  62598. ></A
  62599. ><P
  62600. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62601. >cpdf_set_title -- Sets the title field of the pdf document</DIV
  62602. ><DIV
  62603. CLASS="refsect1"
  62604. ><A
  62605. NAME="AEN13282"
  62606. ></A
  62607. ><H2
  62608. >Description</H2
  62609. >bool <B
  62610. CLASS="methodname"
  62611. >cpdf_set_title</B
  62612. > ( string title)<BR
  62613. ></BR
  62614. ><P
  62615. >      The <B
  62616. CLASS="function"
  62617. >cpdf_set_title()</B
  62618. > function sets the
  62619.      <TT
  62620. CLASS="parameter"
  62621. ><I
  62622. >title</I
  62623. ></TT
  62624. > of a pdf document. Vracφ <TT
  62625. CLASS="constant"
  62626. ><B
  62627. >TRUE</B
  62628. ></TT
  62629. > p°i ·sp∞chu, <TT
  62630. CLASS="constant"
  62631. ><B
  62632. >FALSE</B
  62633. ></TT
  62634. > p°i selhßnφ.
  62635.     </P
  62636. ><P
  62637. >      See also <A
  62638. HREF="#function.cpdf-set-subject"
  62639. ><B
  62640. CLASS="function"
  62641. >cpdf_set_subject()</B
  62642. ></A
  62643. >,
  62644.      <A
  62645. HREF="#function.cpdf-set-creator"
  62646. ><B
  62647. CLASS="function"
  62648. >cpdf_set_creator()</B
  62649. ></A
  62650. > and
  62651.      <A
  62652. HREF="#function.cpdf-set-keywords"
  62653. ><B
  62654. CLASS="function"
  62655. >cpdf_set_keywords()</B
  62656. ></A
  62657. >.
  62658.     </P
  62659. ></DIV
  62660. ><H1
  62661. ><A
  62662. NAME="function.cpdf-set-viewer-preferences"
  62663. ></A
  62664. >cpdf_set_viewer_preferences</H1
  62665. ><DIV
  62666. CLASS="refnamediv"
  62667. ><A
  62668. NAME="AEN13300"
  62669. ></A
  62670. ><P
  62671. >    (PHP 3>= 3.0.9, PHP 4 )</P
  62672. >cpdf_set_viewer_preferences -- 
  62673.      How to show the document in the viewer
  62674.     </DIV
  62675. ><DIV
  62676. CLASS="refsect1"
  62677. ><A
  62678. NAME="AEN13303"
  62679. ></A
  62680. ><H2
  62681. >Description</H2
  62682. >bool <B
  62683. CLASS="methodname"
  62684. >cpdf_set_viewer_preferences</B
  62685. > ( int pdfdoc, array preferences)<BR
  62686. ></BR
  62687. ><P
  62688. >      <DIV
  62689. CLASS="warning"
  62690. ><P
  62691. ></P
  62692. ><TABLE
  62693. CLASS="warning"
  62694. BORDER="1"
  62695. WIDTH="100%"
  62696. ><TR
  62697. ><TD
  62698. ALIGN="CENTER"
  62699. ><B
  62700. >Varovßnφ</B
  62701. ></TD
  62702. ></TR
  62703. ><TR
  62704. ><TD
  62705. ALIGN="LEFT"
  62706. ><P
  62707. >Tato funkce je╣t∞ nenφ
  62708. zdokumentovßna, k dispozici je pouze seznam argument∙.</P
  62709. ></TD
  62710. ></TR
  62711. ></TABLE
  62712. ></DIV
  62713. >
  62714.     </P
  62715. ></DIV
  62716. ><H1
  62717. ><A
  62718. NAME="function.cpdf-set-word-spacing"
  62719. ></A
  62720. >cpdf_set_word_spacing</H1
  62721. ><DIV
  62722. CLASS="refnamediv"
  62723. ><A
  62724. NAME="AEN13318"
  62725. ></A
  62726. ><P
  62727. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62728. >cpdf_set_word_spacing -- Sets spacing between words</DIV
  62729. ><DIV
  62730. CLASS="refsect1"
  62731. ><A
  62732. NAME="AEN13321"
  62733. ></A
  62734. ><H2
  62735. >Description</H2
  62736. >bool <B
  62737. CLASS="methodname"
  62738. >cpdf_set_word_spacing</B
  62739. > ( int pdf_document, float space)<BR
  62740. ></BR
  62741. ><P
  62742. >      The <B
  62743. CLASS="function"
  62744. >cpdf_set_word_spacing()</B
  62745. > function sets the
  62746.      spacing between words. Vracφ <TT
  62747. CLASS="constant"
  62748. ><B
  62749. >TRUE</B
  62750. ></TT
  62751. > p°i ·sp∞chu, <TT
  62752. CLASS="constant"
  62753. ><B
  62754. >FALSE</B
  62755. ></TT
  62756. > p°i selhßnφ.
  62757.     </P
  62758. ><P
  62759. >      See also <A
  62760. HREF="#function.cpdf-set-char-spacing"
  62761. ><B
  62762. CLASS="function"
  62763. >cpdf_set_char_spacing()</B
  62764. ></A
  62765. > and
  62766.      <A
  62767. HREF="#function.cpdf-set-leading"
  62768. ><B
  62769. CLASS="function"
  62770. >cpdf_set_leading()</B
  62771. ></A
  62772. >.
  62773.     </P
  62774. ></DIV
  62775. ><H1
  62776. ><A
  62777. NAME="function.cpdf-setdash"
  62778. ></A
  62779. >cpdf_setdash</H1
  62780. ><DIV
  62781. CLASS="refnamediv"
  62782. ><A
  62783. NAME="AEN13340"
  62784. ></A
  62785. ><P
  62786. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62787. >cpdf_setdash -- Sets dash pattern</DIV
  62788. ><DIV
  62789. CLASS="refsect1"
  62790. ><A
  62791. NAME="AEN13343"
  62792. ></A
  62793. ><H2
  62794. >Description</H2
  62795. >bool <B
  62796. CLASS="methodname"
  62797. >cpdf_setdash</B
  62798. > ( int pdf_document, float white, float black)<BR
  62799. ></BR
  62800. ><P
  62801. >      The <B
  62802. CLASS="function"
  62803. >cpdf_setdash()</B
  62804. > function set the dash
  62805.      pattern <TT
  62806. CLASS="parameter"
  62807. ><I
  62808. >white</I
  62809. ></TT
  62810. > white units and
  62811.      <TT
  62812. CLASS="parameter"
  62813. ><I
  62814. >black</I
  62815. ></TT
  62816. > black units. If both are 0 a solid
  62817.      line is set. Vracφ <TT
  62818. CLASS="constant"
  62819. ><B
  62820. >TRUE</B
  62821. ></TT
  62822. > p°i ·sp∞chu, <TT
  62823. CLASS="constant"
  62824. ><B
  62825. >FALSE</B
  62826. ></TT
  62827. > p°i selhßnφ.
  62828.     </P
  62829. ></DIV
  62830. ><H1
  62831. ><A
  62832. NAME="function.cpdf-setflat"
  62833. ></A
  62834. >cpdf_setflat</H1
  62835. ><DIV
  62836. CLASS="refnamediv"
  62837. ><A
  62838. NAME="AEN13364"
  62839. ></A
  62840. ><P
  62841. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62842. >cpdf_setflat -- Sets flatness</DIV
  62843. ><DIV
  62844. CLASS="refsect1"
  62845. ><A
  62846. NAME="AEN13367"
  62847. ></A
  62848. ><H2
  62849. >Description</H2
  62850. >bool <B
  62851. CLASS="methodname"
  62852. >cpdf_setflat</B
  62853. > ( int pdf_document, float value)<BR
  62854. ></BR
  62855. ><P
  62856. >      The <B
  62857. CLASS="function"
  62858. >cpdf_setflat()</B
  62859. > function set the flatness to
  62860.      a value between 0 and 100. Vracφ <TT
  62861. CLASS="constant"
  62862. ><B
  62863. >TRUE</B
  62864. ></TT
  62865. > p°i ·sp∞chu, <TT
  62866. CLASS="constant"
  62867. ><B
  62868. >FALSE</B
  62869. ></TT
  62870. > p°i selhßnφ.
  62871.     </P
  62872. ></DIV
  62873. ><H1
  62874. ><A
  62875. NAME="function.cpdf-setgray-fill"
  62876. ></A
  62877. >cpdf_setgray_fill</H1
  62878. ><DIV
  62879. CLASS="refnamediv"
  62880. ><A
  62881. NAME="AEN13383"
  62882. ></A
  62883. ><P
  62884. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62885. >cpdf_setgray_fill -- Sets filling color to gray value</DIV
  62886. ><DIV
  62887. CLASS="refsect1"
  62888. ><A
  62889. NAME="AEN13386"
  62890. ></A
  62891. ><H2
  62892. >Description</H2
  62893. >bool <B
  62894. CLASS="methodname"
  62895. >cpdf_setgray_fill</B
  62896. > ( int pdf_document, float value)<BR
  62897. ></BR
  62898. ><P
  62899. >      The <B
  62900. CLASS="function"
  62901. >cpdf_setgray_fill()</B
  62902. > function sets the current
  62903.      gray <TT
  62904. CLASS="parameter"
  62905. ><I
  62906. >value</I
  62907. ></TT
  62908. > to fill a path. Vracφ <TT
  62909. CLASS="constant"
  62910. ><B
  62911. >TRUE</B
  62912. ></TT
  62913. > p°i ·sp∞chu, <TT
  62914. CLASS="constant"
  62915. ><B
  62916. >FALSE</B
  62917. ></TT
  62918. > p°i selhßnφ.
  62919.     </P
  62920. ><P
  62921. >      See also <A
  62922. HREF="#function.cpdf-setrgbcolor-fill"
  62923. ><B
  62924. CLASS="function"
  62925. >cpdf_setrgbcolor_fill()</B
  62926. ></A
  62927. >.
  62928.     </P
  62929. ></DIV
  62930. ><H1
  62931. ><A
  62932. NAME="function.cpdf-setgray-stroke"
  62933. ></A
  62934. >cpdf_setgray_stroke</H1
  62935. ><DIV
  62936. CLASS="refnamediv"
  62937. ><A
  62938. NAME="AEN13405"
  62939. ></A
  62940. ><P
  62941. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62942. >cpdf_setgray_stroke -- Sets drawing color to gray value</DIV
  62943. ><DIV
  62944. CLASS="refsect1"
  62945. ><A
  62946. NAME="AEN13408"
  62947. ></A
  62948. ><H2
  62949. >Description</H2
  62950. >bool <B
  62951. CLASS="methodname"
  62952. >cpdf_setgray_stroke</B
  62953. > ( int pdf_document, float gray_value)<BR
  62954. ></BR
  62955. ><P
  62956. >      The <B
  62957. CLASS="function"
  62958. >cpdf_setgray_stroke()</B
  62959. > function sets the current
  62960.      drawing color to the given gray value. Vracφ <TT
  62961. CLASS="constant"
  62962. ><B
  62963. >TRUE</B
  62964. ></TT
  62965. > p°i ·sp∞chu, <TT
  62966. CLASS="constant"
  62967. ><B
  62968. >FALSE</B
  62969. ></TT
  62970. > p°i selhßnφ.
  62971.     </P
  62972. ><P
  62973. >      See also <A
  62974. HREF="#function.cpdf-setrgbcolor-stroke"
  62975. ><B
  62976. CLASS="function"
  62977. >cpdf_setrgbcolor_stroke()</B
  62978. ></A
  62979. >.
  62980.     </P
  62981. ></DIV
  62982. ><H1
  62983. ><A
  62984. NAME="function.cpdf-setgray"
  62985. ></A
  62986. >cpdf_setgray</H1
  62987. ><DIV
  62988. CLASS="refnamediv"
  62989. ><A
  62990. NAME="AEN13426"
  62991. ></A
  62992. ><P
  62993. >    (PHP 3>= 3.0.8, PHP 4 )</P
  62994. >cpdf_setgray -- Sets drawing and filling color to gray value</DIV
  62995. ><DIV
  62996. CLASS="refsect1"
  62997. ><A
  62998. NAME="AEN13429"
  62999. ></A
  63000. ><H2
  63001. >Description</H2
  63002. >bool <B
  63003. CLASS="methodname"
  63004. >cpdf_setgray</B
  63005. > ( int pdf_document, float gray_value)<BR
  63006. ></BR
  63007. ><P
  63008. >      The <B
  63009. CLASS="function"
  63010. >cpdf_setgray()</B
  63011. > function sets the current
  63012.      drawing and filling color to the given gray value. Vracφ <TT
  63013. CLASS="constant"
  63014. ><B
  63015. >TRUE</B
  63016. ></TT
  63017. > p°i ·sp∞chu, <TT
  63018. CLASS="constant"
  63019. ><B
  63020. >FALSE</B
  63021. ></TT
  63022. > p°i selhßnφ.
  63023.     </P
  63024. ><P
  63025. >      See also <A
  63026. HREF="#function.cpdf-setrgbcolor-stroke"
  63027. ><B
  63028. CLASS="function"
  63029. >cpdf_setrgbcolor_stroke()</B
  63030. ></A
  63031. > and
  63032.      <A
  63033. HREF="#function.cpdf-setrgbcolor-fill"
  63034. ><B
  63035. CLASS="function"
  63036. >cpdf_setrgbcolor_fill()</B
  63037. ></A
  63038. >.
  63039.     </P
  63040. ></DIV
  63041. ><H1
  63042. ><A
  63043. NAME="function.cpdf-setlinecap"
  63044. ></A
  63045. >cpdf_setlinecap</H1
  63046. ><DIV
  63047. CLASS="refnamediv"
  63048. ><A
  63049. NAME="AEN13448"
  63050. ></A
  63051. ><P
  63052. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63053. >cpdf_setlinecap -- Sets linecap parameter</DIV
  63054. ><DIV
  63055. CLASS="refsect1"
  63056. ><A
  63057. NAME="AEN13451"
  63058. ></A
  63059. ><H2
  63060. >Description</H2
  63061. >bool <B
  63062. CLASS="methodname"
  63063. >cpdf_setlinecap</B
  63064. > ( int pdf_document, int value)<BR
  63065. ></BR
  63066. ><P
  63067. >      The <B
  63068. CLASS="function"
  63069. >cpdf_setlinecap()</B
  63070. > function set the linecap
  63071.      parameter between a <TT
  63072. CLASS="parameter"
  63073. ><I
  63074. >value</I
  63075. ></TT
  63076. > of 0 and 2. 
  63077.      0 = butt end, 1 = round, 2 = projecting square. Vracφ <TT
  63078. CLASS="constant"
  63079. ><B
  63080. >TRUE</B
  63081. ></TT
  63082. > p°i ·sp∞chu, <TT
  63083. CLASS="constant"
  63084. ><B
  63085. >FALSE</B
  63086. ></TT
  63087. > p°i selhßnφ.
  63088.     </P
  63089. ></DIV
  63090. ><H1
  63091. ><A
  63092. NAME="function.cpdf-setlinejoin"
  63093. ></A
  63094. >cpdf_setlinejoin</H1
  63095. ><DIV
  63096. CLASS="refnamediv"
  63097. ><A
  63098. NAME="AEN13468"
  63099. ></A
  63100. ><P
  63101. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63102. >cpdf_setlinejoin -- Sets linejoin parameter</DIV
  63103. ><DIV
  63104. CLASS="refsect1"
  63105. ><A
  63106. NAME="AEN13471"
  63107. ></A
  63108. ><H2
  63109. >Description</H2
  63110. >bool <B
  63111. CLASS="methodname"
  63112. >cpdf_setlinejoin</B
  63113. > ( int pdf_document, int value)<BR
  63114. ></BR
  63115. ><P
  63116. >      The <B
  63117. CLASS="function"
  63118. >cpdf_setlinejoin()</B
  63119. > function set the
  63120.      linejoin parameter between a <TT
  63121. CLASS="parameter"
  63122. ><I
  63123. >value</I
  63124. ></TT
  63125. > of
  63126.      0 and 2. 0 = miter, 1 = round, 2 = bevel. Vracφ <TT
  63127. CLASS="constant"
  63128. ><B
  63129. >TRUE</B
  63130. ></TT
  63131. > p°i ·sp∞chu, <TT
  63132. CLASS="constant"
  63133. ><B
  63134. >FALSE</B
  63135. ></TT
  63136. > p°i selhßnφ.
  63137.     </P
  63138. ></DIV
  63139. ><H1
  63140. ><A
  63141. NAME="function.cpdf-setlinewidth"
  63142. ></A
  63143. >cpdf_setlinewidth</H1
  63144. ><DIV
  63145. CLASS="refnamediv"
  63146. ><A
  63147. NAME="AEN13488"
  63148. ></A
  63149. ><P
  63150. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63151. >cpdf_setlinewidth -- Sets line width</DIV
  63152. ><DIV
  63153. CLASS="refsect1"
  63154. ><A
  63155. NAME="AEN13491"
  63156. ></A
  63157. ><H2
  63158. >Description</H2
  63159. >bool <B
  63160. CLASS="methodname"
  63161. >cpdf_setlinewidth</B
  63162. > ( int pdf_document, float width)<BR
  63163. ></BR
  63164. ><P
  63165. >      The <B
  63166. CLASS="function"
  63167. >cpdf_setlinewidth()</B
  63168. > function set the line
  63169.      width to <TT
  63170. CLASS="parameter"
  63171. ><I
  63172. >width</I
  63173. ></TT
  63174. >. Vracφ <TT
  63175. CLASS="constant"
  63176. ><B
  63177. >TRUE</B
  63178. ></TT
  63179. > p°i ·sp∞chu, <TT
  63180. CLASS="constant"
  63181. ><B
  63182. >FALSE</B
  63183. ></TT
  63184. > p°i selhßnφ.
  63185.     </P
  63186. ></DIV
  63187. ><H1
  63188. ><A
  63189. NAME="function.cpdf-setmiterlimit"
  63190. ></A
  63191. >cpdf_setmiterlimit</H1
  63192. ><DIV
  63193. CLASS="refnamediv"
  63194. ><A
  63195. NAME="AEN13508"
  63196. ></A
  63197. ><P
  63198. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63199. >cpdf_setmiterlimit -- Sets miter limit</DIV
  63200. ><DIV
  63201. CLASS="refsect1"
  63202. ><A
  63203. NAME="AEN13511"
  63204. ></A
  63205. ><H2
  63206. >Description</H2
  63207. >bool <B
  63208. CLASS="methodname"
  63209. >cpdf_setmiterlimit</B
  63210. > ( int pdf_document, float value)<BR
  63211. ></BR
  63212. ><P
  63213. >      The <B
  63214. CLASS="function"
  63215. >cpdf_setmiterlimit()</B
  63216. > function set the
  63217.      miter limit to a value greater or equal than 1. Vracφ <TT
  63218. CLASS="constant"
  63219. ><B
  63220. >TRUE</B
  63221. ></TT
  63222. > p°i ·sp∞chu, <TT
  63223. CLASS="constant"
  63224. ><B
  63225. >FALSE</B
  63226. ></TT
  63227. > p°i selhßnφ.
  63228.     </P
  63229. ></DIV
  63230. ><H1
  63231. ><A
  63232. NAME="function.cpdf-setrgbcolor-fill"
  63233. ></A
  63234. >cpdf_setrgbcolor_fill</H1
  63235. ><DIV
  63236. CLASS="refnamediv"
  63237. ><A
  63238. NAME="AEN13527"
  63239. ></A
  63240. ><P
  63241. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63242. >cpdf_setrgbcolor_fill -- Sets filling color to rgb color value</DIV
  63243. ><DIV
  63244. CLASS="refsect1"
  63245. ><A
  63246. NAME="AEN13530"
  63247. ></A
  63248. ><H2
  63249. >Description</H2
  63250. >bool <B
  63251. CLASS="methodname"
  63252. >cpdf_setrgbcolor_fill</B
  63253. > ( int pdf_document, float red_value, float green_value, float blue_value)<BR
  63254. ></BR
  63255. ><P
  63256. >      The <B
  63257. CLASS="function"
  63258. >cpdf_setrgbcolor_fill()</B
  63259. > function sets the current
  63260.      rgb color value to fill a path. Vracφ <TT
  63261. CLASS="constant"
  63262. ><B
  63263. >TRUE</B
  63264. ></TT
  63265. > p°i ·sp∞chu, <TT
  63266. CLASS="constant"
  63267. ><B
  63268. >FALSE</B
  63269. ></TT
  63270. > p°i selhßnφ.
  63271.     </P
  63272. ><DIV
  63273. CLASS="note"
  63274. ><BLOCKQUOTE
  63275. CLASS="note"
  63276. ><P
  63277. ><B
  63278. >Poznßmka: </B
  63279. >
  63280.       The values are expected to be floating point values between 0.0 and
  63281.       1.0. (i.e black is (0.0, 0.0, 0.0) and white is (1.0, 1.0, 1.0)). 
  63282.      </P
  63283. ></BLOCKQUOTE
  63284. ></DIV
  63285. ><P
  63286. >      See also <A
  63287. HREF="#function.cpdf-setrgbcolor-stroke"
  63288. ><B
  63289. CLASS="function"
  63290. >cpdf_setrgbcolor_stroke()</B
  63291. ></A
  63292. > and
  63293.      <A
  63294. HREF="#function.cpdf-setrgbcolor"
  63295. ><B
  63296. CLASS="function"
  63297. >cpdf_setrgbcolor()</B
  63298. ></A
  63299. >.
  63300.     </P
  63301. ></DIV
  63302. ><H1
  63303. ><A
  63304. NAME="function.cpdf-setrgbcolor-stroke"
  63305. ></A
  63306. >cpdf_setrgbcolor_stroke</H1
  63307. ><DIV
  63308. CLASS="refnamediv"
  63309. ><A
  63310. NAME="AEN13557"
  63311. ></A
  63312. ><P
  63313. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63314. >cpdf_setrgbcolor_stroke -- Sets drawing color to rgb color value</DIV
  63315. ><DIV
  63316. CLASS="refsect1"
  63317. ><A
  63318. NAME="AEN13560"
  63319. ></A
  63320. ><H2
  63321. >Description</H2
  63322. >bool <B
  63323. CLASS="methodname"
  63324. >cpdf_setrgbcolor_stroke</B
  63325. > ( int pdf_document, float red_value, float green_value, float blue_value)<BR
  63326. ></BR
  63327. ><P
  63328. >      The <B
  63329. CLASS="function"
  63330. >cpdf_setrgbcolor_stroke()</B
  63331. > function sets the current
  63332.      drawing color to the given rgb color value. Vracφ <TT
  63333. CLASS="constant"
  63334. ><B
  63335. >TRUE</B
  63336. ></TT
  63337. > p°i ·sp∞chu, <TT
  63338. CLASS="constant"
  63339. ><B
  63340. >FALSE</B
  63341. ></TT
  63342. > p°i selhßnφ.
  63343.     </P
  63344. ><DIV
  63345. CLASS="note"
  63346. ><BLOCKQUOTE
  63347. CLASS="note"
  63348. ><P
  63349. ><B
  63350. >Poznßmka: </B
  63351. >
  63352.       The values are expected to be floating point values between 0.0 and
  63353.       1.0. (i.e black is (0.0, 0.0, 0.0) and white is (1.0, 1.0, 1.0)). 
  63354.      </P
  63355. ></BLOCKQUOTE
  63356. ></DIV
  63357. ><P
  63358. >      See also <A
  63359. HREF="#function.cpdf-setrgbcolor-fill"
  63360. ><B
  63361. CLASS="function"
  63362. >cpdf_setrgbcolor_fill()</B
  63363. ></A
  63364. > and
  63365.      <A
  63366. HREF="#function.cpdf-setrgbcolor"
  63367. ><B
  63368. CLASS="function"
  63369. >cpdf_setrgbcolor()</B
  63370. ></A
  63371. >.
  63372.     </P
  63373. ></DIV
  63374. ><H1
  63375. ><A
  63376. NAME="function.cpdf-setrgbcolor"
  63377. ></A
  63378. >cpdf_setrgbcolor</H1
  63379. ><DIV
  63380. CLASS="refnamediv"
  63381. ><A
  63382. NAME="AEN13587"
  63383. ></A
  63384. ><P
  63385. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63386. >cpdf_setrgbcolor -- Sets drawing and filling color to rgb color value</DIV
  63387. ><DIV
  63388. CLASS="refsect1"
  63389. ><A
  63390. NAME="AEN13590"
  63391. ></A
  63392. ><H2
  63393. >Description</H2
  63394. >bool <B
  63395. CLASS="methodname"
  63396. >cpdf_setrgbcolor</B
  63397. > ( int pdf_document, float red_value, float green_value, float blue_value)<BR
  63398. ></BR
  63399. ><P
  63400. >      The <B
  63401. CLASS="function"
  63402. >cpdf_setrgbcolor()</B
  63403. > function sets the current
  63404.      drawing and filling color to the given rgb color value. Vracφ <TT
  63405. CLASS="constant"
  63406. ><B
  63407. >TRUE</B
  63408. ></TT
  63409. > p°i ·sp∞chu, <TT
  63410. CLASS="constant"
  63411. ><B
  63412. >FALSE</B
  63413. ></TT
  63414. > p°i selhßnφ.
  63415.     </P
  63416. ><DIV
  63417. CLASS="note"
  63418. ><BLOCKQUOTE
  63419. CLASS="note"
  63420. ><P
  63421. ><B
  63422. >Poznßmka: </B
  63423. >
  63424.       The values are expected to be floating point values between 0.0 and
  63425.       1.0. (i.e black is (0.0, 0.0, 0.0) and white is (1.0, 1.0, 1.0)). 
  63426.      </P
  63427. ></BLOCKQUOTE
  63428. ></DIV
  63429. ><P
  63430. >      See also <A
  63431. HREF="#function.cpdf-setrgbcolor-stroke"
  63432. ><B
  63433. CLASS="function"
  63434. >cpdf_setrgbcolor_stroke()</B
  63435. ></A
  63436. > and
  63437.      <A
  63438. HREF="#function.cpdf-setrgbcolor-fill"
  63439. ><B
  63440. CLASS="function"
  63441. >cpdf_setrgbcolor_fill()</B
  63442. ></A
  63443. >.
  63444.     </P
  63445. ></DIV
  63446. ><H1
  63447. ><A
  63448. NAME="function.cpdf-show-xy"
  63449. ></A
  63450. >cpdf_show_xy</H1
  63451. ><DIV
  63452. CLASS="refnamediv"
  63453. ><A
  63454. NAME="AEN13617"
  63455. ></A
  63456. ><P
  63457. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63458. >cpdf_show_xy -- Output text at position</DIV
  63459. ><DIV
  63460. CLASS="refsect1"
  63461. ><A
  63462. NAME="AEN13620"
  63463. ></A
  63464. ><H2
  63465. >Description</H2
  63466. >bool <B
  63467. CLASS="methodname"
  63468. >cpdf_show_xy</B
  63469. > ( int pdf_document, string text, float x-coor, float y-coor [, int mode])<BR
  63470. ></BR
  63471. ><P
  63472. >      The <B
  63473. CLASS="function"
  63474. >cpdf_show_xy()</B
  63475. > function outputs the
  63476.      string <TT
  63477. CLASS="parameter"
  63478. ><I
  63479. >text</I
  63480. ></TT
  63481. > at position with coordinates
  63482.      (<TT
  63483. CLASS="parameter"
  63484. ><I
  63485. >x-coor</I
  63486. ></TT
  63487. >, <TT
  63488. CLASS="parameter"
  63489. ><I
  63490. >y-coor</I
  63491. ></TT
  63492. >).
  63493.      Vracφ <TT
  63494. CLASS="constant"
  63495. ><B
  63496. >TRUE</B
  63497. ></TT
  63498. > p°i ·sp∞chu, <TT
  63499. CLASS="constant"
  63500. ><B
  63501. >FALSE</B
  63502. ></TT
  63503. > p°i selhßnφ.
  63504.     </P
  63505. ><P
  63506. >Nepovinn² parametr <TT
  63507. CLASS="parameter"
  63508. ><I
  63509. >mode</I
  63510. ></TT
  63511. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  63512. ><P
  63513. >      <DIV
  63514. CLASS="note"
  63515. ><BLOCKQUOTE
  63516. CLASS="note"
  63517. ><P
  63518. ><B
  63519. >Poznßmka: </B
  63520. >
  63521.        The function <B
  63522. CLASS="function"
  63523. >cpdf_show_xy()</B
  63524. > is identical to
  63525.        <A
  63526. HREF="#function.cpdf-text"
  63527. ><B
  63528. CLASS="function"
  63529. >cpdf_text()</B
  63530. ></A
  63531. > without the optional parameters.
  63532.       </P
  63533. ></BLOCKQUOTE
  63534. ></DIV
  63535. >
  63536.     </P
  63537. ><P
  63538. >      See also <A
  63539. HREF="#function.cpdf-text"
  63540. ><B
  63541. CLASS="function"
  63542. >cpdf_text()</B
  63543. ></A
  63544. >.
  63545.     </P
  63546. ></DIV
  63547. ><H1
  63548. ><A
  63549. NAME="function.cpdf-show"
  63550. ></A
  63551. >cpdf_show</H1
  63552. ><DIV
  63553. CLASS="refnamediv"
  63554. ><A
  63555. NAME="AEN13657"
  63556. ></A
  63557. ><P
  63558. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63559. >cpdf_show -- Output text at current position</DIV
  63560. ><DIV
  63561. CLASS="refsect1"
  63562. ><A
  63563. NAME="AEN13660"
  63564. ></A
  63565. ><H2
  63566. >Description</H2
  63567. >bool <B
  63568. CLASS="methodname"
  63569. >cpdf_show</B
  63570. > ( int pdf_document, string text)<BR
  63571. ></BR
  63572. ><P
  63573. >      The <B
  63574. CLASS="function"
  63575. >cpdf_show()</B
  63576. > function outputs the
  63577.      string in <TT
  63578. CLASS="parameter"
  63579. ><I
  63580. >text</I
  63581. ></TT
  63582. > at the current position.
  63583.      Vracφ <TT
  63584. CLASS="constant"
  63585. ><B
  63586. >TRUE</B
  63587. ></TT
  63588. > p°i ·sp∞chu, <TT
  63589. CLASS="constant"
  63590. ><B
  63591. >FALSE</B
  63592. ></TT
  63593. > p°i selhßnφ.
  63594.     </P
  63595. ><P
  63596. >      See also <A
  63597. HREF="#function.cpdf-text"
  63598. ><B
  63599. CLASS="function"
  63600. >cpdf_text()</B
  63601. ></A
  63602. >,
  63603.      <A
  63604. HREF="#function.cpdf-begin-text"
  63605. ><B
  63606. CLASS="function"
  63607. >cpdf_begin_text()</B
  63608. ></A
  63609. > and
  63610.      <A
  63611. HREF="#function.cpdf-end-text"
  63612. ><B
  63613. CLASS="function"
  63614. >cpdf_end_text()</B
  63615. ></A
  63616. >.
  63617.     </P
  63618. ></DIV
  63619. ><H1
  63620. ><A
  63621. NAME="function.cpdf-stringwidth"
  63622. ></A
  63623. >cpdf_stringwidth</H1
  63624. ><DIV
  63625. CLASS="refnamediv"
  63626. ><A
  63627. NAME="AEN13681"
  63628. ></A
  63629. ><P
  63630. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63631. >cpdf_stringwidth -- Returns width of text in current font</DIV
  63632. ><DIV
  63633. CLASS="refsect1"
  63634. ><A
  63635. NAME="AEN13684"
  63636. ></A
  63637. ><H2
  63638. >Description</H2
  63639. >float <B
  63640. CLASS="methodname"
  63641. >cpdf_stringwidth</B
  63642. > ( int pdf_document, string text)<BR
  63643. ></BR
  63644. ><P
  63645. >      The <B
  63646. CLASS="function"
  63647. >cpdf_stringwidth()</B
  63648. > function returns the
  63649.      width of the string in <TT
  63650. CLASS="parameter"
  63651. ><I
  63652. >text</I
  63653. ></TT
  63654. >. It requires
  63655.      a font to be set before.
  63656.     </P
  63657. ><P
  63658. >      See also <A
  63659. HREF="#function.cpdf-set-font"
  63660. ><B
  63661. CLASS="function"
  63662. >cpdf_set_font()</B
  63663. ></A
  63664. >.
  63665.     </P
  63666. ></DIV
  63667. ><H1
  63668. ><A
  63669. NAME="function.cpdf-stroke"
  63670. ></A
  63671. >cpdf_stroke</H1
  63672. ><DIV
  63673. CLASS="refnamediv"
  63674. ><A
  63675. NAME="AEN13701"
  63676. ></A
  63677. ><P
  63678. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63679. >cpdf_stroke -- Draw line along path</DIV
  63680. ><DIV
  63681. CLASS="refsect1"
  63682. ><A
  63683. NAME="AEN13704"
  63684. ></A
  63685. ><H2
  63686. >Description</H2
  63687. >bool <B
  63688. CLASS="methodname"
  63689. >cpdf_stroke</B
  63690. > ( int pdf_document)<BR
  63691. ></BR
  63692. ><P
  63693. >      The <B
  63694. CLASS="function"
  63695. >cpdf_stroke()</B
  63696. > function draws a line along
  63697.      current path. Vracφ <TT
  63698. CLASS="constant"
  63699. ><B
  63700. >TRUE</B
  63701. ></TT
  63702. > p°i ·sp∞chu, <TT
  63703. CLASS="constant"
  63704. ><B
  63705. >FALSE</B
  63706. ></TT
  63707. > p°i selhßnφ.
  63708.     </P
  63709. ><P
  63710. >      See also <A
  63711. HREF="#function.cpdf-closepath"
  63712. ><B
  63713. CLASS="function"
  63714. >cpdf_closepath()</B
  63715. ></A
  63716. > and
  63717.      <A
  63718. HREF="#function.cpdf-closepath-stroke"
  63719. ><B
  63720. CLASS="function"
  63721. >cpdf_closepath_stroke()</B
  63722. ></A
  63723. >.
  63724.     </P
  63725. ></DIV
  63726. ><H1
  63727. ><A
  63728. NAME="function.cpdf-text"
  63729. ></A
  63730. >cpdf_text</H1
  63731. ><DIV
  63732. CLASS="refnamediv"
  63733. ><A
  63734. NAME="AEN13720"
  63735. ></A
  63736. ><P
  63737. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63738. >cpdf_text -- Output text with parameters</DIV
  63739. ><DIV
  63740. CLASS="refsect1"
  63741. ><A
  63742. NAME="AEN13723"
  63743. ></A
  63744. ><H2
  63745. >Description</H2
  63746. >bool <B
  63747. CLASS="methodname"
  63748. >cpdf_text</B
  63749. > ( int pdf_document, string text, float x-coor, float y-coor [, int mode [, float orientation [, int alignmode]]])<BR
  63750. ></BR
  63751. ><P
  63752. >      The <B
  63753. CLASS="function"
  63754. >cpdf_text()</B
  63755. > function outputs the string
  63756.      <TT
  63757. CLASS="parameter"
  63758. ><I
  63759. >text</I
  63760. ></TT
  63761. > at position with coordinates
  63762.      (<TT
  63763. CLASS="parameter"
  63764. ><I
  63765. >x-coor</I
  63766. ></TT
  63767. >, <TT
  63768. CLASS="parameter"
  63769. ><I
  63770. >y-coor</I
  63771. ></TT
  63772. >).
  63773.      Vracφ <TT
  63774. CLASS="constant"
  63775. ><B
  63776. >TRUE</B
  63777. ></TT
  63778. > p°i ·sp∞chu, <TT
  63779. CLASS="constant"
  63780. ><B
  63781. >FALSE</B
  63782. ></TT
  63783. > p°i selhßnφ.
  63784.     </P
  63785. ><P
  63786. >Nepovinn² parametr <TT
  63787. CLASS="parameter"
  63788. ><I
  63789. >mode</I
  63790. ></TT
  63791. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  63792. ><P
  63793. >      The optional parameter <TT
  63794. CLASS="parameter"
  63795. ><I
  63796. >orientation</I
  63797. ></TT
  63798. > is the
  63799.      rotation of the text in degree.
  63800.     </P
  63801. ><P
  63802. >      The optional parameter <TT
  63803. CLASS="parameter"
  63804. ><I
  63805. >alignmode</I
  63806. ></TT
  63807. > determines
  63808.      how the text is aligned.
  63809.     </P
  63810. ><P
  63811. >      See the ClibPDF documentation for possible values.
  63812.     </P
  63813. ><P
  63814. >      See also <A
  63815. HREF="#function.cpdf-show-xy"
  63816. ><B
  63817. CLASS="function"
  63818. >cpdf_show_xy()</B
  63819. ></A
  63820. >.
  63821.     </P
  63822. ></DIV
  63823. ><H1
  63824. ><A
  63825. NAME="function.cpdf-translate"
  63826. ></A
  63827. >cpdf_translate</H1
  63828. ><DIV
  63829. CLASS="refnamediv"
  63830. ><A
  63831. NAME="AEN13766"
  63832. ></A
  63833. ><P
  63834. >    (PHP 3>= 3.0.8, PHP 4 )</P
  63835. >cpdf_translate -- Sets origin of coordinate system</DIV
  63836. ><DIV
  63837. CLASS="refsect1"
  63838. ><A
  63839. NAME="AEN13769"
  63840. ></A
  63841. ><H2
  63842. >Description</H2
  63843. >bool <B
  63844. CLASS="methodname"
  63845. >cpdf_translate</B
  63846. > ( int pdf_document, float x-coor, float y-coor [, int mode])<BR
  63847. ></BR
  63848. ><P
  63849. >      The <B
  63850. CLASS="function"
  63851. >cpdf_translate()</B
  63852. > function set the origin of
  63853.      coordinate system to the point (<TT
  63854. CLASS="parameter"
  63855. ><I
  63856. >x-coor</I
  63857. ></TT
  63858. >,
  63859.      <TT
  63860. CLASS="parameter"
  63861. ><I
  63862. >y-coor</I
  63863. ></TT
  63864. >). Vracφ <TT
  63865. CLASS="constant"
  63866. ><B
  63867. >TRUE</B
  63868. ></TT
  63869. > p°i ·sp∞chu, <TT
  63870. CLASS="constant"
  63871. ><B
  63872. >FALSE</B
  63873. ></TT
  63874. > p°i selhßnφ.
  63875.     </P
  63876. ><P
  63877. >Nepovinn² parametr <TT
  63878. CLASS="parameter"
  63879. ><I
  63880. >mode</I
  63881. ></TT
  63882. > urΦuje dΘlku jednotky. Kdy╛ je nastaven na 0 nebo nenφ uveden, je pou╛ita v²chozφ jednotka strßnky. Jinak jsou sou°adnice m∞°eny v bodech PostScript bez ohledu na aktußlnφ jednotku.</P
  63883. ></DIV
  63884. ></DIV
  63885. ><DIV
  63886. CLASS="reference"
  63887. ><A
  63888. NAME="ref.crack"
  63889. ></A
  63890. ><DIV
  63891. CLASS="TITLEPAGE"
  63892. ><H1
  63893. CLASS="title"
  63894. >XI. Crack functions</H1
  63895. ><DIV
  63896. CLASS="PARTINTRO"
  63897. ><A
  63898. NAME="AEN13797"
  63899. ></A
  63900. ><DIV
  63901. CLASS="section"
  63902. ><H1
  63903. CLASS="section"
  63904. ><A
  63905. NAME="crack.intro"
  63906. ></A
  63907. >┌vod</H1
  63908. ><P
  63909. >      These functions allow you to use the CrackLib library to test the
  63910.      'strength' of a password.  The 'strength' of a pa