|
|
PHP (angielski akronim rekurencyjny, którego rozwinięcie to PHP Hypertext Preprocessor), pierwotnie nazwany Personal
Home Page - skryptowy język programowania, służący przede wszystkim do tworzenia dynamicznych stron WWW i wykonywany w
tym przypadku po stronie serwera, z możliwością zagnieżdżania w HTML (bądź XHTML). PHP jest podobny w założeniach do
dużo starszego mechanizmu SSI (Server Side Includes), jednak jest w stosunku do SSI nieporównanie bardziej rozbudowany.
Udostępniany jest na zasadach licencji open-source. Jego składnia bazuje na językach C, Java i Perl.
SQL (ang. Structured Query Language) to strukturalny język zapytań używany do tworzenia, modyfikowania baz danych oraz
do umieszczania i pobierania danych z baz danych.
Język SQL jest językiem deklaratywnym. Decyzję o sposobie przechowywania i pobrania danych pozostawia się systemowi
zarządzania bazą danych DBMS.
Jest to język programowania opracowany w latach siedemdziesiątych w firmie IBM. Stał się on standardem w komunikacji z
serwerami relacyjnych baz danych. Wiele współczesnych systemów relacyjnych baz danych używa do komunikacji z
użytkownikiem SQL, dlatego mówi się, że korzystanie z relacyjnych baz danych, to korzystanie z SQL-a.
Apache jest otwartym serwerem HTTP dostępnym dla wielu systemów operacyjnych (m.in. UNIX, GNU/Linux, BSD,
Microsoft Windows). Po angielsku słowo Apache wymawia się epaczi, co brzmi tak samo jak a patchy (server), co było
określeniem tego serwera we wczesnym stadium jego rozwoju w 1995 roku, kiedy był on głównie zbiorem poprawek (patch)
nałożonych na serwer HTTP o nazwie NCSA.
Apache jest najszerzej stosowanym serwerem HTTP w Internecie. W maju 2003 jego udział wśród serwerów wynosił 62%. W
połączeniu z interpreterem języka skryptowego PHP i bazą danych MySQL, Apache stanowi jedno z najczęściej spotykanych
środowisk w firmach oferujących miejsce na serwerach sieciowych.
|
assert
(PHP 4, PHP 5) assert -- Checks if assertion is
FALSE
Descriptionbool assert (
mixed assertion )
assert() will check the given
assertion and take appropriate
action if its result is FALSE.
If the assertion is given as a
string it will be evaluated as PHP code by assert(). The advantages of a string assertion are less overhead when assertion
checking is off and messages containing the assertion expression when an assertion fails.
This means that if you pass a boolean condition as assertion this condition will not show up as
parameter to the assertion function which you may have defined
with the assert_options() function, the condition is
converted to a string before calling that handler function, and
the boolean FALSE is converted
as the empty string.
Assertions should be used as a debugging feature only. You
may use them for sanity-checks that test for conditions that
should always be TRUE and that
indicate some programming errors if not or to check for the
presence of certain features like extension functions or
certain system limits and features.
Assertions should not be used for normal runtime operations
like input parameter checks. As a rule of thumb your code
should always be able to work correctly if assertion checking
is not activated.
The behavior of assert() may be
configured by assert_options() or by .ini-settings
described in that functions manual page.
The assert_options() function and/or
ASSERT_CALLBACK configuration directive allow a callback
function to be set to handle failed assertions.
assert() callbacks are particularly
useful for building automated test suites because they allow
you to easily capture the code passed to the assertion, along
with information on where the assertion was made. While this
information can be captured via other methods, using assertions
makes it much faster and easier!
The callback function should accept three arguments. The
first argument will contain the file the assertion failed in.
The second argument will contain the line the assertion failed
on and the third argument will contain the expression that
failed (if any - literal values such as 1 or "two" will not be
passed via this argument)
Przykład 1. Handle a failed assertion with a
custom handler
<?php // Active assert and make it quiet
assert_options(ASSERT_ACTIVE, 1); assert_options(ASSERT_WARNING, 0); assert_options(ASSERT_QUIET_EVAL, 1);
// Create a handler function function my_assert_handler($file, $line, $code)
{
echo "<hr>Assertion Failed:
File '$file'<br />
Line '$line'<br />
Code '$code'<br /><hr />";
}
// Set up the callback assert_options(ASSERT_CALLBACK, 'my_assert_handler');
// Make an assertion that should fail
assert('mysql_query("")');
?> |
|
|