| Conditions | 48 |
| Paths | > 20000 |
| Total Lines | 462 |
| Code Lines | 266 |
| Lines | 14 |
| Ratio | 3.03 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 197 | protected function pageInfo() { |
||
| 198 | global $wgContLang; |
||
| 199 | |||
| 200 | $user = $this->getUser(); |
||
| 201 | $lang = $this->getLanguage(); |
||
| 202 | $title = $this->getTitle(); |
||
| 203 | $id = $title->getArticleID(); |
||
| 204 | $config = $this->context->getConfig(); |
||
| 205 | |||
| 206 | $pageCounts = $this->pageCounts( $this->page ); |
||
| 207 | |||
| 208 | $pageProperties = []; |
||
| 209 | $props = PageProps::getInstance()->getAllProperties( $title ); |
||
| 210 | if ( isset( $props[$id] ) ) { |
||
| 211 | $pageProperties = $props[$id]; |
||
| 212 | } |
||
| 213 | |||
| 214 | // Basic information |
||
| 215 | $pageInfo = []; |
||
| 216 | $pageInfo['header-basic'] = []; |
||
| 217 | |||
| 218 | // Display title |
||
| 219 | $displayTitle = $title->getPrefixedText(); |
||
| 220 | if ( isset( $pageProperties['displaytitle'] ) ) { |
||
| 221 | $displayTitle = $pageProperties['displaytitle']; |
||
| 222 | } |
||
| 223 | |||
| 224 | $pageInfo['header-basic'][] = [ |
||
| 225 | $this->msg( 'pageinfo-display-title' ), $displayTitle |
||
| 226 | ]; |
||
| 227 | |||
| 228 | // Is it a redirect? If so, where to? |
||
| 229 | if ( $title->isRedirect() ) { |
||
| 230 | $pageInfo['header-basic'][] = [ |
||
| 231 | $this->msg( 'pageinfo-redirectsto' ), |
||
| 232 | Linker::link( $this->page->getRedirectTarget() ) . |
||
| 233 | $this->msg( 'word-separator' )->escaped() . |
||
| 234 | $this->msg( 'parentheses' )->rawParams( Linker::link( |
||
| 235 | $this->page->getRedirectTarget(), |
||
| 236 | $this->msg( 'pageinfo-redirectsto-info' )->escaped(), |
||
| 237 | [], |
||
| 238 | [ 'action' => 'info' ] |
||
| 239 | ) )->escaped() |
||
| 240 | ]; |
||
| 241 | } |
||
| 242 | |||
| 243 | // Default sort key |
||
| 244 | $sortKey = $title->getCategorySortkey(); |
||
| 245 | if ( isset( $pageProperties['defaultsort'] ) ) { |
||
| 246 | $sortKey = $pageProperties['defaultsort']; |
||
| 247 | } |
||
| 248 | |||
| 249 | $sortKey = htmlspecialchars( $sortKey ); |
||
| 250 | $pageInfo['header-basic'][] = [ $this->msg( 'pageinfo-default-sort' ), $sortKey ]; |
||
| 251 | |||
| 252 | // Page length (in bytes) |
||
| 253 | $pageInfo['header-basic'][] = [ |
||
| 254 | $this->msg( 'pageinfo-length' ), $lang->formatNum( $title->getLength() ) |
||
| 255 | ]; |
||
| 256 | |||
| 257 | // Page ID (number not localised, as it's a database ID) |
||
| 258 | $pageInfo['header-basic'][] = [ $this->msg( 'pageinfo-article-id' ), $id ]; |
||
| 259 | |||
| 260 | // Language in which the page content is (supposed to be) written |
||
| 261 | $pageLang = $title->getPageLanguage()->getCode(); |
||
| 262 | |||
| 263 | if ( $config->get( 'PageLanguageUseDB' ) |
||
| 264 | && $this->getTitle()->userCan( 'pagelang', $this->getUser() ) |
||
| 265 | ) { |
||
| 266 | // Link to Special:PageLanguage with pre-filled page title if user has permissions |
||
| 267 | $titleObj = SpecialPage::getTitleFor( 'PageLanguage', $title->getPrefixedText() ); |
||
| 268 | $langDisp = Linker::link( |
||
| 269 | $titleObj, |
||
| 270 | $this->msg( 'pageinfo-language' )->escaped() |
||
| 271 | ); |
||
| 272 | } else { |
||
| 273 | // Display just the message |
||
| 274 | $langDisp = $this->msg( 'pageinfo-language' )->escaped(); |
||
| 275 | } |
||
| 276 | |||
| 277 | $pageInfo['header-basic'][] = [ $langDisp, |
||
| 278 | Language::fetchLanguageName( $pageLang, $lang->getCode() ) |
||
| 279 | . ' ' . $this->msg( 'parentheses', $pageLang )->escaped() ]; |
||
| 280 | |||
| 281 | // Content model of the page |
||
| 282 | $pageInfo['header-basic'][] = [ |
||
| 283 | $this->msg( 'pageinfo-content-model' ), |
||
| 284 | htmlspecialchars( ContentHandler::getLocalizedName( $title->getContentModel() ) ) |
||
| 285 | ]; |
||
| 286 | |||
| 287 | // Search engine status |
||
| 288 | $pOutput = new ParserOutput(); |
||
| 289 | if ( isset( $pageProperties['noindex'] ) ) { |
||
| 290 | $pOutput->setIndexPolicy( 'noindex' ); |
||
| 291 | } |
||
| 292 | if ( isset( $pageProperties['index'] ) ) { |
||
| 293 | $pOutput->setIndexPolicy( 'index' ); |
||
| 294 | } |
||
| 295 | |||
| 296 | // Use robot policy logic |
||
| 297 | $policy = $this->page->getRobotPolicy( 'view', $pOutput ); |
||
| 298 | $pageInfo['header-basic'][] = [ |
||
| 299 | // Messages: pageinfo-robot-index, pageinfo-robot-noindex |
||
| 300 | $this->msg( 'pageinfo-robot-policy' ), |
||
| 301 | $this->msg( "pageinfo-robot-${policy['index']}" ) |
||
| 302 | ]; |
||
| 303 | |||
| 304 | $unwatchedPageThreshold = $config->get( 'UnwatchedPageThreshold' ); |
||
| 305 | if ( |
||
| 306 | $user->isAllowed( 'unwatchedpages' ) || |
||
| 307 | ( $unwatchedPageThreshold !== false && |
||
| 308 | $pageCounts['watchers'] >= $unwatchedPageThreshold ) |
||
| 309 | ) { |
||
| 310 | // Number of page watchers |
||
| 311 | $pageInfo['header-basic'][] = [ |
||
| 312 | $this->msg( 'pageinfo-watchers' ), |
||
| 313 | $lang->formatNum( $pageCounts['watchers'] ) |
||
| 314 | ]; |
||
| 315 | if ( |
||
| 316 | $config->get( 'ShowUpdatedMarker' ) && |
||
| 317 | isset( $pageCounts['visitingWatchers'] ) |
||
| 318 | ) { |
||
| 319 | $minToDisclose = $config->get( 'UnwatchedPageSecret' ); |
||
| 320 | if ( $pageCounts['visitingWatchers'] > $minToDisclose || |
||
| 321 | $user->isAllowed( 'unwatchedpages' ) ) { |
||
| 322 | $pageInfo['header-basic'][] = [ |
||
| 323 | $this->msg( 'pageinfo-visiting-watchers' ), |
||
| 324 | $lang->formatNum( $pageCounts['visitingWatchers'] ) |
||
| 325 | ]; |
||
| 326 | } else { |
||
| 327 | $pageInfo['header-basic'][] = [ |
||
| 328 | $this->msg( 'pageinfo-visiting-watchers' ), |
||
| 329 | $this->msg( 'pageinfo-few-visiting-watchers' ) |
||
| 330 | ]; |
||
| 331 | } |
||
| 332 | } |
||
| 333 | } elseif ( $unwatchedPageThreshold !== false ) { |
||
| 334 | $pageInfo['header-basic'][] = [ |
||
| 335 | $this->msg( 'pageinfo-watchers' ), |
||
| 336 | $this->msg( 'pageinfo-few-watchers' )->numParams( $unwatchedPageThreshold ) |
||
| 337 | ]; |
||
| 338 | } |
||
| 339 | |||
| 340 | // Redirects to this page |
||
| 341 | $whatLinksHere = SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() ); |
||
| 342 | $pageInfo['header-basic'][] = [ |
||
| 343 | Linker::link( |
||
| 344 | $whatLinksHere, |
||
| 345 | $this->msg( 'pageinfo-redirects-name' )->escaped(), |
||
| 346 | [], |
||
| 347 | [ |
||
| 348 | 'hidelinks' => 1, |
||
| 349 | 'hidetrans' => 1, |
||
| 350 | 'hideimages' => $title->getNamespace() == NS_FILE |
||
| 351 | ] |
||
| 352 | ), |
||
| 353 | $this->msg( 'pageinfo-redirects-value' ) |
||
| 354 | ->numParams( count( $title->getRedirectsHere() ) ) |
||
| 355 | ]; |
||
| 356 | |||
| 357 | // Is it counted as a content page? |
||
| 358 | if ( $this->page->isCountable() ) { |
||
| 359 | $pageInfo['header-basic'][] = [ |
||
| 360 | $this->msg( 'pageinfo-contentpage' ), |
||
| 361 | $this->msg( 'pageinfo-contentpage-yes' ) |
||
| 362 | ]; |
||
| 363 | } |
||
| 364 | |||
| 365 | // Subpages of this page, if subpages are enabled for the current NS |
||
| 366 | if ( MWNamespace::hasSubpages( $title->getNamespace() ) ) { |
||
| 367 | $prefixIndex = SpecialPage::getTitleFor( |
||
| 368 | 'Prefixindex', $title->getPrefixedText() . '/' ); |
||
| 369 | $pageInfo['header-basic'][] = [ |
||
| 370 | Linker::link( $prefixIndex, $this->msg( 'pageinfo-subpages-name' )->escaped() ), |
||
| 371 | $this->msg( 'pageinfo-subpages-value' ) |
||
| 372 | ->numParams( |
||
| 373 | $pageCounts['subpages']['total'], |
||
| 374 | $pageCounts['subpages']['redirects'], |
||
| 375 | $pageCounts['subpages']['nonredirects'] ) |
||
| 376 | ]; |
||
| 377 | } |
||
| 378 | |||
| 379 | if ( $title->inNamespace( NS_CATEGORY ) ) { |
||
| 380 | $category = Category::newFromTitle( $title ); |
||
| 381 | |||
| 382 | // $allCount is the total number of cat members, |
||
| 383 | // not the count of how many members are normal pages. |
||
| 384 | $allCount = (int)$category->getPageCount(); |
||
| 385 | $subcatCount = (int)$category->getSubcatCount(); |
||
| 386 | $fileCount = (int)$category->getFileCount(); |
||
| 387 | $pagesCount = $allCount - $subcatCount - $fileCount; |
||
| 388 | |||
| 389 | $pageInfo['category-info'] = [ |
||
| 390 | [ |
||
| 391 | $this->msg( 'pageinfo-category-total' ), |
||
| 392 | $lang->formatNum( $allCount ) |
||
| 393 | ], |
||
| 394 | [ |
||
| 395 | $this->msg( 'pageinfo-category-pages' ), |
||
| 396 | $lang->formatNum( $pagesCount ) |
||
| 397 | ], |
||
| 398 | [ |
||
| 399 | $this->msg( 'pageinfo-category-subcats' ), |
||
| 400 | $lang->formatNum( $subcatCount ) |
||
| 401 | ], |
||
| 402 | [ |
||
| 403 | $this->msg( 'pageinfo-category-files' ), |
||
| 404 | $lang->formatNum( $fileCount ) |
||
| 405 | ] |
||
| 406 | ]; |
||
| 407 | } |
||
| 408 | |||
| 409 | // Page protection |
||
| 410 | $pageInfo['header-restrictions'] = []; |
||
| 411 | |||
| 412 | // Is this page affected by the cascading protection of something which includes it? |
||
| 413 | if ( $title->isCascadeProtected() ) { |
||
| 414 | $cascadingFrom = ''; |
||
| 415 | $sources = $title->getCascadeProtectionSources()[0]; |
||
| 416 | |||
| 417 | foreach ( $sources as $sourceTitle ) { |
||
| 418 | $cascadingFrom .= Html::rawElement( |
||
| 419 | 'li', [], Linker::linkKnown( $sourceTitle ) ); |
||
| 420 | } |
||
| 421 | |||
| 422 | $cascadingFrom = Html::rawElement( 'ul', [], $cascadingFrom ); |
||
| 423 | $pageInfo['header-restrictions'][] = [ |
||
| 424 | $this->msg( 'pageinfo-protect-cascading-from' ), |
||
| 425 | $cascadingFrom |
||
| 426 | ]; |
||
| 427 | } |
||
| 428 | |||
| 429 | // Is out protection set to cascade to other pages? |
||
| 430 | if ( $title->areRestrictionsCascading() ) { |
||
| 431 | $pageInfo['header-restrictions'][] = [ |
||
| 432 | $this->msg( 'pageinfo-protect-cascading' ), |
||
| 433 | $this->msg( 'pageinfo-protect-cascading-yes' ) |
||
| 434 | ]; |
||
| 435 | } |
||
| 436 | |||
| 437 | // Page protection |
||
| 438 | foreach ( $title->getRestrictionTypes() as $restrictionType ) { |
||
| 439 | $protectionLevel = implode( ', ', $title->getRestrictions( $restrictionType ) ); |
||
| 440 | |||
| 441 | if ( $protectionLevel == '' ) { |
||
| 442 | // Allow all users |
||
| 443 | $message = $this->msg( 'protect-default' )->escaped(); |
||
| 444 | } else { |
||
| 445 | // Administrators only |
||
| 446 | // Messages: protect-level-autoconfirmed, protect-level-sysop |
||
| 447 | $message = $this->msg( "protect-level-$protectionLevel" ); |
||
| 448 | if ( $message->isDisabled() ) { |
||
| 449 | // Require "$1" permission |
||
| 450 | $message = $this->msg( "protect-fallback", $protectionLevel )->parse(); |
||
| 451 | } else { |
||
| 452 | $message = $message->escaped(); |
||
| 453 | } |
||
| 454 | } |
||
| 455 | $expiry = $title->getRestrictionExpiry( $restrictionType ); |
||
| 456 | $formattedexpiry = $this->msg( 'parentheses', |
||
| 457 | $this->getLanguage()->formatExpiry( $expiry ) )->escaped(); |
||
| 458 | $message .= $this->msg( 'word-separator' )->escaped() . $formattedexpiry; |
||
| 459 | |||
| 460 | // Messages: restriction-edit, restriction-move, restriction-create, |
||
| 461 | // restriction-upload |
||
| 462 | $pageInfo['header-restrictions'][] = [ |
||
| 463 | $this->msg( "restriction-$restrictionType" ), $message |
||
| 464 | ]; |
||
| 465 | } |
||
| 466 | |||
| 467 | if ( !$this->page->exists() ) { |
||
| 468 | return $pageInfo; |
||
| 469 | } |
||
| 470 | |||
| 471 | // Edit history |
||
| 472 | $pageInfo['header-edits'] = []; |
||
| 473 | |||
| 474 | $firstRev = $this->page->getOldestRevision(); |
||
| 475 | $lastRev = $this->page->getRevision(); |
||
| 476 | $batch = new LinkBatch; |
||
| 477 | |||
| 478 | View Code Duplication | if ( $firstRev ) { |
|
| 479 | $firstRevUser = $firstRev->getUserText( Revision::FOR_THIS_USER ); |
||
| 480 | if ( $firstRevUser !== '' ) { |
||
| 481 | $batch->add( NS_USER, $firstRevUser ); |
||
| 482 | $batch->add( NS_USER_TALK, $firstRevUser ); |
||
| 483 | } |
||
| 484 | } |
||
| 485 | |||
| 486 | View Code Duplication | if ( $lastRev ) { |
|
| 487 | $lastRevUser = $lastRev->getUserText( Revision::FOR_THIS_USER ); |
||
| 488 | if ( $lastRevUser !== '' ) { |
||
| 489 | $batch->add( NS_USER, $lastRevUser ); |
||
| 490 | $batch->add( NS_USER_TALK, $lastRevUser ); |
||
| 491 | } |
||
| 492 | } |
||
| 493 | |||
| 494 | $batch->execute(); |
||
| 495 | |||
| 496 | if ( $firstRev ) { |
||
| 497 | // Page creator |
||
| 498 | $pageInfo['header-edits'][] = [ |
||
| 499 | $this->msg( 'pageinfo-firstuser' ), |
||
| 500 | Linker::revUserTools( $firstRev ) |
||
| 501 | ]; |
||
| 502 | |||
| 503 | // Date of page creation |
||
| 504 | $pageInfo['header-edits'][] = [ |
||
| 505 | $this->msg( 'pageinfo-firsttime' ), |
||
| 506 | Linker::linkKnown( |
||
| 507 | $title, |
||
| 508 | htmlspecialchars( $lang->userTimeAndDate( $firstRev->getTimestamp(), $user ) ), |
||
| 509 | [], |
||
| 510 | [ 'oldid' => $firstRev->getId() ] |
||
| 511 | ) |
||
| 512 | ]; |
||
| 513 | } |
||
| 514 | |||
| 515 | if ( $lastRev ) { |
||
| 516 | // Latest editor |
||
| 517 | $pageInfo['header-edits'][] = [ |
||
| 518 | $this->msg( 'pageinfo-lastuser' ), |
||
| 519 | Linker::revUserTools( $lastRev ) |
||
| 520 | ]; |
||
| 521 | |||
| 522 | // Date of latest edit |
||
| 523 | $pageInfo['header-edits'][] = [ |
||
| 524 | $this->msg( 'pageinfo-lasttime' ), |
||
| 525 | Linker::linkKnown( |
||
| 526 | $title, |
||
| 527 | htmlspecialchars( |
||
| 528 | $lang->userTimeAndDate( $this->page->getTimestamp(), $user ) |
||
| 529 | ), |
||
| 530 | [], |
||
| 531 | [ 'oldid' => $this->page->getLatest() ] |
||
| 532 | ) |
||
| 533 | ]; |
||
| 534 | } |
||
| 535 | |||
| 536 | // Total number of edits |
||
| 537 | $pageInfo['header-edits'][] = [ |
||
| 538 | $this->msg( 'pageinfo-edits' ), $lang->formatNum( $pageCounts['edits'] ) |
||
| 539 | ]; |
||
| 540 | |||
| 541 | // Total number of distinct authors |
||
| 542 | if ( $pageCounts['authors'] > 0 ) { |
||
| 543 | $pageInfo['header-edits'][] = [ |
||
| 544 | $this->msg( 'pageinfo-authors' ), $lang->formatNum( $pageCounts['authors'] ) |
||
| 545 | ]; |
||
| 546 | } |
||
| 547 | |||
| 548 | // Recent number of edits (within past 30 days) |
||
| 549 | $pageInfo['header-edits'][] = [ |
||
| 550 | $this->msg( 'pageinfo-recent-edits', |
||
| 551 | $lang->formatDuration( $config->get( 'RCMaxAge' ) ) ), |
||
| 552 | $lang->formatNum( $pageCounts['recent_edits'] ) |
||
| 553 | ]; |
||
| 554 | |||
| 555 | // Recent number of distinct authors |
||
| 556 | $pageInfo['header-edits'][] = [ |
||
| 557 | $this->msg( 'pageinfo-recent-authors' ), |
||
| 558 | $lang->formatNum( $pageCounts['recent_authors'] ) |
||
| 559 | ]; |
||
| 560 | |||
| 561 | // Array of MagicWord objects |
||
| 562 | $magicWords = MagicWord::getDoubleUnderscoreArray(); |
||
| 563 | |||
| 564 | // Array of magic word IDs |
||
| 565 | $wordIDs = $magicWords->names; |
||
| 566 | |||
| 567 | // Array of IDs => localized magic words |
||
| 568 | $localizedWords = $wgContLang->getMagicWords(); |
||
| 569 | |||
| 570 | $listItems = []; |
||
| 571 | foreach ( $pageProperties as $property => $value ) { |
||
| 572 | if ( in_array( $property, $wordIDs ) ) { |
||
| 573 | $listItems[] = Html::element( 'li', [], $localizedWords[$property][1] ); |
||
| 574 | } |
||
| 575 | } |
||
| 576 | |||
| 577 | $localizedList = Html::rawElement( 'ul', [], implode( '', $listItems ) ); |
||
| 578 | $hiddenCategories = $this->page->getHiddenCategories(); |
||
| 579 | |||
| 580 | if ( |
||
| 581 | count( $listItems ) > 0 || |
||
| 582 | count( $hiddenCategories ) > 0 || |
||
| 583 | $pageCounts['transclusion']['from'] > 0 || |
||
| 584 | $pageCounts['transclusion']['to'] > 0 |
||
| 585 | ) { |
||
| 586 | $options = [ 'LIMIT' => $config->get( 'PageInfoTransclusionLimit' ) ]; |
||
| 587 | $transcludedTemplates = $title->getTemplateLinksFrom( $options ); |
||
| 588 | if ( $config->get( 'MiserMode' ) ) { |
||
| 589 | $transcludedTargets = []; |
||
| 590 | } else { |
||
| 591 | $transcludedTargets = $title->getTemplateLinksTo( $options ); |
||
| 592 | } |
||
| 593 | |||
| 594 | // Page properties |
||
| 595 | $pageInfo['header-properties'] = []; |
||
| 596 | |||
| 597 | // Magic words |
||
| 598 | if ( count( $listItems ) > 0 ) { |
||
| 599 | $pageInfo['header-properties'][] = [ |
||
| 600 | $this->msg( 'pageinfo-magic-words' )->numParams( count( $listItems ) ), |
||
| 601 | $localizedList |
||
| 602 | ]; |
||
| 603 | } |
||
| 604 | |||
| 605 | // Hidden categories |
||
| 606 | if ( count( $hiddenCategories ) > 0 ) { |
||
| 607 | $pageInfo['header-properties'][] = [ |
||
| 608 | $this->msg( 'pageinfo-hidden-categories' ) |
||
| 609 | ->numParams( count( $hiddenCategories ) ), |
||
| 610 | Linker::formatHiddenCategories( $hiddenCategories ) |
||
| 611 | ]; |
||
| 612 | } |
||
| 613 | |||
| 614 | // Transcluded templates |
||
| 615 | if ( $pageCounts['transclusion']['from'] > 0 ) { |
||
| 616 | if ( $pageCounts['transclusion']['from'] > count( $transcludedTemplates ) ) { |
||
| 617 | $more = $this->msg( 'morenotlisted' )->escaped(); |
||
| 618 | } else { |
||
| 619 | $more = null; |
||
| 620 | } |
||
| 621 | |||
| 622 | $pageInfo['header-properties'][] = [ |
||
| 623 | $this->msg( 'pageinfo-templates' ) |
||
| 624 | ->numParams( $pageCounts['transclusion']['from'] ), |
||
| 625 | Linker::formatTemplates( |
||
| 626 | $transcludedTemplates, |
||
| 627 | false, |
||
| 628 | false, |
||
| 629 | $more ) |
||
| 630 | ]; |
||
| 631 | } |
||
| 632 | |||
| 633 | if ( !$config->get( 'MiserMode' ) && $pageCounts['transclusion']['to'] > 0 ) { |
||
| 634 | if ( $pageCounts['transclusion']['to'] > count( $transcludedTargets ) ) { |
||
| 635 | $more = Linker::link( |
||
| 636 | $whatLinksHere, |
||
| 637 | $this->msg( 'moredotdotdot' )->escaped(), |
||
| 638 | [], |
||
| 639 | [ 'hidelinks' => 1, 'hideredirs' => 1 ] |
||
| 640 | ); |
||
| 641 | } else { |
||
| 642 | $more = null; |
||
| 643 | } |
||
| 644 | |||
| 645 | $pageInfo['header-properties'][] = [ |
||
| 646 | $this->msg( 'pageinfo-transclusions' ) |
||
| 647 | ->numParams( $pageCounts['transclusion']['to'] ), |
||
| 648 | Linker::formatTemplates( |
||
| 649 | $transcludedTargets, |
||
| 650 | false, |
||
| 651 | false, |
||
| 652 | $more ) |
||
| 653 | ]; |
||
| 654 | } |
||
| 655 | } |
||
| 656 | |||
| 657 | return $pageInfo; |
||
| 658 | } |
||
| 659 | |||
| 890 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
integervalues, zero is a special case, in particular the following results might be unexpected: