PageRenderTime 66ms CodeModel.GetById 35ms RepoModel.GetById 1ms app.codeStats 0ms

/manual/www.php.ru/manual/function.empty.html

https://github.com/overchuk/vim
HTML | 761 lines | 581 code | 124 blank | 56 comment | 0 complexity | 6d89f597bf2be53995fa6b825e038bd0 MD5 | raw file
  1. <!--
  2. HTML dropped by Zend Guard Compressor 4.2
  3. php.ru team: mz, az, yuri, vb, cyxapuk, 440hz, administrator
  4. 2004-2007 (c) expi-web.com
  5. 2007-2008 (c) odware.com
  6. 0101-1010 (с) 440hz
  7. 2b|~2b=?
  8. -->
  9. <!-- EHOT тут всё пожрал ! -->
  10. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  11. <html>
  12. <head>
  13. <link rel="alternate" type="application/rss+xml" title="php.ru/forum - последние сообщения" href="http://www.php.ru/forum/rss.php">
  14. <link rel="SHORTCUT ICON" href="http://www.php.ru/favicon.ico" />
  15. <META name="description" content="php.ru - форум PHP программистов, поиск по всем ресурсам сети, посвященным php">
  16. <meta http-equiv="description" content="php.ru - форум PHP программистов, поиск по всем ресурсам сети, посвященным php">
  17. <META name="keywords" content="php, php5, apache, mysql, session">
  18. <meta http-equiv="keywords" content="php, php5, apache, mysql, session">
  19. <title>php.ru - empty</title>
  20. <LINK REL="stylesheet" TYPE="text/css" HREF="http://www.php.ru/index.css">
  21. <script language="JavaScript" src="http://www.php.ru/ajax/ajax.js"></script>
  22. </head>
  23. <body>
  24. <table height='100%' width='100%' cellspacing='0' cellpadding='0'>
  25. <tr height='99%' valign='top'>
  26. <td align='center'>
  27. <table style='margin-top: 4px' width=100% cellspacing=0 cellpadding=3>
  28. <tr>
  29. <td>PHP - <a href="http://ru.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D1%81%D0%B8%D0%B2%D0%BD%D1%8B%D0%B9_%D0%B0%D0%BA%D1%80%D0%BE%D0%BD%D0%B8%D0%BC" target=_blank class=lnk>рекурсивный акроним</a> словосочетания &laquo;<a href="/manual/introduction.html" class=lnk>PHP: Hypertext Preprocessor</a>&raquo;</td>
  30. </tr>
  31. </table>
  32. <script language="JavaScript" src="http://www.php.ru/ajax/subsys_ajax.js"></script>
  33. <!--
  34. commet by 440hz
  35. 20.10.2007
  36. <script language="JavaScript" src="http://www.php.ru/ajax/pu_search.js"></script>
  37. -->
  38. <script language="JavaScript" src="http://www.php.ru/ajax/cz.js?a=b"></script>
  39. <table style='margin-top: 5px' width=100% bgcolor=#9999cc cellspacing=0 cellpadding=0 border=0>
  40. <form name=SEARCH method=GET action="http://www.php.ru/search/?SID=473m6dscwhj32ssc" onsubmit="return puSubmit();">
  41. <input type=hidden name=PAGE value=1>
  42. <tr>
  43. <td width='1' valign='middle'>
  44. <a href='/'><img src="http://www.php.ru/;-)/logo.gif" width=133 height=93 alt="php" border=0 hspace=10 vspace=0></a>
  45. </td>
  46. <td width='100%' valign='middle'>
  47. <!--
  48. commet by 440hz
  49. 20.10.2007
  50. <div id='pu_search' class='pu_search'></div>
  51. <div id='pu_search_description' class='pu_search_decription'></div>
  52. -->
  53. <input type=text style='width:99%; margin: 10px' maxlength='200' name='QS' class='in' id='query' autocomplete='off' value="" />
  54. </td>
  55. </tr>
  56. <tr bgcolor='#666699' valign='middle'>
  57. <td style='border-top: 1px solid #333366;'><br /></td>
  58. <td style='border-top: 1px solid #333366;'><div style="padding: 4px 4px 4px 10px; height: 24px; color: #CCCCFF;" id="stat">Хто там?<script>doLoadCZ('stat','stat');</script></div></td>
  59. </tr>
  60. </form>
  61. </table>
  62. <table id="menu" cellspaciong=0 cellpadding=3>
  63. <tr>
  64. <td><a href="/" class=current>Главная</a></td>
  65. <td><a href="/download/" class=current>Скачать</a></td>
  66. <td><a href="/doc/" class=current>Документация</a></td>
  67. <td><a href="/forum/" class=current>Форум</a></td>
  68. <td width=100% align=right><a href="/phpinfo.html" class=current>phpinfo()</a></td>
  69. </tr>
  70. </table>
  71. <!-- AdRiver code START. Type:728x90 Site: php.ru PZ: 0 BN: 1 -->
  72. <script language="javascript" type="text/javascript"><!--
  73. var RndNum4NoCash = Math.round(Math.random() * 1000000000);
  74. var ar_Tail='unknown'; if (document.referrer) ar_Tail = escape(document.referrer);
  75. document.write(
  76. '<iframe src="http://ad.adriver.ru/cgi-bin/erle.cgi?'
  77. + 'sid=148680&bn=1&target=blank&bt=36&pz=0&rnd=' + RndNum4NoCash + '&tail256=' + ar_Tail
  78. + '" frameborder=0 vspace=0 hspace=0 width=728 height=90 marginwidth=0'
  79. + ' marginheight=0 scrolling=no></iframe>');
  80. //--></script>
  81. <noscript>
  82. <a href="http://ad.adriver.ru/cgi-bin/click.cgi?sid=148680&bn=1&bt=36&pz=0&rnd=1525626915" target=_blank>
  83. <img src="http://ad.adriver.ru/cgi-bin/rle.cgi?sid=148680&bn=1&bt=36&pz=0&rnd=1525626915" alt="-AdRiver-" border=0 width=728 height=90></a>
  84. </noscript>
  85. <!-- AdRiver code END -->
  86. <table width='100%' cellspacing='0' cellpadding='0'>
  87. <tr valign='top'>
  88. <td width=100%><div style="margin: 10px 10px 10px 50px;"><center><div style="width: 800px; text-align: left"><DIV
  89. CLASS="NAVHEADER"
  90. ><TABLE
  91. SUMMARY="Header navigation table"
  92. WIDTH="100%"
  93. BORDER="0"
  94. CELLPADDING="0"
  95. CELLSPACING="0"
  96. ><TR
  97. ><TH
  98. COLSPAN="3"
  99. ALIGN="center"
  100. >Руководство по PHP</TH
  101. ></TR
  102. ><TR
  103. ><TD
  104. WIDTH="10%"
  105. ALIGN="left"
  106. VALIGN="bottom"
  107. ><A
  108. HREF="function.doubleval.html"
  109. ACCESSKEY="P"
  110. >Пред.</A
  111. ></TD
  112. ><TD
  113. WIDTH="80%"
  114. ALIGN="center"
  115. VALIGN="bottom"
  116. ></TD
  117. ><TD
  118. WIDTH="10%"
  119. ALIGN="right"
  120. VALIGN="bottom"
  121. ><A
  122. HREF="function.floatval.html"
  123. ACCESSKEY="N"
  124. >След.</A
  125. ></TD
  126. ></TR
  127. ></TABLE
  128. ><HR
  129. ALIGN="LEFT"
  130. WIDTH="100%"></DIV
  131. ><H1
  132. ><A
  133. NAME="function.empty"
  134. ></A
  135. >empty</H1
  136. ><DIV
  137. CLASS="refnamediv"
  138. ><A
  139. NAME="AEN189689"
  140. ></A
  141. ><P
  142. > (PHP 3, PHP 4, PHP 5)</P
  143. >empty&nbsp;--&nbsp;Determine whether a variable is empty</DIV
  144. ><DIV
  145. CLASS="refsect1"
  146. ><A
  147. NAME="AEN189692"
  148. ></A
  149. ><H2
  150. >Описание</H2
  151. >bool <B
  152. CLASS="methodname"
  153. >empty</B
  154. > ( mixed var )<BR
  155. ></BR
  156. ><P
  157. >&#13; Determine whether a variable is considered to be empty.
  158. </P
  159. ></DIV
  160. ><DIV
  161. CLASS="refsect1"
  162. ><A
  163. NAME="AEN189701"
  164. ></A
  165. ><H2
  166. >Список параметров</H2
  167. ><P
  168. >&#13; <P
  169. ></P
  170. ><DIV
  171. CLASS="variablelist"
  172. ><DL
  173. ><DT
  174. ><VAR
  175. CLASS="parameter"
  176. >var</VAR
  177. ></DT
  178. ><DD
  179. ><P
  180. >&#13; Variable to be checked
  181. </P
  182. ><DIV
  183. CLASS="note"
  184. ><BLOCKQUOTE
  185. CLASS="note"
  186. ><P
  187. ><B
  188. >Замечание: </B
  189. >
  190. <B
  191. CLASS="function"
  192. >empty()</B
  193. > only checks variables as anything else will
  194. result in a parse error. In other words, the following will not work:
  195. <B
  196. CLASS="command"
  197. >empty(trim($name))</B
  198. >.
  199. </P
  200. ></BLOCKQUOTE
  201. ></DIV
  202. ><P
  203. >&#13; <B
  204. CLASS="function"
  205. >empty()</B
  206. > is the opposite of
  207. <VAR
  208. CLASS="literal"
  209. >(boolean) <VAR
  210. CLASS="parameter"
  211. >var</VAR
  212. ></VAR
  213. >,
  214. except that no warning is generated when the variable is not set.
  215. </P
  216. ></DD
  217. ></DL
  218. ></DIV
  219. >
  220. </P
  221. ></DIV
  222. ><DIV
  223. CLASS="refsect1"
  224. ><A
  225. NAME="AEN189718"
  226. ></A
  227. ><H2
  228. >Возвращаемые значения</H2
  229. ><P
  230. >&#13; Returns <TT
  231. CLASS="constant"
  232. ><B
  233. >FALSE</B
  234. ></TT
  235. > if <VAR
  236. CLASS="parameter"
  237. >var</VAR
  238. > has a non-empty
  239. and non-zero value.
  240. </P
  241. ><P
  242. >&#13; The following things are considered to be empty:
  243. <P
  244. ></P
  245. ><TABLE
  246. BORDER="0"
  247. ><TBODY
  248. ><TR
  249. ><TD
  250. ><VAR
  251. CLASS="literal"
  252. >"" (an empty string)</VAR
  253. ></TD
  254. ></TR
  255. ><TR
  256. ><TD
  257. ><VAR
  258. CLASS="literal"
  259. >0 (0 as an integer)</VAR
  260. ></TD
  261. ></TR
  262. ><TR
  263. ><TD
  264. ><VAR
  265. CLASS="literal"
  266. >"0" (0 as a string)</VAR
  267. ></TD
  268. ></TR
  269. ><TR
  270. ><TD
  271. ><TT
  272. CLASS="constant"
  273. ><B
  274. >NULL</B
  275. ></TT
  276. ></TD
  277. ></TR
  278. ><TR
  279. ><TD
  280. ><TT
  281. CLASS="constant"
  282. ><B
  283. >FALSE</B
  284. ></TT
  285. ></TD
  286. ></TR
  287. ><TR
  288. ><TD
  289. ><VAR
  290. CLASS="literal"
  291. >array() (an empty array)</VAR
  292. ></TD
  293. ></TR
  294. ><TR
  295. ><TD
  296. ><VAR
  297. CLASS="literal"
  298. >var $var; (a variable declared, but without a value in a class)</VAR
  299. ></TD
  300. ></TR
  301. ></TBODY
  302. ></TABLE
  303. ><P
  304. ></P
  305. >
  306. </P
  307. ></DIV
  308. ><DIV
  309. CLASS="refsect1"
  310. ><A
  311. NAME="AEN189739"
  312. ></A
  313. ><H2
  314. >Список изменений</H2
  315. ><P
  316. >&#13; <DIV
  317. CLASS="informaltable"
  318. ><P
  319. ></P
  320. ><A
  321. NAME="AEN189742"
  322. ></A
  323. ><TABLE
  324. BORDER="1"
  325. CLASS="CALSTABLE"
  326. ><COL><COL><THEAD
  327. ><TR
  328. ><TH
  329. >Версия</TH
  330. ><TH
  331. >Описание</TH
  332. ></TR
  333. ></THEAD
  334. ><TBODY
  335. ><TR
  336. ><TD
  337. >PHP 5</TD
  338. ><TD
  339. >&#13; <P
  340. >&#13; As of PHP 5, objects with no properties are no longer considered empty.
  341. </P
  342. >
  343. </TD
  344. ></TR
  345. ><TR
  346. ><TD
  347. >PHP 4</TD
  348. ><TD
  349. >&#13; <P
  350. >&#13; As of PHP 4, The string value "0" is considered empty.
  351. </P
  352. >
  353. </TD
  354. ></TR
  355. ></TBODY
  356. ></TABLE
  357. ><P
  358. ></P
  359. ></DIV
  360. >
  361. </P
  362. ></DIV
  363. ><DIV
  364. CLASS="refsect1"
  365. ><A
  366. NAME="AEN189757"
  367. ></A
  368. ><H2
  369. >Примеры</H2
  370. ><P
  371. >&#13; <TABLE
  372. WIDTH="100%"
  373. BORDER="0"
  374. CELLPADDING="0"
  375. CELLSPACING="0"
  376. CLASS="EXAMPLE"
  377. ><TR
  378. ><TD
  379. ><DIV
  380. CLASS="example"
  381. ><A
  382. NAME="AEN189760"
  383. ></A
  384. ><P
  385. ><B
  386. >Пример 1.
  387. A simple <B
  388. CLASS="function"
  389. >empty()</B
  390. > / <A
  391. HREF="function.isset.html"
  392. ><B
  393. CLASS="function"
  394. >isset()</B
  395. ></A
  396. >
  397. comparison.
  398. </B
  399. ></P
  400. ><TABLE
  401. BORDER="0"
  402. BGCOLOR="#E0E0E0"
  403. CELLPADDING="5"
  404. ><TR
  405. ><TD
  406. ><code><font color="#000000">
  407. <font color="#0000BB">&lt;?php<br />$var </font><font color="#007700">= </font><font color="#0000BB">0</font><font color="#007700">;<br /><br /></font><font color="#FF8000">// Evaluates to true because $var is empty<br /></font><font color="#007700">if (empty(</font><font color="#0000BB">$var</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">'$var is either 0, empty, or not set at all'</font><font color="#007700">;<br />}<br /><br /></font><font color="#FF8000">// Evaluates as true because $var is set<br /></font><font color="#007700">if (isset(</font><font color="#0000BB">$var</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">'$var is set even though it is empty'</font><font color="#007700">;<br />}<br /></font><font color="#0000BB">?&gt;</font>
  408. </font>
  409. </code></TD
  410. ></TR
  411. ></TABLE
  412. ></DIV
  413. ></TD
  414. ></TR
  415. ></TABLE
  416. >
  417. </P
  418. ></DIV
  419. ><DIV
  420. CLASS="refsect1"
  421. ><A
  422. NAME="AEN189765"
  423. ></A
  424. ><H2
  425. >Примечания</H2
  426. ><DIV
  427. CLASS="note"
  428. ><BLOCKQUOTE
  429. CLASS="note"
  430. ><P
  431. ><B
  432. >Замечание: </B
  433. >Поскольку это языковая
  434. конструкция, а не функция, она не может вызываться при помощи
  435. <A
  436. HREF="functions.variable-functions.html"
  437. >переменных функций</A
  438. ></P
  439. ></BLOCKQUOTE
  440. ></DIV
  441. ></DIV
  442. ><DIV
  443. CLASS="refsect1"
  444. ><A
  445. NAME="AEN189770"
  446. ></A
  447. ><H2
  448. >Смотрите также</H2
  449. ><P
  450. >&#13; <P
  451. ></P
  452. ><TABLE
  453. BORDER="0"
  454. ><TBODY
  455. ><TR
  456. ><TD
  457. ><A
  458. HREF="function.isset.html"
  459. ><B
  460. CLASS="function"
  461. >isset()</B
  462. ></A
  463. ></TD
  464. ></TR
  465. ><TR
  466. ><TD
  467. ><A
  468. HREF="function.unset.html"
  469. ><B
  470. CLASS="function"
  471. >unset()</B
  472. ></A
  473. ></TD
  474. ></TR
  475. ><TR
  476. ><TD
  477. ><A
  478. HREF="function.array-key-exists.html"
  479. ><B
  480. CLASS="function"
  481. >array_key_exists()</B
  482. ></A
  483. ></TD
  484. ></TR
  485. ><TR
  486. ><TD
  487. ><A
  488. HREF="function.count.html"
  489. ><B
  490. CLASS="function"
  491. >count()</B
  492. ></A
  493. ></TD
  494. ></TR
  495. ><TR
  496. ><TD
  497. ><A
  498. HREF="function.strlen.html"
  499. ><B
  500. CLASS="function"
  501. >strlen()</B
  502. ></A
  503. ></TD
  504. ></TR
  505. ><TR
  506. ><TD
  507. ><A
  508. HREF="types.comparisons.html"
  509. >The type comparison tables</A
  510. ></TD
  511. ></TR
  512. ></TBODY
  513. ></TABLE
  514. ><P
  515. ></P
  516. >
  517. </P
  518. ></DIV
  519. ><DIV
  520. CLASS="NAVFOOTER"
  521. ><HR
  522. ALIGN="LEFT"
  523. WIDTH="100%"><TABLE
  524. SUMMARY="Footer navigation table"
  525. WIDTH="100%"
  526. BORDER="0"
  527. CELLPADDING="0"
  528. CELLSPACING="0"
  529. ><TR
  530. ><TD
  531. WIDTH="33%"
  532. ALIGN="left"
  533. VALIGN="top"
  534. ><A
  535. HREF="function.doubleval.html"
  536. ACCESSKEY="P"
  537. >Пред.</A
  538. ></TD
  539. ><TD
  540. WIDTH="34%"
  541. ALIGN="center"
  542. VALIGN="top"
  543. ><A
  544. HREF="index.html"
  545. ACCESSKEY="H"
  546. >Начало</A
  547. ></TD
  548. ><TD
  549. WIDTH="33%"
  550. ALIGN="right"
  551. VALIGN="top"
  552. ><A
  553. HREF="function.floatval.html"
  554. ACCESSKEY="N"
  555. >След.</A
  556. ></TD
  557. ></TR
  558. ><TR
  559. ><TD
  560. WIDTH="33%"
  561. ALIGN="left"
  562. VALIGN="top"
  563. >doubleval</TD
  564. ><TD
  565. WIDTH="34%"
  566. ALIGN="center"
  567. VALIGN="top"
  568. ><A
  569. HREF="ref.var.html"
  570. ACCESSKEY="U"
  571. >Уровень выше</A
  572. ></TD
  573. ><TD
  574. WIDTH="33%"
  575. ALIGN="right"
  576. VALIGN="top"
  577. >floatval</TD
  578. ></TR
  579. ></TABLE
  580. ></DIV
  581. ></div></center></div></td>
  582. <td><div style="display:none; width:200px;" id="o3" name="o3"><script charset="windows-1251" type="text/javascript" src="http://www.ozon.ru/PartnerTwinerNew.aspx?revident=bea9126b-c8e1-4bf5-b6d8-9a057f8feac6" ></script></div><script>o = document.getElementById('o3'); if(o) { var s = o.innerHTML; s = s.replace(/F6F6F6/gi,"FFFFFF"); o.innerHTML = s.replace(/padding-top: 10px; padding-bottom: 10px;/,"display:none;"); o.style.display = 'block'; } </script><br><div style="margin: 10px;"><script type="text/javascript"><!--
  583. google_ad_client = "pub-4093271809023514";
  584. /* 120x600, создано 01.11.2008 */
  585. google_ad_slot = "0438855731";
  586. google_ad_width = 120;
  587. google_ad_height = 600;
  588. //-->
  589. </script>
  590. <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div></td>
  591. </tr>
  592. </table>
  593. </td>
  594. </tr>
  595. <tr valign='bottom' height='1%'>
  596. <td> <table width=100% cellspacing=0 cellpadding=5 border=0 bgcolor=#9999CC>
  597. <tr valign=center>
  598. <td class='phpcopyright' width='45%' align='left'>&nbsp;&nbsp;Engine <a href="http://www.mnogosearch.org/">MnoGoSearch</a></td>
  599. <td class='phpcopyright' width='10%' align='center'>2007-2010 &copy <a href="mailto:webmaster@php.ru">PHP.RU</a></td>
  600. <td class='phpcopyright' width='45%' align='right' >Powered by <a target="_blank" href="http://odware.ru">ODware</a> <a HREF="http://440hz.ru">440Hz</a> &nbsp;&nbsp;</td>
  601. </tr>
  602. </table>
  603. <div style="text-align: right; padding: 5px">
  604. <!--LiveInternet counter-->
  605. <script type="text/javascript">document.write('<a href="http://www.liveinternet.ru/click" target=_blank><img src="http://counter.yadro.ru/hit?t53.6;r' + escape(document.referrer) + ((typeof(screen)=='undefined')?'':';s'+screen.width+'*'+screen.height+'*'+(screen.colorDepth?screen.colorDepth:screen.pixelDepth)) + ';u' + escape(document.URL) +';i' + escape('Жж'+document.title.substring(0,80)) + ';' + Math.random() + '" border=0 width=88 height=31 alt="" title="LiveInternet: показано число просмотров и посетителей за 24 часа"><\/a>');
  606. </script>
  607. <!--/LiveInternet-->
  608. <!-- SpyLOG -->
  609. <script src="http://tools.spylog.ru/counter2.2.js" type="text/javascript" id="spylog_code" counter="830950" ></script>
  610. <noscript><a href="http://u8309.50.spylog.com/cnt?cid=830950&f=3&p=0" target="_blank"><img src="http://u8309.50.spylog.com/cnt?cid=830950&p=0&f=4" alt='SpyLOG' border='0' width=88 height=31 ></a>
  611. </noscript>
  612. <!--/ SpyLOG -->
  613. </div>
  614. </td>
  615. </tr>
  616. </table>
  617. <script>
  618. <!--
  619. document.SEARCH.QS.focus();
  620. // --></script>
  621. <!--
  622. как же вы все это читаете?
  623. 440hz
  624. -->
  625. </body>
  626. </html>