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
See also filter questions und filters.
value() – Use answer of participant, e.g. for a filter questiongoToPage() – Jump to another page immediatelygoToPage('end') – End the current interviewrepeatPage() – Show recent page againredirect() – Redirect the respondent to a different websitequestion() – Display a question within the questionnairetext() – Display a text element within the questionnaireshow() – Display a question, combined question or text or activate a feature elementdebug() – Show content of a data or PHP variableoption() – Modify page display settings (buttons, progress bar)preset() – Preset a response for a questionmarkFail() – Set the marker “response missing” for an inputhtml() – Output of HTML-Code within questionnairetextlink() – Create a hyperlink that shows a text element in a pop-up windowbuttonToPage() – Button to jump within the questionnairebuttonCode() – Create-HTML-Code for next/back buttonbuttonHide() – Do not show back/next buttons at the page's bottomlibrary() – Make a JavaScript or PHP library availablepageCSS() – Add CSS instructions to a single questionnaire pagepageHead() – Store meta-information about the questionnaire pageSoSci Survey supports several functions for special random selections and random group assignments. For a simple experimental variation, we recommend a Random Generator (Randomization).
put() – Save a value in the data setrandom() – Dice a random number (with replacement)random_p() – Random number in correlation to likelihoodrandom_items() – Randomly select items from a listrandomUse() – Storing slips of paper from a random number generatorurnDraw() – Draw out from urn (random selection without replacement)urnPutAway() – Put away the chit drawn via urnDraw()urnStatus() – Retrieve current status of an urnreplace() – Prepare a placeholderregisterVariable() – Register PHP-Variable for following sitesid() – Create a question or variable label from it's componentsgetItems() – Order items of question by selected rulesgetQuestions() – Enlist a section's questionsgetItemtext() – Retrieve the text of a specific items or optiongetValueText() – Retrieve the label of a response code/optiongetTextElement() – Retrieve the content of a text elementgetVariables() – Return a list of variables from the datasetserialCheck() – Ask for serial numberreadGET() – Read converted variable from linksendJSON() – Send HTTP request in JSON format (REST API)sendPOST() – Send HTTP request in POST format (REST API)sendXML() – Send HTTP request in XML format (REST API)setNextPage() – Set side for click on ,,go further“setPageOrder() – Change the order to display subsequent questionnaire pages loopPage() – Show a page multiple times in a looploopToPage() – Show multiple pages multiple times in a looppageStop() – Do not show any further contents on the questionnaire pagesetLanguage() – Change languagebuttonDataCode() – Add a custom button on the page that sends additional informationbuttonDataGet() – Get the data sent via buttonDataCode()info() – Meta informationen int the current case or output configurationinfoVars() – Information on variables in the datasetgetRoute() – Tell if the next or back button was hit previouslycaseNumber() – Number of actual interviewscaseSerial() – Serial number used in interviewcaseTime() – Show length of stay on one or more sitescaseToken() – Identification of interviewcaseData() – Get all data collected in the current interviewreference() – Ask for reference (within link to questionnaires)getAnswerMissing() – Information for site repeat if questions was obligatedlistFails() – List of not responded obligation questionsgetLanguage() – Determine languagegoToQuestionnaire() – Jump from one Questionaire to the next (once)goToParent() – Go back to the formerly QuestionairemultiLevelDown() – Start a sub-questionaire inside the main questionaire (if necessary also several times)multiLevelData() – Get data specified in multiLevelDown()multiLevelReturn() – Return from the sub-questionnaire to the main questionnaire multiLevelResponse() – Get data specified in multiLevelReturn() multiLevelPut() – Write a value directly into the higher-level recordmultiLevelValue – Read a value directly from the higher-level recordmultiLevelURL() – Create a URL for a sub-questionnaire to be used latermultiLevelPrepare() – Create a subordinate case and preset it with values, to be used with a Multi-Level ListingdbGet() – Read data from date basedbKeys() – List key for data basedbLoad() – Call all entries with defined prefix from the contents database dbRetrieve() – Get data from the data base (associative, nested array)dbSet() – Safe data in data basedbStore() – Store data in the data base (associative, nested array)dbTouch() – Refresh time-stamp for data base entrydbDelete() – Delete entries from the data base, selected by a prefixdropValue() – Delete a single variable from the current interviewdropUpload() – Delete a file uploaded by the respondentdropCase() – Mark the current interview for deletiondropHistory() – Delete the page history of the current interviewstatistic() – Simple statistical analysis of all datadiagram() – Simple diagram (e. g. frequency) for all analyzed datapanelRecords() – Access other records with the same person ID (SERIAL)answers() – Show a question including the respondent's answersanswersPrint() – Display all questions of a questionnaire segment including the respondent's answersvalueSum() – Compute sum over scale or variablesvalueMean() – Compute mean over scale or variablevalueSD() – Compute standard deviation over scale or variablevalueVar() – Compute variance over scale or variablevalueList() – Get multiple responses to multiple items in a question as arrayconvertDateTime() – Convert date/time texts (strings) and timestampscalcMean(), calcSD(), ... – Simple calcuations based on the current interview's responsesuploadAsTable() – Get am Excel or CSV table uploaded by the respondent as arrayuploadRawData() – Get an uploaded file as binary stringdiagram2() – Create diagram with set datagetQRCodeImage() – Integrate QR Code in the questionnaireimagepng_embed() – Include a PNG graphic without storing it to a filemailResume() – Resume an interview after a given delaymailSchedule() – Schedule to send a mailing to a single recipientmailRevoke() – Cancel continuation mail(s) or a scheduled mailingmailSend() – Send an email to an address that is not in the list of contactspanelAdd() – Create a new address recordpanelData() – Get information from an existing address entrypanelUpdate() – Update information on the address recordpanelDelete() – Delete records from the address listaccessCount() – Limit trial to enter a codesetStatus() – Set the interview status and eventually trigger panel redirectsFurthermore, PHP itself provides numerous functions, some of which can be very helpful in the questionnaire. These functions are documented in the PHP Manual.
Some functions pose a security risk or do not work as expected in the context of the questionnaire. Alternatives are listed below. If you need additional features, please let SoSci Survey know.
echomysqld_query()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.
set() has o have at least one argument Value than it is allowed to use another (second) argument Memory .