This translation is older than the original page and might be outdated. See what has changed.
Translations of this page:
 

This is an old revision of the document!


PHP-Functions

This chapter shows you the main functions of PHP-Code Elements which can be used. The Introduction in PHP-Code will help you to integrate all PHP functions for your questionnaire.

At the very end of this page will be a helpful information how the documentation of the PHP-functions can be read: Function in Detail

Basic fuctions for filtering, questions and text

See also filter questions und filters.

  • value() – Use answer of participant, e.g. for a filter question
  • goToPage() – Jump to another page immediately
  • repeatPage() – Show recent page again
  • redirect() – Redirect the respondent to a different website
  • question() – Display a question within the questionnaire
  • text() – Display a text element within the questionnaire
  • debug() – Show content of a data or PHP variable

Modify How to Display a Questionnaire Page

  • option() – Modify page display settings (buttons, progress bar)
  • preset() – Preset a response for a question
  • markFail() – Set the marker “response missing” for an input
  • prepare_input() – Prepare an input to be shown within another question
  • html() – Output of HTML-Code within questionnaire
  • textlink() – Create a hyperlink that shows a text element in a pop-up window
  • buttonToPage() – Button to jump within the questionnaire
  • buttonCode() – Create-HTML-Code for next/back button
  • buttonHide() – Do not show back/next buttons at the page's bottom
  • library()​ – Make a JavaScript or PHP library available

Functions for Randomization

SoSci Survey supports several functions for random sampling or random group assignment (Randomization).

  • put() – Save a value in the data set
  • random() – Dice a random number (with replacement)
  • random_p() – Random number in correlation to likelihood
  • random_items() – Randomly select items from a list
  • urnDraw() – Draw out from urn (random selection without replacement)
  • urnPutAway() – Put away the chit drawn via urnDraw()
  • urnStatus() – Retrieve current status of an urn

Advanced programming

Databank for Contents

  • dbGet() – Read data from date base
  • dbKeys() – List key for data base
  • dbSet() – Safe data in data base
  • dbTouch() – Refresh time-stamp for data base entry

Analysis of all data

  • statistic() – Simple statistical analysis of all data
  • diagram() – Simple diagram (e. g. frequency) for all analyzed data

Analyses and Data Handling During an Interview

  • answers() – Show a question including the respondent's answers
  • answersOption() – Adjust display of answers via answers() or answersPrint()
  • answersPrint() – Display all questions of a questionnaire segment including the respondent's answers
  • valueSum() – Compute sum over scale or variables
  • valueMean() – Compute mean over scale or variable
  • valueSD() – Compute standard deviation over scale or variable
  • valueVar() – Compute variance over scale or variable
  • convertDateTime() – Convert date/time texts (strings) and timestamps

Data Visualization

Respondent and Mailing Management

PHP-internal functions

PHP provides a number of helpful functions, which can easily be used during questionnaire PHP Manual documented.

  • Useful functions in general
    • implode - Array-Fusion of elements to string
    • explode - Split string into array
    • preg_split - Split string with regular expression into array
  • Mathematical functions
    • round - Circular from comma
    • ceil - Round up
    • floor - Round down
    • abs - Find amount of number

Detailed functions

Reference-syntax for each function, e.g.:

void set(mixed Value, [string Memory])

This reference-syntax describes the argumentation of functions and it's data type.

  • At the beginning return function of data type is shown void, meaning: function is acting but does not return values.
  • Arguments listed in braces. Optional arguments in angled braces. Function set() has o have at least one argument Value than it is allowed to use another (second) argument Memory .
  • Type of data stands in front of argument:
    • mixed means different types of data are allowed
    • int is a number
    • string text with inverted comma
    • array List of values (Arrays)
en/create/functions.1517694219.txt.gz · Last modified: 03.02.2018 22:43 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki